delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/08/11/07:45:54

Message-ID: <8D53104ECD0CD211AF4000A0C9D60AE301562DD1@probe-2.acclaim-euro.net>
From: Shawn Hargreaves <ShawnH AT Probe DOT co DOT uk>
To: djgpp AT delorie DOT com
Subject: Re: SoundBlaster Interrupt Gets called only once!
Date: Mon, 9 Aug 1999 12:07:51 +0100
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.0.1460.8)
Reply-To: djgpp AT delorie DOT com

Sahab Yazdani writes:
> I have some code that will play a RAW sound file.  The problem is that
> the interrupt gets called only once!  See I want to make it so that in
> the future I can mix some sounds together also.  So the code for
> actually sending data has to be in the handler.

That's how it is supposed to work. Inside your handler, you restart
the SB and DMA controller with another buffer of data. You need to
do this very quickly to avoid clicking and distortion problems.

Alternatively, on the more recent types of SB you can use an 
autoinit DMA mode. You have to program both the SB and DMA
controller differently to enable this, but then it will loop 
endlessly around a single transfer buffer. People usually program 
the SB with half the buffer size of the DMA controller, which 
raises an interrupt twice per buffer, giving you a chance to mix
new samples into whichever half of the buffer isn't currently
playing, for click-free playback.

The Allegro dma.c and sb.c files would be a good place to look
to see this in action.


	Shawn Hargreaves.

- Raw text -


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