All stereo VAG commands would write to an out-of-bounds array element
and corrupt the whole VAG queue list.
Fixes random sound-related crashes including a consistent Light Jak
Freeze crash.
Change jak 3 SPU DMA to run the interrupt handler "immediately" (or at
least before `DMA_SendToSPUAndSync` returns).
This fixes an issue where audio can hang during fast cutscene playback.
I'm hoping it fixes more issues with looping/stuck audio as well, but
this needs more testing.
I originally wanted to do it this way, but thought that it didn't work -
from Jak 2 it seemed like things broke if the DMA was too fast. But, at
least for Jak 3, everything seems to work like this. This will remove a
huge source of non-deterministic timing in audio stuff and hopefully
make things easier to debug. It also means that a large portion of
streaming audio code will never have to run - from the game's point of
view there's always the next SPU buffer available.
If this works well, I might revisit jak 2 as well.
Co-authored-by: water111 <awaterford1111445@gmail.com>
Fix compiler warnings, and a bug where the `snd_handle` of
`SoundBankInfo` was never set, leading to sound banks never unloading.
The game relies on unloading soundbanks to make sure certain sounds
don't play, like the blue gun 1 fire noise when using blue gun 2.
---------
Co-authored-by: water111 <awaterford1111445@gmail.com>