From 3efe90f78a3536bfe86931cbcf24cb88545ccc17 Mon Sep 17 00:00:00 2001 From: Arisotura Date: Wed, 4 Sep 2019 16:40:29 +0200 Subject: deal with SPU FIFO overflow in a more pleasant manner --- src/SPU.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/SPU.cpp b/src/SPU.cpp index 9249416..9d5f04f 100644 --- a/src/SPU.cpp +++ b/src/SPU.cpp @@ -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); -- cgit v1.2.3