www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/06/04/16:19:56

Xref: news2.mv.net comp.os.msdos.djgpp:4572
From: Shawn Hargreaves <slh100 AT york DOT ac DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Sound Blaster Question.
Date: Mon, 3 Jun 1996 14:05:53 +0100
Organization: The University of York, UK
Lines: 37
Message-ID: <Pine.SGI.3.91.960603114110.85A-100000@tower.york.ac.uk>
NNTP-Posting-Host: sgi12.york.ac.uk
Mime-Version: 1.0
In-Reply-To: <4otfcg$eom@news.nevada.edu>
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

On 3 Jun 1996, GEORGE GAGHON wrote:

> I have been using the DJ SB-lib ver 0.5.  And it has been working fine.
> Except on my freinds Packard Bell 150mhz Pentium.  
> 
> Once and a while (every 10 times or so), the sound will change between 
> sounding OK, and static sounding, when we load something from the Hard Disk.
> It does the same thing when in Win95.  While the sound is playing from 
> DOS, I open some Notepads up and the sound starts to shift between normal 
> and not.  

This sounds like a problem I had with my sample mixer a while back, where 
the DMA transfer and my mixing code were getting out of sync with each 
other.

When the SB is being used in auto-initialised DMA mode, the DMA 
controller is programmed to cycle endlessly around a block of memory, and 
the SB is programmed to generate an interrupt every time half of the 
buffer has been played, which lets you mix a new chunk of sample data 
into the buffer. If you miss any of these interrupts (this shouldn't 
ever happen, but under a multitasking OS it does seem to occur every now 
and then), the DMA and end-of-buffer interrupts will get out of sync, so 
that you are mixing into the part of the buffer which is being played 
rather than the part which has just finished being played, producing 
static.

The way I fixed this was to poll the DMA controller every couple of 
seconds, to see where it has got to in the transfer and adjust my mixing 
code to make sure the two stay in sync. 


/*
 *	Shawn Hargreaves.        Why is 'phonetic' spelt with a ph?
 *	Check out Allegro and FED on http://www.york.ac.uk/~slh100/
 */


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019