aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArisotura <thetotalworm@gmail.com>2019-09-04 16:40:29 +0200
committerArisotura <thetotalworm@gmail.com>2019-09-04 16:40:29 +0200
commit3efe90f78a3536bfe86931cbcf24cb88545ccc17 (patch)
tree711bb03103a38a261ca155cf6a036af6add591c5
parent02a6fe182c21afe68f39067318f95eacaa051484 (diff)
deal with SPU FIFO overflow in a more pleasant manner
-rw-r--r--src/SPU.cpp8
1 files changed, 7 insertions, 1 deletions
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);