aboutsummaryrefslogtreecommitdiff
path: root/src/SPU.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/SPU.cpp')
-rw-r--r--src/SPU.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/SPU.cpp b/src/SPU.cpp
index a0d8dc8..7f70e65 100644
--- a/src/SPU.cpp
+++ b/src/SPU.cpp
@@ -684,19 +684,26 @@ void Mix(u32 samples)
}
-void ReadOutput(s16* data, int samples)
+int ReadOutput(s16* data, int samples)
{
+ if (OutputReadOffset == OutputWriteOffset)
+ return 0;
+
for (int i = 0; i < samples; i++)
{
*data++ = OutputBuffer[OutputReadOffset];
*data++ = OutputBuffer[OutputReadOffset + 1];
- if (OutputReadOffset != OutputWriteOffset)
+ //if (OutputReadOffset != OutputWriteOffset)
{
OutputReadOffset += 2;
OutputReadOffset &= ((2*OutputBufferSize)-1);
}
+ if (OutputReadOffset == OutputWriteOffset)
+ return i+1;
}
+
+ return samples;
}