From 92bcdcb369b5e37f681861231186786a8c7d407f Mon Sep 17 00:00:00 2001 From: Mary Date: Sat, 21 Nov 2020 21:57:49 +0100 Subject: [PATCH] amadeus: Fix possible underflow in delay time delay effect (#1739) This fix an underflow in the setup of delay time in the delay effect. THis fix a regression caused by Amadeus on Shovel Knight: Treasure Trove. --- Ryujinx.Audio.Renderer/Dsp/Effect/DelayLine.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Ryujinx.Audio.Renderer/Dsp/Effect/DelayLine.cs b/Ryujinx.Audio.Renderer/Dsp/Effect/DelayLine.cs index b443cd151..3766390ab 100644 --- a/Ryujinx.Audio.Renderer/Dsp/Effect/DelayLine.cs +++ b/Ryujinx.Audio.Renderer/Dsp/Effect/DelayLine.cs @@ -42,7 +42,15 @@ namespace Ryujinx.Audio.Renderer.Dsp.Effect { CurrentSampleCount = Math.Min(SampleCountMax, targetSampleCount); _currentSampleIndex = 0; - _lastSampleIndex = CurrentSampleCount - 1; + + if (CurrentSampleCount == 0) + { + _lastSampleIndex = 0; + } + else + { + _lastSampleIndex = CurrentSampleCount - 1; + } } public void SetDelay(float delayTime)