From: Raul Kompass Newsgroups: comp.os.msdos.djgpp Subject: Re: Q: Allegro, precise sound timing Date: Sun, 28 Nov 1999 23:57:30 +0100 Organization: Uni Leipzig Lines: 37 Message-ID: <3841B35A.9B0132F4@server1.rz.uni-leipzig.de> References: NNTP-Posting-Host: pmin9.isdn.uni-leipzig.de Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 4.5 [en] (Win95; I) X-Accept-Language: en To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Shawn Hargreaves wrote: > > Bettina Altmann writes: > > for an experiment we have to compare the exact timing of a click > > that is presented by the soundcard with that of a keypress. > > Therefore we have to know the position of the voice playing the > > audiostream containing the clicks very precisely. Test of int > > voice_get_position(int voice) yielded that it gives the current > > position only in units of 248 samples (with our setup). > > This is inevitable on all the soundcards that Allegro supports, > and indeed on most PC sound hardware, because the cards work by > transferring blocks of samples by DMA, and then at the end of > each block, generating an interrupt to let the CPU refill the > next block of sound data. This means that there will always be > a slight delay between the CPU generating each block of sound, > and the card actually playing it, and also that the CPU will > only be able to access sound information according to the > granularity of whatever block size it is using. > If I understand the documents I just read right, DMA is used to fill the FIFO of the sound card. I suppose that the FIFO contains much less memory than a DMA-Block. So it should be possible to determine the voice position on the basis of the block used and on DMA information. _dma_todo() seems to be the right function here. Is that right? Unfortunately I don't understand how it works. Can _dma_todo() be used to improve the resolution of oice_get_position()? If yes: Can someone help us with that?. Thank you, Raul