aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Audio/Renderer/Dsp/PcmHelper.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Ryujinx.Audio/Renderer/Dsp/PcmHelper.cs')
-rw-r--r--src/Ryujinx.Audio/Renderer/Dsp/PcmHelper.cs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/Ryujinx.Audio/Renderer/Dsp/PcmHelper.cs b/src/Ryujinx.Audio/Renderer/Dsp/PcmHelper.cs
index d209c515..8134e6b7 100644
--- a/src/Ryujinx.Audio/Renderer/Dsp/PcmHelper.cs
+++ b/src/Ryujinx.Audio/Renderer/Dsp/PcmHelper.cs
@@ -20,6 +20,11 @@ namespace Ryujinx.Audio.Renderer.Dsp
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int GetBufferSize<T>(int startSampleOffset, int endSampleOffset, int offset, int count) where T : unmanaged
{
+ if (endSampleOffset < startSampleOffset)
+ {
+ return 0;
+ }
+
return GetCountToDecode(startSampleOffset, endSampleOffset, offset, count) * Unsafe.SizeOf<T>();
}