Gericom/GBARunner2

Stereo Desync Issue

Opened this issue · 2 comments

In certain games, when running using the DSP Audio branch, the two Direct Audio channels seem to become slightly out-of-sync seemingly at random. This produces a weird effect where the stereo image appears to suddenly 'move' around.

Examples:

  • Kirby and the Amazing Mirror - mostly random, but occurs more often when repeatedly using the Missile ability
  • Metroid Zero Mission - in the most recent official DSP build, this can occur semi-randomly when moving into a new door
  • Super Mario World: Super Mario Advance 2 - The channels slip out of sync semi-randomly when the game is saved. Repeatedly saving on the world map usually produces the error.

I've done some investigation myself with the source code as well. Though I don't have a great understanding of how it works, I've found that:

  • the Metroid Zero Mission issue disappears completely when the following lines in gbaAudio.c are uncommented (only for commit 088cbc5 and prior):
if (channel->isInitial)
{                    
    channel->isInitial = FALSE;
    continue;
}
  • comenting out these lines in gbaAudio.c seems to slightly reduce the problem in Mario Advance 2:
int diff = sampCounter - fSampCounter;
if(diff <= -16)
{
    // channel->overrunCounter++;
    // if(channel->overrunCounter >= 4)
    // {
    //     channel->fifoCount -= 4;
    //     channel->writeOffset = (channel->writeOffset - 2) & 0xF;
    //     channel->overrunCounter = 0;
    // }
}

Just wanted to note that I was experiencing this with Hamtaro - Rainbow Rescue (EU) earlier, pretty easy to get during screen transitions. Opening the GBARunner menu fixes it but it desyncs again pretty fast.