misc: chore: Merge into pattern

This commit is contained in:
KeatonTheBot
2025-09-24 13:51:15 -05:00
parent 503dea74c2
commit fa682d406e
157 changed files with 470 additions and 546 deletions
@@ -40,7 +40,7 @@ namespace Ryujinx.Audio.Renderer.Dsp.State
DelayFeedbackBaseGain = (1.0f - channelSpread) * FeedbackGain;
if (parameter.ChannelCount == 4 || parameter.ChannelCount == 6)
if (parameter.ChannelCount is 4 or 6)
{
DelayFeedbackCrossGain = channelSpread * 0.5f * FeedbackGain;
}
@@ -91,7 +91,7 @@ namespace Ryujinx.Audio.Renderer.Parameter
/// <returns>Returns true if the channel count is valid.</returns>
public static bool IsChannelCountValid(int channelCount)
{
return channelCount == 1 || channelCount == 2 || channelCount == 4 || channelCount == 6;
return channelCount is 1 or 2 or 4 or 6;
}
}
}
@@ -91,7 +91,7 @@ namespace Ryujinx.Audio.Renderer.Parameter
/// <returns>Returns true if the channel count is valid.</returns>
public static bool IsChannelCountValid(int channelCount)
{
return channelCount == 1 || channelCount == 2 || channelCount == 4 || channelCount == 6;
return channelCount is 1 or 2 or 4 or 6;
}
}
}
@@ -532,13 +532,13 @@ namespace Ryujinx.Audio.Renderer.Server
CommandType commandType = command.CommandType;
if (commandType == CommandType.AdpcmDataSourceVersion1 ||
commandType == CommandType.AdpcmDataSourceVersion2 ||
commandType == CommandType.PcmInt16DataSourceVersion1 ||
commandType == CommandType.PcmInt16DataSourceVersion2 ||
commandType == CommandType.PcmFloatDataSourceVersion1 ||
commandType == CommandType.PcmFloatDataSourceVersion2 ||
commandType == CommandType.Performance)
if (commandType is CommandType.AdpcmDataSourceVersion1
or CommandType.AdpcmDataSourceVersion2
or CommandType.PcmInt16DataSourceVersion1
or CommandType.PcmInt16DataSourceVersion2
or CommandType.PcmFloatDataSourceVersion1
or CommandType.PcmFloatDataSourceVersion2
or CommandType.Performance)
{
break;
}
@@ -20,7 +20,7 @@ namespace Ryujinx.Audio.Renderer.Server
public uint Estimate(PerformanceCommand command)
{
Debug.Assert(_sampleCount == 160 || _sampleCount == 240);
Debug.Assert(_sampleCount is 160 or 240);
if (_sampleCount == 160)
{
@@ -32,7 +32,7 @@ namespace Ryujinx.Audio.Renderer.Server
public uint Estimate(ClearMixBufferCommand command)
{
Debug.Assert(_sampleCount == 160 || _sampleCount == 240);
Debug.Assert(_sampleCount is 160 or 240);
float costPerBuffer = 668.8f;
float baseCost = 193.2f;
@@ -48,7 +48,7 @@ namespace Ryujinx.Audio.Renderer.Server
public uint Estimate(BiquadFilterCommand command)
{
Debug.Assert(_sampleCount == 160 || _sampleCount == 240);
Debug.Assert(_sampleCount is 160 or 240);
if (_sampleCount == 160)
{
@@ -62,7 +62,7 @@ namespace Ryujinx.Audio.Renderer.Server
{
const float CostPerSample = 7.245f;
Debug.Assert(_sampleCount == 160 || _sampleCount == 240);
Debug.Assert(_sampleCount is 160 or 240);
int volumeCount = 0;
@@ -79,7 +79,7 @@ namespace Ryujinx.Audio.Renderer.Server
public uint Estimate(MixRampCommand command)
{
Debug.Assert(_sampleCount == 160 || _sampleCount == 240);
Debug.Assert(_sampleCount is 160 or 240);
if (_sampleCount == 160)
{
@@ -91,7 +91,7 @@ namespace Ryujinx.Audio.Renderer.Server
public uint Estimate(DepopPrepareCommand command)
{
Debug.Assert(_sampleCount == 160 || _sampleCount == 240);
Debug.Assert(_sampleCount is 160 or 240);
if (_sampleCount == 160)
{
@@ -103,7 +103,7 @@ namespace Ryujinx.Audio.Renderer.Server
public uint Estimate(VolumeRampCommand command)
{
Debug.Assert(_sampleCount == 160 || _sampleCount == 240);
Debug.Assert(_sampleCount is 160 or 240);
if (_sampleCount == 160)
{
@@ -115,7 +115,7 @@ namespace Ryujinx.Audio.Renderer.Server
public uint Estimate(PcmInt16DataSourceCommandVersion1 command)
{
Debug.Assert(_sampleCount == 160 || _sampleCount == 240);
Debug.Assert(_sampleCount is 160 or 240);
float costPerSample = 1195.5f;
float baseCost = 7797.0f;
@@ -131,7 +131,7 @@ namespace Ryujinx.Audio.Renderer.Server
public uint Estimate(AdpcmDataSourceCommandVersion1 command)
{
Debug.Assert(_sampleCount == 160 || _sampleCount == 240);
Debug.Assert(_sampleCount is 160 or 240);
float costPerSample = 3564.1f;
float baseCost = 6225.5f;
@@ -147,7 +147,7 @@ namespace Ryujinx.Audio.Renderer.Server
public uint Estimate(DepopForMixBuffersCommand command)
{
Debug.Assert(_sampleCount == 160 || _sampleCount == 240);
Debug.Assert(_sampleCount is 160 or 240);
if (_sampleCount == 160)
{
@@ -159,7 +159,7 @@ namespace Ryujinx.Audio.Renderer.Server
public uint Estimate(CopyMixBufferCommand command)
{
Debug.Assert(_sampleCount == 160 || _sampleCount == 240);
Debug.Assert(_sampleCount is 160 or 240);
if (_sampleCount == 160)
{
@@ -171,7 +171,7 @@ namespace Ryujinx.Audio.Renderer.Server
public uint Estimate(MixCommand command)
{
Debug.Assert(_sampleCount == 160 || _sampleCount == 240);
Debug.Assert(_sampleCount is 160 or 240);
if (_sampleCount == 160)
{
@@ -183,7 +183,7 @@ namespace Ryujinx.Audio.Renderer.Server
public uint Estimate(DelayCommand command)
{
Debug.Assert(_sampleCount == 160 || _sampleCount == 240);
Debug.Assert(_sampleCount is 160 or 240);
if (_sampleCount == 160)
{
@@ -234,7 +234,7 @@ namespace Ryujinx.Audio.Renderer.Server
public uint Estimate(ReverbCommand command)
{
Debug.Assert(_sampleCount == 160 || _sampleCount == 240);
Debug.Assert(_sampleCount is 160 or 240);
if (_sampleCount == 160)
{
@@ -285,7 +285,7 @@ namespace Ryujinx.Audio.Renderer.Server
public uint Estimate(Reverb3dCommand command)
{
Debug.Assert(_sampleCount == 160 || _sampleCount == 240);
Debug.Assert(_sampleCount is 160 or 240);
if (_sampleCount == 160)
{
@@ -335,7 +335,7 @@ namespace Ryujinx.Audio.Renderer.Server
public uint Estimate(AuxiliaryBufferCommand command)
{
Debug.Assert(_sampleCount == 160 || _sampleCount == 240);
Debug.Assert(_sampleCount is 160 or 240);
if (_sampleCount == 160)
{
@@ -357,7 +357,7 @@ namespace Ryujinx.Audio.Renderer.Server
public uint Estimate(VolumeCommand command)
{
Debug.Assert(_sampleCount == 160 || _sampleCount == 240);
Debug.Assert(_sampleCount is 160 or 240);
if (_sampleCount == 160)
{
@@ -369,7 +369,7 @@ namespace Ryujinx.Audio.Renderer.Server
public uint Estimate(CircularBufferSinkCommand command)
{
Debug.Assert(_sampleCount == 160 || _sampleCount == 240);
Debug.Assert(_sampleCount is 160 or 240);
float costPerBuffer = 1726.0f;
float baseCost = 1369.7f;
@@ -385,7 +385,7 @@ namespace Ryujinx.Audio.Renderer.Server
public uint Estimate(DownMixSurroundToStereoCommand command)
{
Debug.Assert(_sampleCount == 160 || _sampleCount == 240);
Debug.Assert(_sampleCount is 160 or 240);
if (_sampleCount == 160)
{
@@ -397,7 +397,7 @@ namespace Ryujinx.Audio.Renderer.Server
public uint Estimate(UpsampleCommand command)
{
Debug.Assert(_sampleCount == 160 || _sampleCount == 240);
Debug.Assert(_sampleCount is 160 or 240);
if (_sampleCount == 160)
{
@@ -409,8 +409,8 @@ namespace Ryujinx.Audio.Renderer.Server
public uint Estimate(DeviceSinkCommand command)
{
Debug.Assert(_sampleCount == 160 || _sampleCount == 240);
Debug.Assert(command.InputCount == 2 || command.InputCount == 6);
Debug.Assert(_sampleCount is 160 or 240);
Debug.Assert(command.InputCount is 2 or 6);
if (command.InputCount == 2)
{
@@ -433,7 +433,7 @@ namespace Ryujinx.Audio.Renderer.Server
public uint Estimate(PcmFloatDataSourceCommandVersion1 command)
{
// NOTE: This was added between REV7 and REV8 and for some reasons the estimator v2 was changed...
Debug.Assert(_sampleCount == 160 || _sampleCount == 240);
Debug.Assert(_sampleCount is 160 or 240);
float costPerSample = 3490.9f;
float baseCost = 10091.0f;
@@ -23,7 +23,7 @@ namespace Ryujinx.Audio.Renderer.Server
public uint Estimate(PerformanceCommand command)
{
Debug.Assert(SampleCount == 160 || SampleCount == 240);
Debug.Assert(SampleCount is 160 or 240);
if (SampleCount == 160)
{
@@ -35,7 +35,7 @@ namespace Ryujinx.Audio.Renderer.Server
public uint Estimate(ClearMixBufferCommand command)
{
Debug.Assert(SampleCount == 160 || SampleCount == 240);
Debug.Assert(SampleCount is 160 or 240);
float costPerBuffer = 440.68f;
float baseCost = 0;
@@ -50,7 +50,7 @@ namespace Ryujinx.Audio.Renderer.Server
public uint Estimate(BiquadFilterCommand command)
{
Debug.Assert(SampleCount == 160 || SampleCount == 240);
Debug.Assert(SampleCount is 160 or 240);
if (SampleCount == 160)
{
@@ -64,7 +64,7 @@ namespace Ryujinx.Audio.Renderer.Server
{
float costPerSample = 6.4434f;
Debug.Assert(SampleCount == 160 || SampleCount == 240);
Debug.Assert(SampleCount is 160 or 240);
if (SampleCount == 160)
{
@@ -86,7 +86,7 @@ namespace Ryujinx.Audio.Renderer.Server
public uint Estimate(MixRampCommand command)
{
Debug.Assert(SampleCount == 160 || SampleCount == 240);
Debug.Assert(SampleCount is 160 or 240);
if (SampleCount == 160)
{
@@ -103,7 +103,7 @@ namespace Ryujinx.Audio.Renderer.Server
public uint Estimate(VolumeRampCommand command)
{
Debug.Assert(SampleCount == 160 || SampleCount == 240);
Debug.Assert(SampleCount is 160 or 240);
if (SampleCount == 160)
{
@@ -115,7 +115,7 @@ namespace Ryujinx.Audio.Renderer.Server
public uint Estimate(PcmInt16DataSourceCommandVersion1 command)
{
Debug.Assert(SampleCount == 160 || SampleCount == 240);
Debug.Assert(SampleCount is 160 or 240);
float costPerSample = 710.143f;
float baseCost = 7853.286f;
@@ -131,7 +131,7 @@ namespace Ryujinx.Audio.Renderer.Server
public uint Estimate(AdpcmDataSourceCommandVersion1 command)
{
Debug.Assert(SampleCount == 160 || SampleCount == 240);
Debug.Assert(SampleCount is 160 or 240);
float costPerSample = 3564.1f;
float baseCost = 9736.702f;
@@ -147,7 +147,7 @@ namespace Ryujinx.Audio.Renderer.Server
public uint Estimate(DepopForMixBuffersCommand command)
{
Debug.Assert(SampleCount == 160 || SampleCount == 240);
Debug.Assert(SampleCount is 160 or 240);
if (SampleCount == 160)
{
@@ -159,7 +159,7 @@ namespace Ryujinx.Audio.Renderer.Server
public uint Estimate(CopyMixBufferCommand command)
{
Debug.Assert(SampleCount == 160 || SampleCount == 240);
Debug.Assert(SampleCount is 160 or 240);
if (SampleCount == 160)
{
@@ -171,7 +171,7 @@ namespace Ryujinx.Audio.Renderer.Server
public uint Estimate(MixCommand command)
{
Debug.Assert(SampleCount == 160 || SampleCount == 240);
Debug.Assert(SampleCount is 160 or 240);
if (SampleCount == 160)
{
@@ -183,7 +183,7 @@ namespace Ryujinx.Audio.Renderer.Server
public virtual uint Estimate(DelayCommand command)
{
Debug.Assert(SampleCount == 160 || SampleCount == 240);
Debug.Assert(SampleCount is 160 or 240);
if (SampleCount == 160)
{
@@ -233,7 +233,7 @@ namespace Ryujinx.Audio.Renderer.Server
public virtual uint Estimate(ReverbCommand command)
{
Debug.Assert(SampleCount == 160 || SampleCount == 240);
Debug.Assert(SampleCount is 160 or 240);
if (SampleCount == 160)
{
@@ -283,7 +283,7 @@ namespace Ryujinx.Audio.Renderer.Server
public virtual uint Estimate(Reverb3dCommand command)
{
Debug.Assert(SampleCount == 160 || SampleCount == 240);
Debug.Assert(SampleCount is 160 or 240);
if (SampleCount == 160)
{
@@ -333,7 +333,7 @@ namespace Ryujinx.Audio.Renderer.Server
public uint Estimate(AuxiliaryBufferCommand command)
{
Debug.Assert(SampleCount == 160 || SampleCount == 240);
Debug.Assert(SampleCount is 160 or 240);
if (SampleCount == 160)
{
@@ -355,7 +355,7 @@ namespace Ryujinx.Audio.Renderer.Server
public uint Estimate(VolumeCommand command)
{
Debug.Assert(SampleCount == 160 || SampleCount == 240);
Debug.Assert(SampleCount is 160 or 240);
if (SampleCount == 160)
{
@@ -367,7 +367,7 @@ namespace Ryujinx.Audio.Renderer.Server
public uint Estimate(CircularBufferSinkCommand command)
{
Debug.Assert(SampleCount == 160 || SampleCount == 240);
Debug.Assert(SampleCount is 160 or 240);
float costPerBuffer = 770.26f;
float baseCost = 0f;
@@ -382,7 +382,7 @@ namespace Ryujinx.Audio.Renderer.Server
public uint Estimate(DownMixSurroundToStereoCommand command)
{
Debug.Assert(SampleCount == 160 || SampleCount == 240);
Debug.Assert(SampleCount is 160 or 240);
if (SampleCount == 160)
{
@@ -394,7 +394,7 @@ namespace Ryujinx.Audio.Renderer.Server
public uint Estimate(UpsampleCommand command)
{
Debug.Assert(SampleCount == 160 || SampleCount == 240);
Debug.Assert(SampleCount is 160 or 240);
if (SampleCount == 160)
{
@@ -406,8 +406,8 @@ namespace Ryujinx.Audio.Renderer.Server
public uint Estimate(DeviceSinkCommand command)
{
Debug.Assert(SampleCount == 160 || SampleCount == 240);
Debug.Assert(command.InputCount == 2 || command.InputCount == 6);
Debug.Assert(SampleCount is 160 or 240);
Debug.Assert(command.InputCount is 2 or 6);
if (command.InputCount == 2)
{
@@ -429,7 +429,7 @@ namespace Ryujinx.Audio.Renderer.Server
public uint Estimate(PcmFloatDataSourceCommandVersion1 command)
{
Debug.Assert(SampleCount == 160 || SampleCount == 240);
Debug.Assert(SampleCount is 160 or 240);
float costPerSample = 3490.9f;
float baseCost = 10090.9f;
@@ -445,7 +445,7 @@ namespace Ryujinx.Audio.Renderer.Server
public uint Estimate(DataSourceVersion2Command command)
{
Debug.Assert(SampleCount == 160 || SampleCount == 240);
Debug.Assert(SampleCount is 160 or 240);
(float baseCost, float costPerSample) = GetCostByFormat(SampleCount, command.SampleFormat, command.SrcQuality);
@@ -454,7 +454,7 @@ namespace Ryujinx.Audio.Renderer.Server
private static (float, float) GetCostByFormat(uint sampleCount, SampleFormat format, SampleRateConversionQuality quality)
{
Debug.Assert(sampleCount == 160 || sampleCount == 240);
Debug.Assert(sampleCount is 160 or 240);
switch (format)
{
@@ -540,7 +540,7 @@ namespace Ryujinx.Audio.Renderer.Server
private uint EstimateLimiterCommandCommon(LimiterParameter parameter, bool enabled)
{
Debug.Assert(SampleCount == 160 || SampleCount == 240);
Debug.Assert(SampleCount is 160 or 240);
if (SampleCount == 160)
{
@@ -590,14 +590,14 @@ namespace Ryujinx.Audio.Renderer.Server
public uint Estimate(LimiterCommandVersion1 command)
{
Debug.Assert(SampleCount == 160 || SampleCount == 240);
Debug.Assert(SampleCount is 160 or 240);
return EstimateLimiterCommandCommon(command.Parameter, command.IsEffectEnabled);
}
public uint Estimate(LimiterCommandVersion2 command)
{
Debug.Assert(SampleCount == 160 || SampleCount == 240);
Debug.Assert(SampleCount is 160 or 240);
if (!command.Parameter.StatisticsEnabled || !command.IsEffectEnabled)
{
@@ -12,7 +12,7 @@ namespace Ryujinx.Audio.Renderer.Server
public override uint Estimate(MultiTapBiquadFilterCommand command)
{
Debug.Assert(SampleCount == 160 || SampleCount == 240);
Debug.Assert(SampleCount is 160 or 240);
if (SampleCount == 160)
{
@@ -24,7 +24,7 @@ namespace Ryujinx.Audio.Renderer.Server
public override uint Estimate(CaptureBufferCommand command)
{
Debug.Assert(SampleCount == 160 || SampleCount == 240);
Debug.Assert(SampleCount is 160 or 240);
if (SampleCount == 160)
{
@@ -13,7 +13,7 @@ namespace Ryujinx.Audio.Renderer.Server
public override uint Estimate(DelayCommand command)
{
Debug.Assert(SampleCount == 160 || SampleCount == 240);
Debug.Assert(SampleCount is 160 or 240);
if (SampleCount == 160)
{
@@ -63,7 +63,7 @@ namespace Ryujinx.Audio.Renderer.Server
public override uint Estimate(ReverbCommand command)
{
Debug.Assert(SampleCount == 160 || SampleCount == 240);
Debug.Assert(SampleCount is 160 or 240);
if (SampleCount == 160)
{
@@ -113,7 +113,7 @@ namespace Ryujinx.Audio.Renderer.Server
public override uint Estimate(Reverb3dCommand command)
{
Debug.Assert(SampleCount == 160 || SampleCount == 240);
Debug.Assert(SampleCount is 160 or 240);
if (SampleCount == 160)
{
@@ -163,7 +163,7 @@ namespace Ryujinx.Audio.Renderer.Server
public override uint Estimate(CompressorCommand command)
{
Debug.Assert(SampleCount == 160 || SampleCount == 240);
Debug.Assert(SampleCount is 160 or 240);
if (SampleCount == 160)
{
@@ -241,7 +241,7 @@ namespace Ryujinx.Audio.Renderer.Server
public override uint Estimate(BiquadFilterAndMixCommand command)
{
Debug.Assert(SampleCount == 160 || SampleCount == 240);
Debug.Assert(SampleCount is 160 or 240);
if (command.HasVolumeRamp)
{
@@ -265,7 +265,7 @@ namespace Ryujinx.Audio.Renderer.Server
public override uint Estimate(MultiTapBiquadFilterAndMixCommand command)
{
Debug.Assert(SampleCount == 160 || SampleCount == 240);
Debug.Assert(SampleCount is 160 or 240);
if (command.HasVolumeRamp)
{