#494 - DefaultLocation - Wed Jan 08, 2003 3:49 am
Hi all,
I have taken over a GBA game demo created by someone else, and the biggest bug at the moment is the audio. The audio works perfectly fine using VisualBoyAdvance, but when I try it out on my retail GBA, it is broken.
I am using a modified version of the "Audio Programming on the GameBoy Advance Part 1":
http://www.gamedev.net/reference/articles/article1823.asp
Basically I just created support for a second sound channel using Direct Sound channel B and timer 1. I use this for my music (yeah, lame I know) so I loop that while I play my sound effects on DS channel A (with timer 0). This works perfectly in VBA, but when I put it on a cart (Flash Linker) and try it in my GBA, it doesn't behave properly.
On the real GBA, the "play sound sample" calls seem to somehow be delayed by one call (bear with me). That's a terrible explanation, maybe an example will be better. Say at time 1 I want to play sound effect A, and at time 2 I want to play sound effect B. Works fine on VBA, but on the GBA, at time 1 NO sound will play, and then at time 2, sound effect A will play. This will continue to behave in this manner (at time 3, sound effect B, etc.). I time the sound effect DMA transfer by the vblanks and sample size (as in the tutorial), so that I stop the transfer when the sound effect is over. But it is using the wrong value, it is using the # of vblanks for the sound effect that SHOULD be playing, instead of the one that is playing (so I guess really it's the RIGHT # vblanks, but the wrong sound effect is playing). So this part seems to be behaving properly.
So this all happens whether I use one channel (A) or both channels (A+B). The only thing I can think of is that somehow the buffers (FIFO) are not emulated exactly the same as the real GBA, or maybe some difference in the DMA transfer settings?
I can post my modified audio code if anyone cares. Thanks for the help!
I have taken over a GBA game demo created by someone else, and the biggest bug at the moment is the audio. The audio works perfectly fine using VisualBoyAdvance, but when I try it out on my retail GBA, it is broken.
I am using a modified version of the "Audio Programming on the GameBoy Advance Part 1":
http://www.gamedev.net/reference/articles/article1823.asp
Basically I just created support for a second sound channel using Direct Sound channel B and timer 1. I use this for my music (yeah, lame I know) so I loop that while I play my sound effects on DS channel A (with timer 0). This works perfectly in VBA, but when I put it on a cart (Flash Linker) and try it in my GBA, it doesn't behave properly.
On the real GBA, the "play sound sample" calls seem to somehow be delayed by one call (bear with me). That's a terrible explanation, maybe an example will be better. Say at time 1 I want to play sound effect A, and at time 2 I want to play sound effect B. Works fine on VBA, but on the GBA, at time 1 NO sound will play, and then at time 2, sound effect A will play. This will continue to behave in this manner (at time 3, sound effect B, etc.). I time the sound effect DMA transfer by the vblanks and sample size (as in the tutorial), so that I stop the transfer when the sound effect is over. But it is using the wrong value, it is using the # of vblanks for the sound effect that SHOULD be playing, instead of the one that is playing (so I guess really it's the RIGHT # vblanks, but the wrong sound effect is playing). So this part seems to be behaving properly.
So this all happens whether I use one channel (A) or both channels (A+B). The only thing I can think of is that somehow the buffers (FIFO) are not emulated exactly the same as the real GBA, or maybe some difference in the DMA transfer settings?
I can post my modified audio code if anyone cares. Thanks for the help!