Skip to content

Commit

Permalink
deal with SPU FIFO overflow in a more pleasant manner
Browse files Browse the repository at this point in the history
  • Loading branch information
Arisotura committed Sep 4, 2019
1 parent 02a6fe1 commit 3efe90f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/SPU.cpp
Expand Up @@ -731,7 +731,13 @@ void Mix(u32 samples)
OutputBuffer[OutputWriteOffset + 1] = r >> 1;
OutputWriteOffset += 2;
OutputWriteOffset &= ((2*OutputBufferSize)-1);
if (OutputWriteOffset == OutputReadOffset) printf("!! SOUND FIFO OVERFLOW %d\n", OutputWriteOffset>>1);
if (OutputWriteOffset == OutputReadOffset)
{
//printf("!! SOUND FIFO OVERFLOW %d\n", OutputWriteOffset>>1);
// advance the read position too, to avoid losing the entire FIFO
OutputReadOffset += 2;
OutputReadOffset &= ((2*OutputBufferSize)-1);
}
}

NDS::ScheduleEvent(NDS::Event_SPU, true, 1024*kSamplesPerRun, Mix, kSamplesPerRun);
Expand Down

0 comments on commit 3efe90f

Please sign in to comment.