aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Audio/Renderer/Server/CommandProcessingTimeEstimatorVersion2.cs
diff options
context:
space:
mode:
authorTSRBerry <20988865+TSRBerry@users.noreply.github.com>2023-07-02 01:27:18 +0200
committerGitHub <noreply@github.com>2023-07-02 01:27:18 +0200
commit515fc32b21f59298ec8ca45f5d3c36e9d3041084 (patch)
treeac3683b0bc6b6be56e6e4bdf7e37cea0e64a3fd0 /src/Ryujinx.Audio/Renderer/Server/CommandProcessingTimeEstimatorVersion2.cs
parent0684b00b3c4d000cf627b9c08a49d7469ae50d04 (diff)
[Ryujinx.Audio] Address dotnet-format issues (#5362)1.1.949
* 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>
Diffstat (limited to 'src/Ryujinx.Audio/Renderer/Server/CommandProcessingTimeEstimatorVersion2.cs')
-rw-r--r--src/Ryujinx.Audio/Renderer/Server/CommandProcessingTimeEstimatorVersion2.cs256
1 files changed, 92 insertions, 164 deletions
diff --git a/src/Ryujinx.Audio/Renderer/Server/CommandProcessingTimeEstimatorVersion2.cs b/src/Ryujinx.Audio/Renderer/Server/CommandProcessingTimeEstimatorVersion2.cs
index d4f28a07..929aaf38 100644
--- a/src/Ryujinx.Audio/Renderer/Server/CommandProcessingTimeEstimatorVersion2.cs
+++ b/src/Ryujinx.Audio/Renderer/Server/CommandProcessingTimeEstimatorVersion2.cs
@@ -9,8 +9,8 @@ namespace Ryujinx.Audio.Renderer.Server
/// </summary>
public class CommandProcessingTimeEstimatorVersion2 : ICommandProcessingTimeEstimator
{
- private uint _sampleCount;
- private uint _bufferCount;
+ private readonly uint _sampleCount;
+ private readonly uint _bufferCount;
public CommandProcessingTimeEstimatorVersion2(uint sampleCount, uint bufferCount)
{
@@ -189,71 +189,47 @@ namespace Ryujinx.Audio.Renderer.Server
{
if (command.Enabled)
{
- switch (command.Parameter.ChannelCount)
+ return command.Parameter.ChannelCount switch
{
- case 1:
- return (uint)41636.0f;
- case 2:
- return (uint)97861.0f;
- case 4:
- return (uint)192520.0f;
- case 6:
- return (uint)301760.0f;
- default:
- throw new NotImplementedException($"{command.Parameter.ChannelCount}");
- }
+ 1 => (uint)41636.0f,
+ 2 => (uint)97861.0f,
+ 4 => (uint)192520.0f,
+ 6 => (uint)301760.0f,
+ _ => throw new NotImplementedException($"{command.Parameter.ChannelCount}"),
+ };
}
- else
+
+ return command.Parameter.ChannelCount switch
{
- switch (command.Parameter.ChannelCount)
- {
- case 1:
- return (uint)578.53f;
- case 2:
- return (uint)663.06f;
- case 4:
- return (uint)703.98f;
- case 6:
- return (uint)760.03f;
- default:
- throw new NotImplementedException($"{command.Parameter.ChannelCount}");
- }
- }
+ 1 => (uint)578.53f,
+ 2 => (uint)663.06f,
+ 4 => (uint)703.98f,
+ 6 => (uint)760.03f,
+ _ => throw new NotImplementedException($"{command.Parameter.ChannelCount}"),
+ };
}
if (command.Enabled)
{
- switch (command.Parameter.ChannelCount)
+ return command.Parameter.ChannelCount switch
{
- case 1:
- return (uint)8770.3f;
- case 2:
- return (uint)25741.0f;
- case 4:
- return (uint)47551.0f;
- case 6:
- return (uint)81629.0f;
- default:
- throw new NotImplementedException($"{command.Parameter.ChannelCount}");
- }
+ 1 => (uint)8770.3f,
+ 2 => (uint)25741.0f,
+ 4 => (uint)47551.0f,
+ 6 => (uint)81629.0f,
+ _ => throw new NotImplementedException($"{command.Parameter.ChannelCount}"),
+ };
}
- else
+
+ return command.Parameter.ChannelCount switch
{
- switch (command.Parameter.ChannelCount)
- {
- case 1:
- return (uint)521.28f;
- case 2:
- return (uint)585.4f;
- case 4:
- return (uint)629.88f;
- case 6:
- return (uint)713.57f;
- default:
- throw new NotImplementedException($"{command.Parameter.ChannelCount}");
- }
- }
+ 1 => (uint)521.28f,
+ 2 => (uint)585.4f,
+ 4 => (uint)629.88f,
+ 6 => (uint)713.57f,
+ _ => throw new NotImplementedException($"{command.Parameter.ChannelCount}"),
+ };
}
public uint Estimate(ReverbCommand command)
@@ -264,71 +240,47 @@ namespace Ryujinx.Audio.Renderer.Server
{
if (command.Enabled)
{
- switch (command.Parameter.ChannelCount)
+ return command.Parameter.ChannelCount switch
{
- case 1:
- return (uint)97192.0f;
- case 2:
- return (uint)103280.0f;
- case 4:
- return (uint)109580.0f;
- case 6:
- return (uint)115070.0f;
- default:
- throw new NotImplementedException($"{command.Parameter.ChannelCount}");
- }
+ 1 => (uint)97192.0f,
+ 2 => (uint)103280.0f,
+ 4 => (uint)109580.0f,
+ 6 => (uint)115070.0f,
+ _ => throw new NotImplementedException($"{command.Parameter.ChannelCount}"),
+ };
}
- else
+
+ return command.Parameter.ChannelCount switch
{
- switch (command.Parameter.ChannelCount)
- {
- case 1:
- return (uint)492.01f;
- case 2:
- return (uint)554.46f;
- case 4:
- return (uint)595.86f;
- case 6:
- return (uint)656.62f;
- default:
- throw new NotImplementedException($"{command.Parameter.ChannelCount}");
- }
- }
+ 1 => (uint)492.01f,
+ 2 => (uint)554.46f,
+ 4 => (uint)595.86f,
+ 6 => (uint)656.62f,
+ _ => throw new NotImplementedException($"{command.Parameter.ChannelCount}"),
+ };
}
if (command.Enabled)
{
- switch (command.Parameter.ChannelCount)
+ return command.Parameter.ChannelCount switch
{
- case 1:
- return (uint)136460.0f;
- case 2:
- return (uint)145750.0f;
- case 4:
- return (uint)154800.0f;
- case 6:
- return (uint)161970.0f;
- default:
- throw new NotImplementedException($"{command.Parameter.ChannelCount}");
- }
+ 1 => (uint)136460.0f,
+ 2 => (uint)145750.0f,
+ 4 => (uint)154800.0f,
+ 6 => (uint)161970.0f,
+ _ => throw new NotImplementedException($"{command.Parameter.ChannelCount}"),
+ };
}
- else
+
+ return command.Parameter.ChannelCount switch
{
- switch (command.Parameter.ChannelCount)
- {
- case 1:
- return (uint)495.79f;
- case 2:
- return (uint)527.16f;
- case 4:
- return (uint)598.75f;
- case 6:
- return (uint)666.03f;
- default:
- throw new NotImplementedException($"{command.Parameter.ChannelCount}");
- }
- }
+ 1 => (uint)495.79f,
+ 2 => (uint)527.16f,
+ 4 => (uint)598.75f,
+ 6 => (uint)666.03f,
+ _ => throw new NotImplementedException($"{command.Parameter.ChannelCount}"),
+ };
}
public uint Estimate(Reverb3dCommand command)
@@ -339,70 +291,46 @@ namespace Ryujinx.Audio.Renderer.Server
{
if (command.Enabled)
{
- switch (command.Parameter.ChannelCount)
+ return command.Parameter.ChannelCount switch
{
- case 1:
- return (uint)138840.0f;
- case 2:
- return (uint)135430.0f;
- case 4:
- return (uint)199180.0f;
- case 6:
- return (uint)247350.0f;
- default:
- throw new NotImplementedException($"{command.Parameter.ChannelCount}");
- }
+ 1 => (uint)138840.0f,
+ 2 => (uint)135430.0f,
+ 4 => (uint)199180.0f,
+ 6 => (uint)247350.0f,
+ _ => throw new NotImplementedException($"{command.Parameter.ChannelCount}"),
+ };
}
- else
+
+ return command.Parameter.ChannelCount switch
{
- switch (command.Parameter.ChannelCount)
- {
- case 1:
- return (uint)718.7f;
- case 2:
- return (uint)751.3f;
- case 4:
- return (uint)797.46f;
- case 6:
- return (uint)867.43f;
- default:
- throw new NotImplementedException($"{command.Parameter.ChannelCount}");
- }
- }
+ 1 => (uint)718.7f,
+ 2 => (uint)751.3f,
+ 4 => (uint)797.46f,
+ 6 => (uint)867.43f,
+ _ => throw new NotImplementedException($"{command.Parameter.ChannelCount}"),
+ };
}
if (command.Enabled)
{
- switch (command.Parameter.ChannelCount)
+ return command.Parameter.ChannelCount switch
{
- case 1:
- return (uint)199950.0f;
- case 2:
- return (uint)195200.0f;
- case 4:
- return (uint)290580.0f;
- case 6:
- return (uint)363490.0f;
- default:
- throw new NotImplementedException($"{command.Parameter.ChannelCount}");
- }
+ 1 => (uint)199950.0f,
+ 2 => (uint)195200.0f,
+ 4 => (uint)290580.0f,
+ 6 => (uint)363490.0f,
+ _ => throw new NotImplementedException($"{command.Parameter.ChannelCount}"),
+ };
}
- else
+
+ return command.Parameter.ChannelCount switch
{
- switch (command.Parameter.ChannelCount)
- {
- case 1:
- return (uint)534.24f;
- case 2:
- return (uint)570.87f;
- case 4:
- return (uint)660.93f;
- case 6:
- return (uint)694.6f;
- default:
- throw new NotImplementedException($"{command.Parameter.ChannelCount}");
- }
- }
+ 1 => (uint)534.24f,
+ 2 => (uint)570.87f,
+ 4 => (uint)660.93f,
+ 6 => (uint)694.6f,
+ _ => throw new NotImplementedException($"{command.Parameter.ChannelCount}"),
+ };
}
public uint Estimate(AuxiliaryBufferCommand command)