Subject: how to write an audio driver?
To: None <current-users@NetBSD.ORG>
From: John F. Woods <jfw@funhouse.com>
List: current-users
Date: 07/15/1998 22:53:37
Is there any description of how one interfaces a new sound card to the
audio system other than audio(4) (which I found unenlightening) and
the actual audio code?  (I.e. something like Jason's recently
committed bus DMA paper would hit the spot, but I didn't see anything
like it...)

In particular, I am stumped by the description of mixer devices, in
particular "classes".  (It's particularly easy to get stumped, I
suppose, if you only work on this kind of stuff in the evening after a
full day of debugging NT driver code...)

I tried to describe how the ProAudio Spectrum is designed (if you can
call it that), and ended up being exceedingly wordy and not very
enlightening as to where I've gone off the track, so I'll just leave
it with this:  if anyone thinks they can enlighten me fairly quickly,
please send mail.  Note that I have looked over the existing audio
drivers; the trouble is that where the supported cards are similar
they tend to be nearly identical, and where they're not very similar
they're almost totally different, so it's hard to get a feel for the
abstract model hiding behind the code.  The SoundBlaster driver covers
a lot of bases, but the trouble is that it covers all the bases all at
once, even where the underlying hardware isn't all that similar, so
again I found it confusing.  I also really wonder about this gem:

	is1745 = ISSBM1745(sc);
	class = is1745 ? SB_INPUT_CLASS : SB_OUTPUT_CLASS;
        /* ... */
	switch (dip->index) {
	case SB_MIC_VOL:
		dip->type = AUDIO_MIXER_VALUE;
		dip->mixer_class = class;

the microphone is an "OUTPUT_CLASS" device?  Unless the reason is that
the more primitive sound blasters only have an output mixer and just
have a one-at-a-time switch for feeding the ADC (in which case I'm
still a bit confused, since audio(4) says that "those which control
all audio sources (e.g. master volume, equalization) are under the
output class").

Thanks for any help.
John Woods,
jfw@funhouse.com