www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/04/07/19:45:52

From: Shawn Hargreaves <Shawn AT talula DOT demon DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Timer Interrupt
Date: Tue, 7 Apr 1998 21:12:36 +0100
Organization: None
Message-ID: <kFleLZA0ioK1Ew5R@talula.demon.co.uk>
References: <352A785E DOT D1F AT dcs DOT ed DOT ac DOT uk>
NNTP-Posting-Host: talula.demon.co.uk
MIME-Version: 1.0
Lines: 24
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Joshua Hale writes:
>Can anyone help me with the timer interrupt under DOS? I'm trying to
>play a sample using the timer interupt on a Sound Blaster, but I have
>a problem that I think is caused by my timer interrupt taking too long.

That isn't a very good way to go about sample playback, because as you
have discovered it is very hard (I would say impossible) to get an
interrupt going fast enough. A much better solution would be to use a
DMA transfer mode: you allocate a buffer somewhere in conventional
memory, fill it with sample data, program the DMA controller to transfer
this information to your soundcard, and then the sound will play at
whatever rate you specify while your program gets on with doing other
things in the foreground. The SB will generate an interrupt when the
buffer has finished playing, and you can use this to switch across to
another buffer of sample data, so you can build up longer sounds out of
a series of small DMA transfers.

For some working code that does this, look at the sb.c and dma.c files
from Allegro.


--
Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/
"Pigs use it for a tambourine" - Frank Zappa

- Raw text -


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