diff options
author | Mary <mary@mary.zone> | 2022-02-16 21:38:45 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-16 21:38:45 +0100 |
commit | ab5d77c0c4925955180dc51e9f289187ce6f2901 (patch) | |
tree | 55e3dc38d2a234a43b76fda6fb03e5eb83b97829 /Ryujinx.Audio/Renderer/Dsp/Command/LimiterCommandVersion2.cs | |
parent | 7bfb5f79b8a7447105df85ca405d915a124d7ca1 (diff) |
amadeus: Fix limiter correctness (#3126)1.1.30
This fixes missing audio on Nintendo Switch Sports Online Play Test.
Diffstat (limited to 'Ryujinx.Audio/Renderer/Dsp/Command/LimiterCommandVersion2.cs')
-rw-r--r-- | Ryujinx.Audio/Renderer/Dsp/Command/LimiterCommandVersion2.cs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Ryujinx.Audio/Renderer/Dsp/Command/LimiterCommandVersion2.cs b/Ryujinx.Audio/Renderer/Dsp/Command/LimiterCommandVersion2.cs index 3ff758ba..e5c85b94 100644 --- a/Ryujinx.Audio/Renderer/Dsp/Command/LimiterCommandVersion2.cs +++ b/Ryujinx.Audio/Renderer/Dsp/Command/LimiterCommandVersion2.cs @@ -111,9 +111,11 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command { for (int sampleIndex = 0; sampleIndex < context.SampleCount; sampleIndex++) { - float inputSample = *((float*)inputBuffers[channelIndex] + sampleIndex); + float rawInputSample = *((float*)inputBuffers[channelIndex] + sampleIndex); - float sampleInputMax = Math.Abs(inputSample * Parameter.InputGain); + float inputSample = (rawInputSample / short.MaxValue) * Parameter.InputGain; + + float sampleInputMax = Math.Abs(inputSample); float inputCoefficient = Parameter.ReleaseCoefficient; @@ -142,7 +144,9 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command ref float delayedSample = ref state.DelayedSampleBuffer[channelIndex * Parameter.DelayBufferSampleCountMax + state.DelayedSampleBufferPosition[channelIndex]]; - *((float*)outputBuffers[channelIndex] + sampleIndex) = delayedSample * state.CompressionGain[channelIndex] * Parameter.OutputGain; + float outputSample = delayedSample * state.CompressionGain[channelIndex] * Parameter.OutputGain; + + *((float*)outputBuffers[channelIndex] + sampleIndex) = outputSample * short.MaxValue; delayedSample = inputSample; |