aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Audio/Renderer/Dsp/Command/LimiterCommandVersion2.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Ryujinx.Audio/Renderer/Dsp/Command/LimiterCommandVersion2.cs')
-rw-r--r--Ryujinx.Audio/Renderer/Dsp/Command/LimiterCommandVersion2.cs10
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;