9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: David Hogan dhog@cs.su.oz.au
Subject: pc audio buffer bug
Date: Mon, 10 Feb 1997 20:52:49 +1100	[thread overview]
Message-ID: <19970210095249.SUPa7841whaY05_XhhFU4Y_zC7EYnjE_ZQJ4kUNFzxA@z> (raw)

> There is a small bug in the buffer handling
> in the PC devaudio (Soundblaster) driver.
> Basically, if you open /dev/audio for writing,
> partially fill a buffer, and then close /dev/audio,
> the buffer doesn't get played.  You notice this
> with smallish sound files, because nothing gets
> played at all when the sound file is less than one
> buffer in size.

I seem to recall that there was another bug.  I can't remember
if I posted my fix for it or not.  The problem was that you could
fill up several buffers, but still get no audio, because you hadn't
filled enough buffers to start the dma going.

It looks like Russ's patch comes close to fixing this bug as well
(by virtue of the call to pokeaudio()).  But if the combined writes
to /dev/audio are a multiple of Bufsize, then it won't be called,
because audio.filling == 0.

My fix to this second bug was to change the while loop in
audioclose() to be

	do
		waitaudio();
	while (audio.active);

and change waitaudio() by adding the lines

	if (audio.active == 0)
		return;

before the tsleep().

I'm a bit concerned that I may have `done bad' -- my solution
can result in redundant commands being sent to the 'blaster
(``start! stop!'') if there's no outstanding data.  But it was, after
all, a quick hack so I could get back to the more important
work of playing with Csound :-)




             reply	other threads:[~1997-02-10  9:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-02-10  9:52 David [this message]
  -- strict thread matches above, loose matches on Subject: below --
1997-02-09 22:35 rsc

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=19970210095249.SUPa7841whaY05_XhhFU4Y_zC7EYnjE_ZQJ4kUNFzxA@z \
    --to=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).