I had similar problems with sound, but after reading
http://belogic.com/gba/, I came up with a solution. Instead of trying
to mix sounds once per frame, just use the timer interrupt and mix
one sample at a time. Actually, it's 4 samples at a time since the
FIFO buffer is 4 bytes, and that also causes problems because the
timer interrupt comes once per sample, so you have to use one timer
for frequency and another for the interrupt. A sample rate of 16384
is the easiest to deal with, cause you can just set the timer
multiplier to 1024, and the timer data to 0xFFFF. That also means you
can just use 0xFFFF - 3 for the IRQ timer.
Another solution would be to use a sampling rate that's divisible by
60, so you don't end up with any extra/missed samples. That was you
can use DMA to transfer data to the FIFO, which is faster than the
timer IRQ method. Again 16384 is good, since it's almost perfectly
divisible by 60, but if you want higher, 21000 is exactly 350 samples
per frame.
--- In gbadev@y..., "Tristan Rybak" <tristan.rybak@w...> wrote:
> I think, that's not the problem. I isolated my code so there is no
other DMA transfer then that feeding SOUND FIFO's.
[cropped by mod]