aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Ryujinx.Audio/Renderer/Dsp/Command/AuxiliaryBufferCommand.cs15
-rw-r--r--src/Ryujinx.Audio/Renderer/Dsp/Command/BiquadFilterCommand.cs9
-rw-r--r--src/Ryujinx.Audio/Renderer/Dsp/Command/CommandList.cs4
-rw-r--r--src/Ryujinx.Audio/Renderer/Dsp/Command/CompressorCommand.cs12
-rw-r--r--src/Ryujinx.Audio/Renderer/Dsp/Command/DelayCommand.cs18
-rw-r--r--src/Ryujinx.Audio/Renderer/Dsp/Command/LimiterCommandVersion2.cs9
-rw-r--r--src/Ryujinx.Audio/Renderer/Dsp/Command/ReverbCommand.cs68
-rw-r--r--src/Ryujinx.Audio/Renderer/Dsp/FloatingPointHelper.cs18
-rw-r--r--src/Ryujinx.Audio/Renderer/Dsp/State/CompressorState.cs4
-rw-r--r--src/Ryujinx.Audio/Renderer/Dsp/State/DelayState.cs4
-rw-r--r--src/Ryujinx.Audio/Renderer/Dsp/State/LimiterState.cs2
-rw-r--r--src/Ryujinx.Audio/Renderer/Dsp/State/Reverb3dState.cs2
-rw-r--r--src/Ryujinx.Audio/Renderer/Dsp/State/ReverbState.cs4
13 files changed, 92 insertions, 77 deletions
diff --git a/src/Ryujinx.Audio/Renderer/Dsp/Command/AuxiliaryBufferCommand.cs b/src/Ryujinx.Audio/Renderer/Dsp/Command/AuxiliaryBufferCommand.cs
index 7ed32800f..73d66dcf4 100644
--- a/src/Ryujinx.Audio/Renderer/Dsp/Command/AuxiliaryBufferCommand.cs
+++ b/src/Ryujinx.Audio/Renderer/Dsp/Command/AuxiliaryBufferCommand.cs
@@ -31,9 +31,18 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
31 31
32 public bool IsEffectEnabled { get; } 32 public bool IsEffectEnabled { get; }
33 33
34 public AuxiliaryBufferCommand(uint bufferOffset, byte inputBufferOffset, byte outputBufferOffset, 34 public AuxiliaryBufferCommand(
35 ref AuxiliaryBufferAddresses sendBufferInfo, bool isEnabled, uint countMax, 35 uint bufferOffset,
36 CpuAddress outputBuffer, CpuAddress inputBuffer, uint updateCount, uint writeOffset, int nodeId) 36 byte inputBufferOffset,
37 byte outputBufferOffset,
38 ref AuxiliaryBufferAddresses sendBufferInfo,
39 bool isEnabled,
40 uint countMax,
41 CpuAddress outputBuffer,
42 CpuAddress inputBuffer,
43 uint updateCount,
44 uint writeOffset,
45 int nodeId)
37 { 46 {
38 Enabled = true; 47 Enabled = true;
39 NodeId = nodeId; 48 NodeId = nodeId;
diff --git a/src/Ryujinx.Audio/Renderer/Dsp/Command/BiquadFilterCommand.cs b/src/Ryujinx.Audio/Renderer/Dsp/Command/BiquadFilterCommand.cs
index f56dd70e3..ac1e581f6 100644
--- a/src/Ryujinx.Audio/Renderer/Dsp/Command/BiquadFilterCommand.cs
+++ b/src/Ryujinx.Audio/Renderer/Dsp/Command/BiquadFilterCommand.cs
@@ -21,7 +21,14 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
21 21
22 private BiquadFilterParameter _parameter; 22 private BiquadFilterParameter _parameter;
23 23
24 public BiquadFilterCommand(int baseIndex, ref BiquadFilterParameter filter, Memory<BiquadFilterState> biquadFilterStateMemory, int inputBufferOffset, int outputBufferOffset, bool needInitialization, int nodeId) 24 public BiquadFilterCommand(
25 int baseIndex,
26 ref BiquadFilterParameter filter,
27 Memory<BiquadFilterState> biquadFilterStateMemory,
28 int inputBufferOffset,
29 int outputBufferOffset,
30 bool needInitialization,
31 int nodeId)
25 { 32 {
26 _parameter = filter; 33 _parameter = filter;
27 BiquadFilterState = biquadFilterStateMemory; 34 BiquadFilterState = biquadFilterStateMemory;
diff --git a/src/Ryujinx.Audio/Renderer/Dsp/Command/CommandList.cs b/src/Ryujinx.Audio/Renderer/Dsp/Command/CommandList.cs
index 19a9576f7..3fe106ddf 100644
--- a/src/Ryujinx.Audio/Renderer/Dsp/Command/CommandList.cs
+++ b/src/Ryujinx.Audio/Renderer/Dsp/Command/CommandList.cs
@@ -77,7 +77,7 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
77 [MethodImpl(MethodImplOptions.AggressiveInlining)] 77 [MethodImpl(MethodImplOptions.AggressiveInlining)]
78 public unsafe void ClearBuffer(int index) 78 public unsafe void ClearBuffer(int index)
79 { 79 {
80 Unsafe.InitBlock((void*)GetBufferPointer(index), 0, SampleCount); 80 Unsafe.InitBlock((void*)GetBufferPointer(index), 0, SampleCount * sizeof(float));
81 } 81 }
82 82
83 [MethodImpl(MethodImplOptions.AggressiveInlining)] 83 [MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -89,7 +89,7 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
89 [MethodImpl(MethodImplOptions.AggressiveInlining)] 89 [MethodImpl(MethodImplOptions.AggressiveInlining)]
90 public unsafe void CopyBuffer(int outputBufferIndex, int inputBufferIndex) 90 public unsafe void CopyBuffer(int outputBufferIndex, int inputBufferIndex)
91 { 91 {
92 Unsafe.CopyBlock((void*)GetBufferPointer(outputBufferIndex), (void*)GetBufferPointer(inputBufferIndex), SampleCount); 92 Unsafe.CopyBlock((void*)GetBufferPointer(outputBufferIndex), (void*)GetBufferPointer(inputBufferIndex), SampleCount * sizeof(float));
93 } 93 }
94 94
95 [MethodImpl(MethodImplOptions.AggressiveInlining)] 95 [MethodImpl(MethodImplOptions.AggressiveInlining)]
diff --git a/src/Ryujinx.Audio/Renderer/Dsp/Command/CompressorCommand.cs b/src/Ryujinx.Audio/Renderer/Dsp/Command/CompressorCommand.cs
index 01291852e..1d5917bbe 100644
--- a/src/Ryujinx.Audio/Renderer/Dsp/Command/CompressorCommand.cs
+++ b/src/Ryujinx.Audio/Renderer/Dsp/Command/CompressorCommand.cs
@@ -94,18 +94,18 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
94 94
95 float newMean = inputMovingAverage.Update(FloatingPointHelper.MeanSquare(channelInput), _parameter.InputGain); 95 float newMean = inputMovingAverage.Update(FloatingPointHelper.MeanSquare(channelInput), _parameter.InputGain);
96 float y = FloatingPointHelper.Log10(newMean) * 10.0f; 96 float y = FloatingPointHelper.Log10(newMean) * 10.0f;
97 float z = 0.0f; 97 float z = 1.0f;
98 98
99 bool unknown10OutOfRange = false; 99 bool unknown10OutOfRange = y >= state.Unknown10;
100 100
101 if (newMean < 1.0e-10f) 101 if (newMean < 1.0e-10f)
102 { 102 {
103 z = 1.0f; 103 y = -100.0f;
104 104
105 unknown10OutOfRange = state.Unknown10 < -100.0f; 105 unknown10OutOfRange = state.Unknown10 <= -100.0f;
106 } 106 }
107 107
108 if (y >= state.Unknown10 || unknown10OutOfRange) 108 if (unknown10OutOfRange)
109 { 109 {
110 float tmpGain; 110 float tmpGain;
111 111
@@ -118,7 +118,7 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
118 tmpGain = (y - state.Unknown10) * ((y - state.Unknown10) * -state.CompressorGainReduction); 118 tmpGain = (y - state.Unknown10) * ((y - state.Unknown10) * -state.CompressorGainReduction);
119 } 119 }
120 120
121 z = FloatingPointHelper.DecibelToLinearExtended(tmpGain); 121 z = FloatingPointHelper.DecibelToLinear(tmpGain);
122 } 122 }
123 123
124 float unknown4New = z; 124 float unknown4New = z;
diff --git a/src/Ryujinx.Audio/Renderer/Dsp/Command/DelayCommand.cs b/src/Ryujinx.Audio/Renderer/Dsp/Command/DelayCommand.cs
index 003806cf7..6fa3777f4 100644
--- a/src/Ryujinx.Audio/Renderer/Dsp/Command/DelayCommand.cs
+++ b/src/Ryujinx.Audio/Renderer/Dsp/Command/DelayCommand.cs
@@ -88,7 +88,7 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
88 float outGain = FixedPointHelper.ToFloat(Parameter.OutGain, FixedPointPrecision); 88 float outGain = FixedPointHelper.ToFloat(Parameter.OutGain, FixedPointPrecision);
89 89
90 Matrix2x2 delayFeedback = new(delayFeedbackBaseGain, delayFeedbackCrossGain, 90 Matrix2x2 delayFeedback = new(delayFeedbackBaseGain, delayFeedbackCrossGain,
91 delayFeedbackCrossGain, delayFeedbackBaseGain); 91 delayFeedbackCrossGain, delayFeedbackBaseGain);
92 92
93 for (int i = 0; i < sampleCount; i++) 93 for (int i = 0; i < sampleCount; i++)
94 { 94 {
@@ -125,9 +125,9 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
125 float outGain = FixedPointHelper.ToFloat(Parameter.OutGain, FixedPointPrecision); 125 float outGain = FixedPointHelper.ToFloat(Parameter.OutGain, FixedPointPrecision);
126 126
127 Matrix4x4 delayFeedback = new(delayFeedbackBaseGain, delayFeedbackCrossGain, delayFeedbackCrossGain, 0.0f, 127 Matrix4x4 delayFeedback = new(delayFeedbackBaseGain, delayFeedbackCrossGain, delayFeedbackCrossGain, 0.0f,
128 delayFeedbackCrossGain, delayFeedbackBaseGain, 0.0f, delayFeedbackCrossGain, 128 delayFeedbackCrossGain, delayFeedbackBaseGain, 0.0f, delayFeedbackCrossGain,
129 delayFeedbackCrossGain, 0.0f, delayFeedbackBaseGain, delayFeedbackCrossGain, 129 delayFeedbackCrossGain, 0.0f, delayFeedbackBaseGain, delayFeedbackCrossGain,
130 0.0f, delayFeedbackCrossGain, delayFeedbackCrossGain, delayFeedbackBaseGain); 130 0.0f, delayFeedbackCrossGain, delayFeedbackCrossGain, delayFeedbackBaseGain);
131 131
132 132
133 for (int i = 0; i < sampleCount; i++) 133 for (int i = 0; i < sampleCount; i++)
@@ -172,11 +172,11 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
172 float outGain = FixedPointHelper.ToFloat(Parameter.OutGain, FixedPointPrecision); 172 float outGain = FixedPointHelper.ToFloat(Parameter.OutGain, FixedPointPrecision);
173 173
174 Matrix6x6 delayFeedback = new(delayFeedbackBaseGain, 0.0f, delayFeedbackCrossGain, 0.0f, delayFeedbackCrossGain, 0.0f, 174 Matrix6x6 delayFeedback = new(delayFeedbackBaseGain, 0.0f, delayFeedbackCrossGain, 0.0f, delayFeedbackCrossGain, 0.0f,
175 0.0f, delayFeedbackBaseGain, delayFeedbackCrossGain, 0.0f, 0.0f, delayFeedbackCrossGain, 175 0.0f, delayFeedbackBaseGain, delayFeedbackCrossGain, 0.0f, 0.0f, delayFeedbackCrossGain,
176 delayFeedbackCrossGain, delayFeedbackCrossGain, delayFeedbackBaseGain, 0.0f, 0.0f, 0.0f, 176 delayFeedbackCrossGain, delayFeedbackCrossGain, delayFeedbackBaseGain, 0.0f, 0.0f, 0.0f,
177 0.0f, 0.0f, 0.0f, feedbackGain, 0.0f, 0.0f, 177 0.0f, 0.0f, 0.0f, feedbackGain, 0.0f, 0.0f,
178 delayFeedbackCrossGain, 0.0f, 0.0f, 0.0f, delayFeedbackBaseGain, delayFeedbackCrossGain, 178 delayFeedbackCrossGain, 0.0f, 0.0f, 0.0f, delayFeedbackBaseGain, delayFeedbackCrossGain,
179 0.0f, delayFeedbackCrossGain, 0.0f, 0.0f, delayFeedbackCrossGain, delayFeedbackBaseGain); 179 0.0f, delayFeedbackCrossGain, 0.0f, 0.0f, delayFeedbackCrossGain, delayFeedbackBaseGain);
180 180
181 for (int i = 0; i < sampleCount; i++) 181 for (int i = 0; i < sampleCount; i++)
182 { 182 {
diff --git a/src/Ryujinx.Audio/Renderer/Dsp/Command/LimiterCommandVersion2.cs b/src/Ryujinx.Audio/Renderer/Dsp/Command/LimiterCommandVersion2.cs
index 682098670..f6e1654dd 100644
--- a/src/Ryujinx.Audio/Renderer/Dsp/Command/LimiterCommandVersion2.cs
+++ b/src/Ryujinx.Audio/Renderer/Dsp/Command/LimiterCommandVersion2.cs
@@ -28,7 +28,14 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
28 28
29 private LimiterParameter _parameter; 29 private LimiterParameter _parameter;
30 30
31 public LimiterCommandVersion2(uint bufferOffset, LimiterParameter parameter, Memory<LimiterState> state, Memory<EffectResultState> resultState, bool isEnabled, ulong workBuffer, int nodeId) 31 public LimiterCommandVersion2(
32 uint bufferOffset,
33 LimiterParameter parameter,
34 Memory<LimiterState> state,
35 Memory<EffectResultState> resultState,
36 bool isEnabled,
37 ulong workBuffer,
38 int nodeId)
32 { 39 {
33 Enabled = true; 40 Enabled = true;
34 NodeId = nodeId; 41 NodeId = nodeId;
diff --git a/src/Ryujinx.Audio/Renderer/Dsp/Command/ReverbCommand.cs b/src/Ryujinx.Audio/Renderer/Dsp/Command/ReverbCommand.cs
index f494b3028..874eb8e8b 100644
--- a/src/Ryujinx.Audio/Renderer/Dsp/Command/ReverbCommand.cs
+++ b/src/Ryujinx.Audio/Renderer/Dsp/Command/ReverbCommand.cs
@@ -79,53 +79,57 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
79 [MethodImpl(MethodImplOptions.AggressiveInlining)] 79 [MethodImpl(MethodImplOptions.AggressiveInlining)]
80 private void ProcessReverbMono(ref ReverbState state, ReadOnlySpan<IntPtr> outputBuffers, ReadOnlySpan<IntPtr> inputBuffers, uint sampleCount) 80 private void ProcessReverbMono(ref ReverbState state, ReadOnlySpan<IntPtr> outputBuffers, ReadOnlySpan<IntPtr> inputBuffers, uint sampleCount)
81 { 81 {
82 ProcessReverbGeneric(ref state, 82 ProcessReverbGeneric(
83 outputBuffers, 83 ref state,
84 inputBuffers, 84 outputBuffers,
85 sampleCount, 85 inputBuffers,
86 _outputEarlyIndicesTableMono, 86 sampleCount,
87 _targetEarlyDelayLineIndicesTableMono, 87 _outputEarlyIndicesTableMono,
88 _targetOutputFeedbackIndicesTableMono, 88 _targetEarlyDelayLineIndicesTableMono,
89 _outputIndicesTableMono); 89 _targetOutputFeedbackIndicesTableMono,
90 _outputIndicesTableMono);
90 } 91 }
91 92
92 [MethodImpl(MethodImplOptions.AggressiveInlining)] 93 [MethodImpl(MethodImplOptions.AggressiveInlining)]
93 private void ProcessReverbStereo(ref ReverbState state, ReadOnlySpan<IntPtr> outputBuffers, ReadOnlySpan<IntPtr> inputBuffers, uint sampleCount) 94 private void ProcessReverbStereo(ref ReverbState state, ReadOnlySpan<IntPtr> outputBuffers, ReadOnlySpan<IntPtr> inputBuffers, uint sampleCount)
94 { 95 {
95 ProcessReverbGeneric(ref state, 96 ProcessReverbGeneric(
96 outputBuffers, 97 ref state,
97 inputBuffers, 98 outputBuffers,
98 sampleCount, 99 inputBuffers,
99 _outputEarlyIndicesTableStereo, 100 sampleCount,
100 _targetEarlyDelayLineIndicesTableStereo, 101 _outputEarlyIndicesTableStereo,
101 _targetOutputFeedbackIndicesTableStereo, 102 _targetEarlyDelayLineIndicesTableStereo,
102 _outputIndicesTableStereo); 103 _targetOutputFeedbackIndicesTableStereo,
104 _outputIndicesTableStereo);
103 } 105 }
104 106
105 [MethodImpl(MethodImplOptions.AggressiveInlining)] 107 [MethodImpl(MethodImplOptions.AggressiveInlining)]
106 private void ProcessReverbQuadraphonic(ref ReverbState state, ReadOnlySpan<IntPtr> outputBuffers, ReadOnlySpan<IntPtr> inputBuffers, uint sampleCount) 108 private void ProcessReverbQuadraphonic(ref ReverbState state, ReadOnlySpan<IntPtr> outputBuffers, ReadOnlySpan<IntPtr> inputBuffers, uint sampleCount)
107 { 109 {
108 ProcessReverbGeneric(ref state, 110 ProcessReverbGeneric(
109 outputBuffers, 111 ref state,
110 inputBuffers, 112 outputBuffers,
111 sampleCount, 113 inputBuffers,
112 _outputEarlyIndicesTableQuadraphonic, 114 sampleCount,
113 _targetEarlyDelayLineIndicesTableQuadraphonic, 115 _outputEarlyIndicesTableQuadraphonic,
114 _targetOutputFeedbackIndicesTableQuadraphonic, 116 _targetEarlyDelayLineIndicesTableQuadraphonic,
115 _outputIndicesTableQuadraphonic); 117 _targetOutputFeedbackIndicesTableQuadraphonic,
118 _outputIndicesTableQuadraphonic);
116 } 119 }
117 120
118 [MethodImpl(MethodImplOptions.AggressiveInlining)] 121 [MethodImpl(MethodImplOptions.AggressiveInlining)]
119 private void ProcessReverbSurround(ref ReverbState state, ReadOnlySpan<IntPtr> outputBuffers, ReadOnlySpan<IntPtr> inputBuffers, uint sampleCount) 122 private void ProcessReverbSurround(ref ReverbState state, ReadOnlySpan<IntPtr> outputBuffers, ReadOnlySpan<IntPtr> inputBuffers, uint sampleCount)
120 { 123 {
121 ProcessReverbGeneric(ref state, 124 ProcessReverbGeneric(
122 outputBuffers, 125 ref state,
123 inputBuffers, 126 outputBuffers,
124 sampleCount, 127 inputBuffers,
125 _outputEarlyIndicesTableSurround, 128 sampleCount,
126 _targetEarlyDelayLineIndicesTableSurround, 129 _outputEarlyIndicesTableSurround,
127 _targetOutputFeedbackIndicesTableSurround, 130 _targetEarlyDelayLineIndicesTableSurround,
128 _outputIndicesTableSurround); 131 _targetOutputFeedbackIndicesTableSurround,
132 _outputIndicesTableSurround);
129 } 133 }
130 134
131 private unsafe void ProcessReverbGeneric(ref ReverbState state, ReadOnlySpan<IntPtr> outputBuffers, ReadOnlySpan<IntPtr> inputBuffers, uint sampleCount, ReadOnlySpan<int> outputEarlyIndicesTable, ReadOnlySpan<int> targetEarlyDelayLineIndicesTable, ReadOnlySpan<int> targetOutputFeedbackIndicesTable, ReadOnlySpan<int> outputIndicesTable) 135 private unsafe void ProcessReverbGeneric(ref ReverbState state, ReadOnlySpan<IntPtr> outputBuffers, ReadOnlySpan<IntPtr> inputBuffers, uint sampleCount, ReadOnlySpan<int> outputEarlyIndicesTable, ReadOnlySpan<int> targetEarlyDelayLineIndicesTable, ReadOnlySpan<int> targetOutputFeedbackIndicesTable, ReadOnlySpan<int> outputIndicesTable)
diff --git a/src/Ryujinx.Audio/Renderer/Dsp/FloatingPointHelper.cs b/src/Ryujinx.Audio/Renderer/Dsp/FloatingPointHelper.cs
index b231dbb6a..415e1c195 100644
--- a/src/Ryujinx.Audio/Renderer/Dsp/FloatingPointHelper.cs
+++ b/src/Ryujinx.Audio/Renderer/Dsp/FloatingPointHelper.cs
@@ -52,7 +52,7 @@ namespace Ryujinx.Audio.Renderer.Dsp
52 { 52 {
53 // NOTE: Nintendo uses an approximation of log10, we don't. 53 // NOTE: Nintendo uses an approximation of log10, we don't.
54 // As such, we support the same ranges as Nintendo to avoid unexpected behaviours. 54 // As such, we support the same ranges as Nintendo to avoid unexpected behaviours.
55 return MathF.Pow(10, MathF.Max(x, 1.0e-10f)); 55 return MathF.Log10(MathF.Max(x, 1.0e-10f));
56 } 56 }
57 57
58 [MethodImpl(MethodImplOptions.AggressiveInlining)] 58 [MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -62,7 +62,8 @@ namespace Ryujinx.Audio.Renderer.Dsp
62 62
63 foreach (float input in inputs) 63 foreach (float input in inputs)
64 { 64 {
65 res += (input * input); 65 float normInput = input * (1f / 32768f);
66 res += normInput * normInput;
66 } 67 }
67 68
68 res /= inputs.Length; 69 res /= inputs.Length;
@@ -81,19 +82,6 @@ namespace Ryujinx.Audio.Renderer.Dsp
81 return MathF.Pow(10.0f, db / 20.0f); 82 return MathF.Pow(10.0f, db / 20.0f);
82 } 83 }
83 84
84 /// <summary>
85 /// Map decibel to linear in [0, 2] range.
86 /// </summary>
87 /// <param name="db">The decibel value to convert</param>
88 /// <returns>Converted linear value in [0, 2] range</returns>
89 [MethodImpl(MethodImplOptions.AggressiveInlining)]
90 public static float DecibelToLinearExtended(float db)
91 {
92 float tmp = MathF.Log2(DecibelToLinear(db));
93
94 return MathF.Truncate(tmp) + MathF.Pow(2.0f, tmp - MathF.Truncate(tmp));
95 }
96
97 [MethodImpl(MethodImplOptions.AggressiveInlining)] 85 [MethodImpl(MethodImplOptions.AggressiveInlining)]
98 public static float DegreesToRadians(float degrees) 86 public static float DegreesToRadians(float degrees)
99 { 87 {
diff --git a/src/Ryujinx.Audio/Renderer/Dsp/State/CompressorState.cs b/src/Ryujinx.Audio/Renderer/Dsp/State/CompressorState.cs
index 76aff8072..9ee573205 100644
--- a/src/Ryujinx.Audio/Renderer/Dsp/State/CompressorState.cs
+++ b/src/Ryujinx.Audio/Renderer/Dsp/State/CompressorState.cs
@@ -3,7 +3,7 @@ using Ryujinx.Audio.Renderer.Parameter.Effect;
3 3
4namespace Ryujinx.Audio.Renderer.Dsp.State 4namespace Ryujinx.Audio.Renderer.Dsp.State
5{ 5{
6 public class CompressorState 6 public struct CompressorState
7 { 7 {
8 public ExponentialMovingAverage InputMovingAverage; 8 public ExponentialMovingAverage InputMovingAverage;
9 public float Unknown4; 9 public float Unknown4;
@@ -45,7 +45,7 @@ namespace Ryujinx.Audio.Renderer.Dsp.State
45 CompressorGainReduction = (1.0f - ratio) / Constants.ChannelCountMax; 45 CompressorGainReduction = (1.0f - ratio) / Constants.ChannelCountMax;
46 Unknown10 = threshold - 1.5f; 46 Unknown10 = threshold - 1.5f;
47 Unknown14 = threshold + 1.5f; 47 Unknown14 = threshold + 1.5f;
48 OutputGain = FloatingPointHelper.DecibelToLinearExtended(parameter.OutputGain + makeupGain); 48 OutputGain = FloatingPointHelper.DecibelToLinear(parameter.OutputGain + makeupGain);
49 } 49 }
50 } 50 }
51} 51}
diff --git a/src/Ryujinx.Audio/Renderer/Dsp/State/DelayState.cs b/src/Ryujinx.Audio/Renderer/Dsp/State/DelayState.cs
index c56fa078a..17ad2a40d 100644
--- a/src/Ryujinx.Audio/Renderer/Dsp/State/DelayState.cs
+++ b/src/Ryujinx.Audio/Renderer/Dsp/State/DelayState.cs
@@ -4,7 +4,7 @@ using System.Runtime.CompilerServices;
4 4
5namespace Ryujinx.Audio.Renderer.Dsp.State 5namespace Ryujinx.Audio.Renderer.Dsp.State
6{ 6{
7 public class DelayState 7 public struct DelayState
8 { 8 {
9 public DelayLine[] DelayLines { get; } 9 public DelayLine[] DelayLines { get; }
10 public float[] LowPassZ { get; set; } 10 public float[] LowPassZ { get; set; }
@@ -53,7 +53,7 @@ namespace Ryujinx.Audio.Renderer.Dsp.State
53 LowPassBaseGain = 1.0f - LowPassFeedbackGain; 53 LowPassBaseGain = 1.0f - LowPassFeedbackGain;
54 } 54 }
55 55
56 public void UpdateLowPassFilter(ref float tempRawRef, uint channelCount) 56 public readonly void UpdateLowPassFilter(ref float tempRawRef, uint channelCount)
57 { 57 {
58 for (int i = 0; i < channelCount; i++) 58 for (int i = 0; i < channelCount; i++)
59 { 59 {
diff --git a/src/Ryujinx.Audio/Renderer/Dsp/State/LimiterState.cs b/src/Ryujinx.Audio/Renderer/Dsp/State/LimiterState.cs
index 80d1cb62e..1388bfcef 100644
--- a/src/Ryujinx.Audio/Renderer/Dsp/State/LimiterState.cs
+++ b/src/Ryujinx.Audio/Renderer/Dsp/State/LimiterState.cs
@@ -4,7 +4,7 @@ using System;
4 4
5namespace Ryujinx.Audio.Renderer.Dsp.State 5namespace Ryujinx.Audio.Renderer.Dsp.State
6{ 6{
7 public class LimiterState 7 public struct LimiterState
8 { 8 {
9 public ExponentialMovingAverage[] DetectorAverage; 9 public ExponentialMovingAverage[] DetectorAverage;
10 public ExponentialMovingAverage[] CompressionGainAverage; 10 public ExponentialMovingAverage[] CompressionGainAverage;
diff --git a/src/Ryujinx.Audio/Renderer/Dsp/State/Reverb3dState.cs b/src/Ryujinx.Audio/Renderer/Dsp/State/Reverb3dState.cs
index 5056b750e..e83e0d5fc 100644
--- a/src/Ryujinx.Audio/Renderer/Dsp/State/Reverb3dState.cs
+++ b/src/Ryujinx.Audio/Renderer/Dsp/State/Reverb3dState.cs
@@ -4,7 +4,7 @@ using System;
4 4
5namespace Ryujinx.Audio.Renderer.Dsp.State 5namespace Ryujinx.Audio.Renderer.Dsp.State
6{ 6{
7 public class Reverb3dState 7 public struct Reverb3dState
8 { 8 {
9 private readonly float[] _fdnDelayMinTimes = new float[4] { 5.0f, 6.0f, 13.0f, 14.0f }; 9 private readonly float[] _fdnDelayMinTimes = new float[4] { 5.0f, 6.0f, 13.0f, 14.0f };
10 private readonly float[] _fdnDelayMaxTimes = new float[4] { 45.704f, 82.782f, 149.94f, 271.58f }; 10 private readonly float[] _fdnDelayMaxTimes = new float[4] { 45.704f, 82.782f, 149.94f, 271.58f };
diff --git a/src/Ryujinx.Audio/Renderer/Dsp/State/ReverbState.cs b/src/Ryujinx.Audio/Renderer/Dsp/State/ReverbState.cs
index 2f574f475..f1927b718 100644
--- a/src/Ryujinx.Audio/Renderer/Dsp/State/ReverbState.cs
+++ b/src/Ryujinx.Audio/Renderer/Dsp/State/ReverbState.cs
@@ -5,7 +5,7 @@ using System;
5 5
6namespace Ryujinx.Audio.Renderer.Dsp.State 6namespace Ryujinx.Audio.Renderer.Dsp.State
7{ 7{
8 public class ReverbState 8 public struct ReverbState
9 { 9 {
10 private static readonly float[] _fdnDelayTimes = new float[20] 10 private static readonly float[] _fdnDelayTimes = new float[20]
11 { 11 {
@@ -54,7 +54,7 @@ namespace Ryujinx.Audio.Renderer.Dsp.State
54 // Room 54 // Room
55 0.70f, 0.68f, 0.70f, 0.68f, 0.70f, 0.68f, 0.70f, 0.68f, 0.68f, 0.68f, 55 0.70f, 0.68f, 0.70f, 0.68f, 0.70f, 0.68f, 0.70f, 0.68f, 0.68f, 0.68f,
56 // Chamber 56 // Chamber
57 0.70f, 0.68f, 0.70f, 0.68f, 0.70f, 0.68f, 0.68f, 0.68f, 0.68f, 0.68f, 57 0.70f, 0.68f, 0.70f, 0.68f, 0.70f, 0.68f, 0.68f, 0.68f, 0.68f, 0.68f,
58 // Hall 58 // Hall
59 0.50f, 0.70f, 0.70f, 0.68f, 0.50f, 0.68f, 0.68f, 0.70f, 0.68f, 0.00f, 59 0.50f, 0.70f, 0.70f, 0.68f, 0.50f, 0.68f, 0.68f, 0.70f, 0.68f, 0.00f,
60 // Cathedral 60 // Cathedral