9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: rsc@research.att.com rsc@research.att.com
Subject: pc audio buffer bug
Date: Sun,  9 Feb 1997 17:35:21 -0500	[thread overview]
Message-ID: <19970209223521.so3USmZnwgx59yb6fmkP2IGrAjOSrY0fKmYCynvnuZc@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.

My fix is to add 
	int omode;
	Buf *b;

at the beginning of 
/sys/src/9/pc/devaudio.c:/^audioclose
and in the case Qaudio that follows, insert
	omode = audio.amode;
before audio.amode = Aclosed;

Then, before the while(audio.active), insert
	if(omode == Awrite && audio.filling != 0) {
		print("flush...");
		b = audio.filling;
		audio.filling = 0;
		memset(b->virt+audio.curcount, 0, Bufsize-audio.curcount);
		swab(b->virt);
		putbuf(&audio.full, b);
		pokeaudio();
	}

I would post a diff, but I've hacked up devaudio.c
too much.  Just looking at the code for other 
architectures, it appears that next/devaudio.c also
suffers from this bug, while indigo3k/devaudio.c
does not.

Russ




             reply	other threads:[~1997-02-09 22:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-02-09 22:35 rsc [this message]
1997-02-10  9:52 David

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=19970209223521.so3USmZnwgx59yb6fmkP2IGrAjOSrY0fKmYCynvnuZc@z \
    --to=rsc@research.att.com \
    /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).