Fix ~3500 analyser issues

See merge request ryubing/ryujinx!44
This commit is contained in:
MrKev 2025-05-30 17:08:34 -05:00 committed by LotP
parent 417df486b1
commit 361d0c5632
622 changed files with 3080 additions and 2652 deletions

View file

@ -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;
}

View file

@ -467,7 +467,6 @@ namespace Ryujinx.Audio.Renderer.Server
}
}
/// <summary>
/// Generate a new <see cref="DelayCommand"/>.
/// </summary>

View file

@ -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;

View file

@ -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)
{
@ -546,7 +546,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)
{
@ -596,14 +596,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)
{

View file

@ -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)
{

View file

@ -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)
{

View file

@ -257,7 +257,7 @@ namespace Ryujinx.Audio.Renderer.Server.MemoryPool
const uint PageSize = 0x1000;
if (inputState != MemoryPoolUserState.RequestAttach && inputState != MemoryPoolUserState.RequestDetach)
if (inputState is not MemoryPoolUserState.RequestAttach and not MemoryPoolUserState.RequestDetach)
{
return UpdateResult.Success;
}

View file

@ -153,7 +153,7 @@ namespace Ryujinx.Audio.Renderer.Server.Splitter
/// <returns>The volume for the given destination.</returns>
public float GetMixVolume(int destinationIndex)
{
Debug.Assert(destinationIndex >= 0 && destinationIndex < Constants.MixBufferCountMax);
Debug.Assert(destinationIndex is >= 0 and < Constants.MixBufferCountMax);
return MixBufferVolume[destinationIndex];
}
@ -165,7 +165,7 @@ namespace Ryujinx.Audio.Renderer.Server.Splitter
/// <returns>The volume for the given destination.</returns>
public float GetMixVolumePrev(int destinationIndex)
{
Debug.Assert(destinationIndex >= 0 && destinationIndex < Constants.MixBufferCountMax);
Debug.Assert(destinationIndex is >= 0 and < Constants.MixBufferCountMax);
return PreviousMixBufferVolume[destinationIndex];
}

View file

@ -160,7 +160,7 @@ namespace Ryujinx.Audio.Renderer.Server.Splitter
/// <returns>The volume for the given destination.</returns>
public float GetMixVolume(int destinationIndex)
{
Debug.Assert(destinationIndex >= 0 && destinationIndex < Constants.MixBufferCountMax);
Debug.Assert(destinationIndex is >= 0 and < Constants.MixBufferCountMax);
return MixBufferVolume[destinationIndex];
}
@ -172,7 +172,7 @@ namespace Ryujinx.Audio.Renderer.Server.Splitter
/// <returns>The volume for the given destination.</returns>
public float GetMixVolumePrev(int destinationIndex)
{
Debug.Assert(destinationIndex >= 0 && destinationIndex < Constants.MixBufferCountMax);
Debug.Assert(destinationIndex is >= 0 and < Constants.MixBufferCountMax);
return PreviousMixBufferVolume[destinationIndex];
}

View file

@ -86,9 +86,9 @@ namespace Ryujinx.Audio.Renderer.Server
PoolMapper.UpdateResult updateResult = mapper.Update(ref memoryPool, in parameter, ref outStatus);
if (updateResult != PoolMapper.UpdateResult.Success &&
updateResult != PoolMapper.UpdateResult.MapError &&
updateResult != PoolMapper.UpdateResult.UnmapError)
if (updateResult is not PoolMapper.UpdateResult.Success and
not PoolMapper.UpdateResult.MapError and
not PoolMapper.UpdateResult.UnmapError)
{
if (updateResult != PoolMapper.UpdateResult.InvalidParameter)
{

View file

@ -20,7 +20,6 @@ namespace Ryujinx.Audio.Renderer.Server.Voice
/// <remarks>Only used by <see cref="Common.SampleFormat.Adpcm"/>.</remarks>
public AddressInfo ContextAddressInfo;
/// <summary>
/// First sample to play of the wavebuffer.
/// </summary>