Subject: Re: SB NetBSD driver problem
To: None <bk35+@andrew.cmu.edu>
From: John Kohl <jtk@kolvir.arlington.ma.us>
List: current-users
Date: 08/03/1995 23:06:48
>>>>> "Brad" == Brad Kidwell <bk35+@andrew.cmu.edu> writes:

Brad> John,

Brad> I have a problem when I write to /dev/audio (NetBSD -current post July
Brad> 8, 1995) after receiving an audio packet from the network.    I am using
Brad> SB Pro cards.  I find two separate problems:

Brad> 1.  I must write at least 8000 bytes to the audio_device, otherwise the
Brad> write returns successfully but no sound is produced.
Brad> 2.  If I perform several writes to the audio device, each write
Brad> consisting of 8000 bytes of data received from a network socket; and
Brad> then no data is written for at least one second; subsequent writes
Brad> produce no sound although the write returns a correct byte count. 
Brad> However, if I perform an AUDIO_FLUSH after no data has been received,
Brad> the audio device begins to work correctly.

This is actually expected behavior.  (a) The driver expects you to send
output in blocksize chunks.  If you send less, the remainder of a block
will be filled with audio silence on each write.

You can try to set the blocksize smaller with AUDIO_SETINFO; some audio
cards will impose strict limits on minimum audio block sizes.  The
maximum block size is 1/2 page.

(b) If you don't keep up in "real time" with the selected audio rate,
the drivers will fill in the gap with silence until you write enough
bytes to "catch up".  Flushing or otherwise pausing/unpausing the output
should allow you to resume immediately.

==John