Subject: Using /dev/audio and other things
To: None <netbsd-help@NetBSD.ORG>
From: Brett Lymn <blymn@awadi.com.AU>
List: netbsd-help
Date: 12/31/1995 19:07:41
Folks,
        I have spent a bit of time diddling with playing sounds out
/dev/audio on a box running NetBSD, an i486DX and a SBPro sound card.
If I cat a .au file to /dev/audio it works fine, I get what I expect.

What I am trying to do now is mix about 8 channels of sampled data and
pump it out the speakers in stereo.  At the moment I am doing the mixing in
software but after RTFS I see there is a mixer - can I use this mixer
to do the mixing for me?  If so, how do I use it, what I need to do is
play a particular bit of data at a certain volume and left/right
fading for each of the 8 channels - can this be done by the card?

Also, what is the format of the data?  In the source it looks like it
is just bytes.  If it is, how is stereo data presented?  Alternating
bytes representing left and right or what?

I have got the thing making sounds but it is not very satisfactory -
in my mixing scheme I am blocking the data into 4k chunks and writing
these to /dev/audio - this sort of works but from the sounds I am
getting out it seems that the later writes are munging the currently
playing sound chunk.  Using AUDIO_GETINFO I can see that the error bit
is set on the play status, which confirms that I am stuffing the data
in too fast.  How can I block the data to the device properly?  loop
on the number of samples left? (these things become moot if I can do
the mixing in hardware since then I would not need to do the mixing
myself and hence the blocking concept can go away).

Just to make life really interesting, the mixing and playing need to
be done in near real time.  The thing I am writing sits on the end of
a pipe getting commands to play various sounds, the sounds are
definitely not sequential and must be produced in quasi-realtime
otherwise I might as well not bother.  This means that any offline
processing is out of the question (just in case you thought of that ;-)


Finally, the other thing - what is the fix to  get gdb working in
NetBSD 1.1 (I am actually running a late alpha NetBSD 1.1... maybe it
was fixed for the release?)?  I remember seeing something about this a
while ago, I thought that it was that NUM_REGS was wrong - I made mine
16 but the task under debug still segv's.

-- 
Brett Lymn, Computer Systems Administrator, AWA Defence Industries
===============================================================================
  "Upgrading your memory gives you MORE RAM!" - ad in MacWAREHOUSE catalogue.