[Ryujinx.Audio] Address dotnet-format issues (#5362)
* dotnet format style --severity info Some changes were manually reverted. * dotnet format analyzers --serverity info Some changes have been minimally adapted. * Restore a few unused methods and variables * Silence dotnet format IDE0060 warnings * Silence dotnet format IDE0052 warnings * Address dotnet format CA1816 warnings * Address or silence dotnet format CA2208 warnings * Address or silence dotnet format CA2211 warnings * Address review comments * Address most dotnet format whitespace warnings * Apply dotnet format whitespace formatting A few of them have been manually reverted and the corresponding warning was silenced * Format if-blocks correctly * Run dotnet format whitespace after rebase * Run dotnet format after rebase and remove unused usings - analyzers - style - whitespace * Add comments to disabled warnings * Remove a few unused parameters * Simplify properties and array initialization, Use const when possible, Remove trailing commas * Start working on disabled warnings * Fix and silence a few dotnet-format warnings again * Address IDE0251 warnings * Silence IDE0060 in .editorconfig * Revert "Simplify properties and array initialization, Use const when possible, Remove trailing commas" This reverts commit 9462e4136c0a2100dc28b20cf9542e06790aa67e. * dotnet format whitespace after rebase * Fix naming rule violations, remove redundant code and fix build issues * Apply suggestions from code review Co-authored-by: Ac_K <Acoustik666@gmail.com> * Add trailing commas * Apply suggestions from code review Co-authored-by: Ac_K <Acoustik666@gmail.com> * Address review feedback --------- Co-authored-by: Ac_K <Acoustik666@gmail.com>
This commit is contained in:
@@ -9,4 +9,4 @@ namespace Ryujinx.Audio.Renderer.Dsp.State
|
||||
public short History0;
|
||||
public short History1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,4 +71,4 @@ namespace Ryujinx.Audio.Renderer.Dsp.State
|
||||
public AuxiliaryBufferInfo CpuBufferInfo;
|
||||
public AuxiliaryBufferInfo DspBufferInfo;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,4 +10,4 @@ namespace Ryujinx.Audio.Renderer.Dsp.State
|
||||
public float State2;
|
||||
public float State3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,4 +64,4 @@ namespace Ryujinx.Audio.Renderer.Dsp.State
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,12 +20,12 @@ namespace Ryujinx.Audio.Renderer.Dsp.State
|
||||
|
||||
DetectorAverage.AsSpan().Fill(new ExponentialMovingAverage(0.0f));
|
||||
CompressionGainAverage.AsSpan().Fill(new ExponentialMovingAverage(1.0f));
|
||||
DelayedSampleBufferPosition.AsSpan().Fill(0);
|
||||
DelayedSampleBuffer.AsSpan().Fill(0.0f);
|
||||
DelayedSampleBufferPosition.AsSpan().Clear();
|
||||
DelayedSampleBuffer.AsSpan().Clear();
|
||||
|
||||
UpdateParameter(ref parameter);
|
||||
}
|
||||
|
||||
public void UpdateParameter(ref LimiterParameter parameter) { }
|
||||
public static void UpdateParameter(ref LimiterParameter parameter) { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,11 +6,11 @@ namespace Ryujinx.Audio.Renderer.Dsp.State
|
||||
{
|
||||
public class Reverb3dState
|
||||
{
|
||||
private readonly float[] FdnDelayMinTimes = new float[4] { 5.0f, 6.0f, 13.0f, 14.0f };
|
||||
private readonly float[] FdnDelayMaxTimes = new float[4] { 45.704f, 82.782f, 149.94f, 271.58f };
|
||||
private readonly float[] DecayDelayMaxTimes1 = new float[4] { 17.0f, 13.0f, 9.0f, 7.0f };
|
||||
private readonly float[] DecayDelayMaxTimes2 = new float[4] { 19.0f, 11.0f, 10.0f, 6.0f };
|
||||
private readonly float[] EarlyDelayTimes = new float[20] { 0.017136f, 0.059154f, 0.16173f, 0.39019f, 0.42526f, 0.45541f, 0.68974f, 0.74591f, 0.83384f, 0.8595f, 0.0f, 0.075024f, 0.16879f, 0.2999f, 0.33744f, 0.3719f, 0.59901f, 0.71674f, 0.81786f, 0.85166f };
|
||||
private readonly float[] _fdnDelayMinTimes = new float[4] { 5.0f, 6.0f, 13.0f, 14.0f };
|
||||
private readonly float[] _fdnDelayMaxTimes = new float[4] { 45.704f, 82.782f, 149.94f, 271.58f };
|
||||
private readonly float[] _decayDelayMaxTimes1 = new float[4] { 17.0f, 13.0f, 9.0f, 7.0f };
|
||||
private readonly float[] _decayDelayMaxTimes2 = new float[4] { 19.0f, 11.0f, 10.0f, 6.0f };
|
||||
private readonly float[] _earlyDelayTimes = new float[20] { 0.017136f, 0.059154f, 0.16173f, 0.39019f, 0.42526f, 0.45541f, 0.68974f, 0.74591f, 0.83384f, 0.8595f, 0.0f, 0.075024f, 0.16879f, 0.2999f, 0.33744f, 0.3719f, 0.59901f, 0.71674f, 0.81786f, 0.85166f };
|
||||
public readonly float[] EarlyGain = new float[20] { 0.67096f, 0.61027f, 1.0f, 0.35680f, 0.68361f, 0.65978f, 0.51939f, 0.24712f, 0.45945f, 0.45021f, 0.64196f, 0.54879f, 0.92925f, 0.38270f, 0.72867f, 0.69794f, 0.5464f, 0.24563f, 0.45214f, 0.44042f };
|
||||
|
||||
public IDelayLine[] FdnDelayLines { get; }
|
||||
@@ -46,9 +46,9 @@ namespace Ryujinx.Audio.Renderer.Dsp.State
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
FdnDelayLines[i] = new DelayLine3d(sampleRate, FdnDelayMaxTimes[i]);
|
||||
DecayDelays1[i] = new DecayDelay(new DelayLine3d(sampleRate, DecayDelayMaxTimes1[i]));
|
||||
DecayDelays2[i] = new DecayDelay(new DelayLine3d(sampleRate, DecayDelayMaxTimes2[i]));
|
||||
FdnDelayLines[i] = new DelayLine3d(sampleRate, _fdnDelayMaxTimes[i]);
|
||||
DecayDelays1[i] = new DecayDelay(new DelayLine3d(sampleRate, _decayDelayMaxTimes1[i]));
|
||||
DecayDelays2[i] = new DecayDelay(new DelayLine3d(sampleRate, _decayDelayMaxTimes2[i]));
|
||||
}
|
||||
|
||||
PreDelayLine = new DelayLine3d(sampleRate, 400);
|
||||
@@ -63,7 +63,7 @@ namespace Ryujinx.Audio.Renderer.Dsp.State
|
||||
|
||||
EarlyDelayTime = new uint[20];
|
||||
DryGain = parameter.DryGain;
|
||||
PreviousFeedbackOutputDecayed.AsSpan().Fill(0);
|
||||
PreviousFeedbackOutputDecayed.AsSpan().Clear();
|
||||
PreviousPreDelayValue = 0;
|
||||
|
||||
EarlyReflectionsGain = FloatingPointHelper.Pow10(Math.Min(parameter.RoomGain + parameter.ReflectionsGain, 5000.0f) / 2000.0f);
|
||||
@@ -91,7 +91,7 @@ namespace Ryujinx.Audio.Renderer.Dsp.State
|
||||
|
||||
for (int i = 0; i < FdnDelayLines.Length; i++)
|
||||
{
|
||||
FdnDelayLines[i].SetDelay(FdnDelayMinTimes[i] + (parameter.Density / 100 * (FdnDelayMaxTimes[i] - FdnDelayMinTimes[i])));
|
||||
FdnDelayLines[i].SetDelay(_fdnDelayMinTimes[i] + (parameter.Density / 100 * (_fdnDelayMaxTimes[i] - _fdnDelayMinTimes[i])));
|
||||
|
||||
uint tempSampleCount = FdnDelayLines[i].CurrentSampleCount + DecayDelays1[i].CurrentSampleCount + DecayDelays2[i].CurrentSampleCount;
|
||||
|
||||
@@ -111,9 +111,9 @@ namespace Ryujinx.Audio.Renderer.Dsp.State
|
||||
|
||||
for (int i = 0; i < EarlyDelayTime.Length; i++)
|
||||
{
|
||||
uint sampleCount = Math.Min(IDelayLine.GetSampleCount(sampleRate, (parameter.ReflectionDelay * 1000.0f) + (EarlyDelayTimes[i] * 1000.0f * ((parameter.ReverbDelayTime * 0.9998f) + 0.02f))), PreDelayLine.SampleCountMax);
|
||||
uint sampleCount = Math.Min(IDelayLine.GetSampleCount(sampleRate, (parameter.ReflectionDelay * 1000.0f) + (_earlyDelayTimes[i] * 1000.0f * ((parameter.ReverbDelayTime * 0.9998f) + 0.02f))), PreDelayLine.SampleCountMax);
|
||||
EarlyDelayTime[i] = sampleCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace Ryujinx.Audio.Renderer.Dsp.State
|
||||
{
|
||||
public class ReverbState
|
||||
{
|
||||
private static readonly float[] FdnDelayTimes = new float[20]
|
||||
private static readonly float[] _fdnDelayTimes = new float[20]
|
||||
{
|
||||
// Room
|
||||
53.953247f, 79.192566f, 116.238770f, 130.615295f,
|
||||
@@ -21,7 +21,7 @@ namespace Ryujinx.Audio.Renderer.Dsp.State
|
||||
53.953247f, 79.192566f, 116.238770f, 170.615295f,
|
||||
};
|
||||
|
||||
private static readonly float[] DecayDelayTimes = new float[20]
|
||||
private static readonly float[] _decayDelayTimes = new float[20]
|
||||
{
|
||||
// Room
|
||||
7f, 9f, 13f, 17f,
|
||||
@@ -35,7 +35,7 @@ namespace Ryujinx.Audio.Renderer.Dsp.State
|
||||
7f, 9f, 13f, 17f,
|
||||
};
|
||||
|
||||
private static readonly float[] EarlyDelayTimes = new float[50]
|
||||
private static readonly float[] _earlyDelayTimes = new float[50]
|
||||
{
|
||||
// Room
|
||||
0.0f, 3.5f, 2.8f, 3.9f, 2.7f, 13.4f, 7.9f, 8.4f, 9.9f, 12.0f,
|
||||
@@ -46,10 +46,10 @@ namespace Ryujinx.Audio.Renderer.Dsp.State
|
||||
// Cathedral
|
||||
33.1f, 43.3f, 22.8f, 37.9f, 14.9f, 35.3f, 17.9f, 34.2f, 0.0f, 43.3f,
|
||||
// Disabled
|
||||
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f
|
||||
0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
|
||||
};
|
||||
|
||||
private static readonly float[] EarlyGainBase = new float[50]
|
||||
private static readonly float[] _earlyGainBase = new float[50]
|
||||
{
|
||||
// Room
|
||||
0.70f, 0.68f, 0.70f, 0.68f, 0.70f, 0.68f, 0.70f, 0.68f, 0.68f, 0.68f,
|
||||
@@ -60,10 +60,10 @@ namespace Ryujinx.Audio.Renderer.Dsp.State
|
||||
// Cathedral
|
||||
0.93f, 0.92f, 0.87f, 0.86f, 0.94f, 0.81f, 0.80f, 0.77f, 0.76f, 0.65f,
|
||||
// Disabled
|
||||
0.00f, 0.00f, 0.00f, 0.00f, 0.00f, 0.00f, 0.00f, 0.00f, 0.00f, 0.00f
|
||||
0.00f, 0.00f, 0.00f, 0.00f, 0.00f, 0.00f, 0.00f, 0.00f, 0.00f, 0.00f,
|
||||
};
|
||||
|
||||
private static readonly float[] PreDelayTimes = new float[5]
|
||||
private static readonly float[] _preDelayTimes = new float[5]
|
||||
{
|
||||
// Room
|
||||
12.5f,
|
||||
@@ -74,7 +74,7 @@ namespace Ryujinx.Audio.Renderer.Dsp.State
|
||||
// Cathedral
|
||||
50.0f,
|
||||
// Disabled
|
||||
0.0f
|
||||
0.0f,
|
||||
};
|
||||
|
||||
public DelayLine[] FdnDelayLines { get; }
|
||||
@@ -93,14 +93,14 @@ namespace Ryujinx.Audio.Renderer.Dsp.State
|
||||
|
||||
private const int FixedPointPrecision = 14;
|
||||
|
||||
private ReadOnlySpan<float> GetFdnDelayTimesByLateMode(ReverbLateMode lateMode)
|
||||
private static ReadOnlySpan<float> GetFdnDelayTimesByLateMode(ReverbLateMode lateMode)
|
||||
{
|
||||
return FdnDelayTimes.AsSpan((int)lateMode * 4, 4);
|
||||
return _fdnDelayTimes.AsSpan((int)lateMode * 4, 4);
|
||||
}
|
||||
|
||||
private ReadOnlySpan<float> GetDecayDelayTimesByLateMode(ReverbLateMode lateMode)
|
||||
private static ReadOnlySpan<float> GetDecayDelayTimesByLateMode(ReverbLateMode lateMode)
|
||||
{
|
||||
return DecayDelayTimes.AsSpan((int)lateMode * 4, 4);
|
||||
return _decayDelayTimes.AsSpan((int)lateMode * 4, 4);
|
||||
}
|
||||
|
||||
public ReverbState(ref ReverbParameter parameter, ulong workBuffer, bool isLongSizePreDelaySupported)
|
||||
@@ -148,8 +148,8 @@ namespace Ryujinx.Audio.Renderer.Dsp.State
|
||||
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
EarlyDelayTime[i] = Math.Min(IDelayLine.GetSampleCount(sampleRate, EarlyDelayTimes[i] + preDelayTimeInMilliseconds), PreDelayLine.SampleCountMax) + 1;
|
||||
EarlyGain[i] = EarlyGainBase[i] * earlyGain;
|
||||
EarlyDelayTime[i] = Math.Min(IDelayLine.GetSampleCount(sampleRate, _earlyDelayTimes[i] + preDelayTimeInMilliseconds), PreDelayLine.SampleCountMax) + 1;
|
||||
EarlyGain[i] = _earlyGainBase[i] * earlyGain;
|
||||
}
|
||||
|
||||
if (parameter.ChannelCount == 2)
|
||||
@@ -158,7 +158,7 @@ namespace Ryujinx.Audio.Renderer.Dsp.State
|
||||
EarlyGain[5] = EarlyGain[5] * 0.5f;
|
||||
}
|
||||
|
||||
PreDelayLineDelayTime = Math.Min(IDelayLine.GetSampleCount(sampleRate, PreDelayTimes[(int)parameter.EarlyMode] + preDelayTimeInMilliseconds), PreDelayLine.SampleCountMax);
|
||||
PreDelayLineDelayTime = Math.Min(IDelayLine.GetSampleCount(sampleRate, _preDelayTimes[(int)parameter.EarlyMode] + preDelayTimeInMilliseconds), PreDelayLine.SampleCountMax);
|
||||
|
||||
ReadOnlySpan<float> fdnDelayTimes = GetFdnDelayTimesByLateMode(parameter.LateMode);
|
||||
ReadOnlySpan<float> decayDelayTimes = GetDecayDelayTimesByLateMode(parameter.LateMode);
|
||||
@@ -201,4 +201,4 @@ namespace Ryujinx.Audio.Renderer.Dsp.State
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user