Mail Archives: djgpp/1999/11/28/20:30:48
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
- Raw text -