[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:
@@ -60,7 +60,7 @@ namespace Ryujinx.Audio.Renderer.Parameter
|
||||
/// <summary>
|
||||
/// Reserved/unused
|
||||
/// </summary>
|
||||
private byte _reserved;
|
||||
private readonly byte _reserved;
|
||||
|
||||
/// <summary>
|
||||
/// The target rendering device.
|
||||
@@ -96,4 +96,4 @@ namespace Ryujinx.Audio.Renderer.Parameter
|
||||
/// <seealso cref="Server.BehaviourContext"/>
|
||||
public int Revision;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,4 +27,4 @@ namespace Ryujinx.Audio.Renderer.Parameter
|
||||
/// </summary>
|
||||
private unsafe fixed uint _reserved[3];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace Ryujinx.Audio.Renderer.Parameter
|
||||
/// <summary>
|
||||
/// Reserved/padding.
|
||||
/// </summary>
|
||||
private byte _reserved;
|
||||
private readonly byte _reserved;
|
||||
|
||||
/// <summary>
|
||||
/// Biquad filter numerator (b0, b1, b2).
|
||||
@@ -31,4 +31,4 @@ namespace Ryujinx.Audio.Renderer.Parameter
|
||||
/// <remarks>a0 = 1</remarks>
|
||||
public Array2<short> Denominator;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,4 +81,4 @@ namespace Ryujinx.Audio.Renderer.Parameter.Effect
|
||||
/// <remarks>This is unused.</remarks>
|
||||
public uint MixBufferSampleCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,4 +41,4 @@ namespace Ryujinx.Audio.Renderer.Parameter.Effect
|
||||
/// </summary>
|
||||
public UsageState Status;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,4 +29,4 @@ namespace Ryujinx.Audio.Renderer.Parameter.Effect
|
||||
/// </summary>
|
||||
public uint MixesCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ namespace Ryujinx.Audio.Renderer.Parameter.Effect
|
||||
/// Check if the <see cref="ChannelCount"/> is valid.
|
||||
/// </summary>
|
||||
/// <returns>Returns true if the <see cref="ChannelCount"/> is valid.</returns>
|
||||
public bool IsChannelCountValid()
|
||||
public readonly bool IsChannelCountValid()
|
||||
{
|
||||
return EffectInParameterVersion1.IsChannelCountValid(ChannelCount);
|
||||
}
|
||||
@@ -107,7 +107,7 @@ namespace Ryujinx.Audio.Renderer.Parameter.Effect
|
||||
/// Check if the <see cref="ChannelCountMax"/> is valid.
|
||||
/// </summary>
|
||||
/// <returns>Returns true if the <see cref="ChannelCountMax"/> is valid.</returns>
|
||||
public bool IsChannelCountMaxValid()
|
||||
public readonly bool IsChannelCountMaxValid()
|
||||
{
|
||||
return EffectInParameterVersion1.IsChannelCountValid(ChannelCountMax);
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ namespace Ryujinx.Audio.Renderer.Parameter.Effect
|
||||
/// Check if the <see cref="ChannelCount"/> is valid.
|
||||
/// </summary>
|
||||
/// <returns>Returns true if the <see cref="ChannelCount"/> is valid.</returns>
|
||||
public bool IsChannelCountValid()
|
||||
public readonly bool IsChannelCountValid()
|
||||
{
|
||||
return EffectInParameterVersion1.IsChannelCountValid(ChannelCount);
|
||||
}
|
||||
@@ -93,9 +93,9 @@ namespace Ryujinx.Audio.Renderer.Parameter.Effect
|
||||
/// Check if the <see cref="ChannelCountMax"/> is valid.
|
||||
/// </summary>
|
||||
/// <returns>Returns true if the <see cref="ChannelCountMax"/> is valid.</returns>
|
||||
public bool IsChannelCountMaxValid()
|
||||
public readonly bool IsChannelCountMaxValid()
|
||||
{
|
||||
return EffectInParameterVersion1.IsChannelCountValid(ChannelCountMax);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,13 +115,13 @@ namespace Ryujinx.Audio.Renderer.Parameter.Effect
|
||||
/// <summary>
|
||||
/// Reserved/padding.
|
||||
/// </summary>
|
||||
private byte _reserved;
|
||||
private readonly byte _reserved;
|
||||
|
||||
/// <summary>
|
||||
/// Check if the <see cref="ChannelCount"/> is valid.
|
||||
/// </summary>
|
||||
/// <returns>Returns true if the <see cref="ChannelCount"/> is valid.</returns>
|
||||
public bool IsChannelCountValid()
|
||||
public readonly bool IsChannelCountValid()
|
||||
{
|
||||
return EffectInParameterVersion1.IsChannelCountValid(ChannelCount);
|
||||
}
|
||||
@@ -130,9 +130,9 @@ namespace Ryujinx.Audio.Renderer.Parameter.Effect
|
||||
/// Check if the <see cref="ChannelCountMax"/> is valid.
|
||||
/// </summary>
|
||||
/// <returns>Returns true if the <see cref="ChannelCountMax"/> is valid.</returns>
|
||||
public bool IsChannelCountMaxValid()
|
||||
public readonly bool IsChannelCountMaxValid()
|
||||
{
|
||||
return EffectInParameterVersion1.IsChannelCountValid(ChannelCountMax);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,8 +24,8 @@ namespace Ryujinx.Audio.Renderer.Parameter.Effect
|
||||
/// </summary>
|
||||
public void Reset()
|
||||
{
|
||||
InputMax.AsSpan().Fill(0.0f);
|
||||
InputMax.AsSpan().Clear();
|
||||
CompressionGainMin.AsSpan().Fill(1.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace Ryujinx.Audio.Renderer.Parameter.Effect
|
||||
/// <summary>
|
||||
/// Reserved/unused.
|
||||
/// </summary>
|
||||
private uint _reserved;
|
||||
private readonly uint _reserved;
|
||||
|
||||
/// <summary>
|
||||
/// The target sample rate.
|
||||
@@ -110,7 +110,7 @@ namespace Ryujinx.Audio.Renderer.Parameter.Effect
|
||||
/// Check if the <see cref="ChannelCount"/> is valid.
|
||||
/// </summary>
|
||||
/// <returns>Returns true if the <see cref="ChannelCount"/> is valid.</returns>
|
||||
public bool IsChannelCountValid()
|
||||
public readonly bool IsChannelCountValid()
|
||||
{
|
||||
return EffectInParameterVersion1.IsChannelCountValid(ChannelCount);
|
||||
}
|
||||
@@ -119,9 +119,9 @@ namespace Ryujinx.Audio.Renderer.Parameter.Effect
|
||||
/// Check if the <see cref="ChannelCountMax"/> is valid.
|
||||
/// </summary>
|
||||
/// <returns>Returns true if the <see cref="ChannelCountMax"/> is valid.</returns>
|
||||
public bool IsChannelCountMaxValid()
|
||||
public readonly bool IsChannelCountMaxValid()
|
||||
{
|
||||
return EffectInParameterVersion1.IsChannelCountValid(ChannelCountMax);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ namespace Ryujinx.Audio.Renderer.Parameter.Effect
|
||||
/// Check if the <see cref="ChannelCount"/> is valid.
|
||||
/// </summary>
|
||||
/// <returns>Returns true if the <see cref="ChannelCount"/> is valid.</returns>
|
||||
public bool IsChannelCountValid()
|
||||
public readonly bool IsChannelCountValid()
|
||||
{
|
||||
return EffectInParameterVersion1.IsChannelCountValid(ChannelCount);
|
||||
}
|
||||
@@ -111,9 +111,9 @@ namespace Ryujinx.Audio.Renderer.Parameter.Effect
|
||||
/// Check if the <see cref="ChannelCountMax"/> is valid.
|
||||
/// </summary>
|
||||
/// <returns>Returns true if the <see cref="ChannelCountMax"/> is valid.</returns>
|
||||
public bool IsChannelCountMaxValid()
|
||||
public readonly bool IsChannelCountMaxValid()
|
||||
{
|
||||
return EffectInParameterVersion1.IsChannelCountValid(ChannelCountMax);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace Ryujinx.Audio.Renderer.Parameter
|
||||
/// <summary>
|
||||
/// Reserved/padding.
|
||||
/// </summary>
|
||||
private byte _reserved1;
|
||||
private readonly byte _reserved1;
|
||||
|
||||
/// <summary>
|
||||
/// The target mix id of the effect.
|
||||
@@ -58,7 +58,7 @@ namespace Ryujinx.Audio.Renderer.Parameter
|
||||
/// <summary>
|
||||
/// Reserved/padding.
|
||||
/// </summary>
|
||||
private uint _reserved2;
|
||||
private readonly uint _reserved2;
|
||||
|
||||
/// <summary>
|
||||
/// Specific data storage.
|
||||
@@ -70,19 +70,19 @@ namespace Ryujinx.Audio.Renderer.Parameter
|
||||
|
||||
public Span<byte> SpecificData => SpanHelpers.AsSpan<SpecificDataStruct, byte>(ref _specificDataStart);
|
||||
|
||||
EffectType IEffectInParameter.Type => Type;
|
||||
readonly EffectType IEffectInParameter.Type => Type;
|
||||
|
||||
bool IEffectInParameter.IsNew => IsNew;
|
||||
readonly bool IEffectInParameter.IsNew => IsNew;
|
||||
|
||||
bool IEffectInParameter.IsEnabled => IsEnabled;
|
||||
readonly bool IEffectInParameter.IsEnabled => IsEnabled;
|
||||
|
||||
int IEffectInParameter.MixId => MixId;
|
||||
readonly int IEffectInParameter.MixId => MixId;
|
||||
|
||||
ulong IEffectInParameter.BufferBase => BufferBase;
|
||||
readonly ulong IEffectInParameter.BufferBase => BufferBase;
|
||||
|
||||
ulong IEffectInParameter.BufferSize => BufferSize;
|
||||
readonly ulong IEffectInParameter.BufferSize => BufferSize;
|
||||
|
||||
uint IEffectInParameter.ProcessingOrder => ProcessingOrder;
|
||||
readonly uint IEffectInParameter.ProcessingOrder => ProcessingOrder;
|
||||
|
||||
/// <summary>
|
||||
/// Check if the given channel count is valid.
|
||||
@@ -94,4 +94,4 @@ namespace Ryujinx.Audio.Renderer.Parameter
|
||||
return channelCount == 1 || channelCount == 2 || channelCount == 4 || channelCount == 6;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace Ryujinx.Audio.Renderer.Parameter
|
||||
/// <summary>
|
||||
/// Reserved/padding.
|
||||
/// </summary>
|
||||
private byte _reserved1;
|
||||
private readonly byte _reserved1;
|
||||
|
||||
/// <summary>
|
||||
/// The target mix id of the effect.
|
||||
@@ -58,7 +58,7 @@ namespace Ryujinx.Audio.Renderer.Parameter
|
||||
/// <summary>
|
||||
/// Reserved/padding.
|
||||
/// </summary>
|
||||
private uint _reserved2;
|
||||
private readonly uint _reserved2;
|
||||
|
||||
/// <summary>
|
||||
/// Specific data storage.
|
||||
@@ -70,19 +70,19 @@ namespace Ryujinx.Audio.Renderer.Parameter
|
||||
|
||||
public Span<byte> SpecificData => SpanHelpers.AsSpan<SpecificDataStruct, byte>(ref _specificDataStart);
|
||||
|
||||
EffectType IEffectInParameter.Type => Type;
|
||||
readonly EffectType IEffectInParameter.Type => Type;
|
||||
|
||||
bool IEffectInParameter.IsNew => IsNew;
|
||||
readonly bool IEffectInParameter.IsNew => IsNew;
|
||||
|
||||
bool IEffectInParameter.IsEnabled => IsEnabled;
|
||||
readonly bool IEffectInParameter.IsEnabled => IsEnabled;
|
||||
|
||||
int IEffectInParameter.MixId => MixId;
|
||||
readonly int IEffectInParameter.MixId => MixId;
|
||||
|
||||
ulong IEffectInParameter.BufferBase => BufferBase;
|
||||
readonly ulong IEffectInParameter.BufferBase => BufferBase;
|
||||
|
||||
ulong IEffectInParameter.BufferSize => BufferSize;
|
||||
readonly ulong IEffectInParameter.BufferSize => BufferSize;
|
||||
|
||||
uint IEffectInParameter.ProcessingOrder => ProcessingOrder;
|
||||
readonly uint IEffectInParameter.ProcessingOrder => ProcessingOrder;
|
||||
|
||||
/// <summary>
|
||||
/// Check if the given channel count is valid.
|
||||
@@ -94,4 +94,4 @@ namespace Ryujinx.Audio.Renderer.Parameter
|
||||
return channelCount == 1 || channelCount == 2 || channelCount == 4 || channelCount == 6;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,6 @@ namespace Ryujinx.Audio.Renderer.Parameter
|
||||
/// </summary>
|
||||
private unsafe fixed byte _reserved[15];
|
||||
|
||||
EffectState IEffectOutStatus.State { get => State; set => State = value; }
|
||||
EffectState IEffectOutStatus.State { readonly get => State; set => State = value; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,6 @@ namespace Ryujinx.Audio.Renderer.Parameter
|
||||
/// </summary>
|
||||
public EffectResultState ResultState;
|
||||
|
||||
EffectState IEffectOutStatus.State { get => State; set => State = value; }
|
||||
EffectState IEffectOutStatus.State { readonly get => State; set => State = value; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,4 +23,4 @@ namespace Ryujinx.Audio.Renderer.Parameter
|
||||
/// </summary>
|
||||
public Span<byte> SpecificData => SpanHelpers.AsSpan<SpecificDataStruct, byte>(ref _specificDataStart);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,6 @@ namespace Ryujinx.Audio.Renderer.Parameter
|
||||
/// <summary>
|
||||
/// The effect is disabled.
|
||||
/// </summary>
|
||||
Disabled = 4
|
||||
Disabled = 4,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,4 +50,4 @@ namespace Ryujinx.Audio.Renderer.Parameter
|
||||
/// </summary>
|
||||
Span<byte> SpecificData { get; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,4 +10,4 @@ namespace Ryujinx.Audio.Renderer.Parameter
|
||||
/// </summary>
|
||||
EffectState State { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,4 +30,4 @@ namespace Ryujinx.Audio.Renderer.Parameter
|
||||
/// </summary>
|
||||
private unsafe fixed uint _reserved[3];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,4 +19,4 @@ namespace Ryujinx.Audio.Renderer.Parameter
|
||||
/// </summary>
|
||||
private unsafe fixed uint _reserved[3];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,4 +24,4 @@ namespace Ryujinx.Audio.Renderer.Parameter
|
||||
/// </summary>
|
||||
private unsafe fixed byte _reserved[24];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace Ryujinx.Audio.Renderer.Parameter
|
||||
/// <summary>
|
||||
/// Reserved/padding.
|
||||
/// </summary>
|
||||
private ushort _reserved1;
|
||||
private readonly ushort _reserved1;
|
||||
|
||||
/// <summary>
|
||||
/// The id of the mix.
|
||||
@@ -61,7 +61,7 @@ namespace Ryujinx.Audio.Renderer.Parameter
|
||||
/// <summary>
|
||||
/// Reserved/padding.
|
||||
/// </summary>
|
||||
private ulong _reserved2;
|
||||
private readonly ulong _reserved2;
|
||||
|
||||
/// <summary>
|
||||
/// Mix buffer volumes storage.
|
||||
@@ -81,7 +81,7 @@ namespace Ryujinx.Audio.Renderer.Parameter
|
||||
/// <summary>
|
||||
/// Reserved/padding.
|
||||
/// </summary>
|
||||
private uint _reserved3;
|
||||
private readonly uint _reserved3;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Size = 4 * Constants.MixBufferCountMax * Constants.MixBufferCountMax, Pack = 1)]
|
||||
private struct MixVolumeArray { }
|
||||
@@ -92,4 +92,4 @@ namespace Ryujinx.Audio.Renderer.Parameter
|
||||
/// <remarks>Used when no splitter id is specified.</remarks>
|
||||
public Span<float> MixBufferVolume => SpanHelpers.AsSpan<MixVolumeArray, float>(ref _mixBufferVolumeArray);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,4 +18,4 @@ namespace Ryujinx.Audio.Renderer.Parameter.Performance
|
||||
/// </summary>
|
||||
private unsafe fixed uint _reserved[3];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,4 +18,4 @@ namespace Ryujinx.Audio.Renderer.Parameter.Performance
|
||||
/// </summary>
|
||||
private unsafe fixed uint _reserved[3];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,6 @@ namespace Ryujinx.Audio.Renderer.Parameter
|
||||
/// <summary>
|
||||
/// Reserved/Unused.
|
||||
/// </summary>
|
||||
private ulong _reserved;
|
||||
private readonly ulong _reserved;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ using Ryujinx.Audio.Common;
|
||||
using Ryujinx.Audio.Renderer.Common;
|
||||
using Ryujinx.Common.Memory;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
using CpuAddress = System.UInt64;
|
||||
|
||||
namespace Ryujinx.Audio.Renderer.Parameter.Sink
|
||||
@@ -41,7 +40,7 @@ namespace Ryujinx.Audio.Renderer.Parameter.Sink
|
||||
/// <summary>
|
||||
/// The target <see cref="SampleFormat"/>.
|
||||
/// </summary>
|
||||
/// <remarks>Only <see cref="SampleFormat.PcmInt16"/> is supported.</remarks>
|
||||
/// <remarks>Only <see cref="Audio.Common.SampleFormat.PcmInt16"/> is supported.</remarks>
|
||||
public SampleFormat SampleFormat;
|
||||
|
||||
/// <summary>
|
||||
@@ -57,6 +56,6 @@ namespace Ryujinx.Audio.Renderer.Parameter.Sink
|
||||
/// <summary>
|
||||
/// Reserved/padding.
|
||||
/// </summary>
|
||||
private ushort _reserved2;
|
||||
private readonly ushort _reserved2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace Ryujinx.Audio.Renderer.Parameter.Sink
|
||||
/// <summary>
|
||||
/// Reserved/padding.
|
||||
/// </summary>
|
||||
private byte _padding;
|
||||
private readonly byte _padding;
|
||||
|
||||
/// <summary>
|
||||
/// The total count of channels to output to the device.
|
||||
@@ -34,7 +34,7 @@ namespace Ryujinx.Audio.Renderer.Parameter.Sink
|
||||
/// <summary>
|
||||
/// Reserved/padding.
|
||||
/// </summary>
|
||||
private byte _reserved;
|
||||
private readonly byte _reserved;
|
||||
|
||||
/// <summary>
|
||||
/// Set to true if the user controls Surround to Stereo downmixing coefficients.
|
||||
@@ -55,4 +55,4 @@ namespace Ryujinx.Audio.Renderer.Parameter.Sink
|
||||
/// </summary>
|
||||
public Span<byte> DeviceName => SpanHelpers.AsSpan<DeviceNameStruct, byte>(ref _deviceName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace Ryujinx.Audio.Renderer.Parameter
|
||||
/// <summary>
|
||||
/// Reserved/padding.
|
||||
/// </summary>
|
||||
private ushort _reserved1;
|
||||
private readonly ushort _reserved1;
|
||||
|
||||
/// <summary>
|
||||
/// The node id of the sink.
|
||||
@@ -50,4 +50,4 @@ namespace Ryujinx.Audio.Renderer.Parameter
|
||||
/// </summary>
|
||||
public Span<byte> SpecificData => SpanHelpers.AsSpan<SpecificDataStruct, byte>(ref _specificDataStart);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,11 +16,11 @@ namespace Ryujinx.Audio.Renderer.Parameter
|
||||
/// <summary>
|
||||
/// Reserved/padding.
|
||||
/// </summary>
|
||||
private uint _padding;
|
||||
private readonly uint _padding;
|
||||
|
||||
/// <summary>
|
||||
/// Reserved/padding.
|
||||
/// </summary>
|
||||
private unsafe fixed ulong _reserved[3];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,9 +59,9 @@ namespace Ryujinx.Audio.Renderer.Parameter
|
||||
/// Check if the magic is valid.
|
||||
/// </summary>
|
||||
/// <returns>Returns true if the magic is valid.</returns>
|
||||
public bool IsMagicValid()
|
||||
public readonly bool IsMagicValid()
|
||||
{
|
||||
return Magic == ValidMagic;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,9 +38,9 @@ namespace Ryujinx.Audio.Renderer.Parameter
|
||||
/// Check if the magic is valid.
|
||||
/// </summary>
|
||||
/// <returns>Returns true if the magic is valid.</returns>
|
||||
public bool IsMagicValid()
|
||||
public readonly bool IsMagicValid()
|
||||
{
|
||||
return Magic == ValidMagic;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,9 +37,9 @@ namespace Ryujinx.Audio.Renderer.Parameter
|
||||
/// Check if the magic is valid.
|
||||
/// </summary>
|
||||
/// <returns>Returns true if the magic is valid.</returns>
|
||||
public bool IsMagicValid()
|
||||
public readonly bool IsMagicValid()
|
||||
{
|
||||
return Magic == ValidMagic;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,4 +25,4 @@ namespace Ryujinx.Audio.Renderer.Parameter
|
||||
[MarshalAs(UnmanagedType.I1)]
|
||||
public bool IsUsed;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ namespace Ryujinx.Audio.Renderer.Parameter
|
||||
/// <summary>
|
||||
/// Reserved/unused.
|
||||
/// </summary>
|
||||
private uint _reserved1;
|
||||
private readonly uint _reserved1;
|
||||
|
||||
/// <summary>
|
||||
/// User state address required by the data source.
|
||||
@@ -143,7 +143,7 @@ namespace Ryujinx.Audio.Renderer.Parameter
|
||||
/// <summary>
|
||||
/// Reserved/unused.
|
||||
/// </summary>
|
||||
private ushort _reserved2;
|
||||
private readonly ushort _reserved2;
|
||||
|
||||
/// <summary>
|
||||
/// Change the behaviour of the voice.
|
||||
@@ -222,7 +222,7 @@ namespace Ryujinx.Audio.Renderer.Parameter
|
||||
/// <summary>
|
||||
/// Reserved/unused.
|
||||
/// </summary>
|
||||
private byte _reserved;
|
||||
private readonly byte _reserved;
|
||||
|
||||
/// <summary>
|
||||
/// If set to anything other than 0, specifies how many times to loop the wavebuffer.
|
||||
@@ -260,7 +260,7 @@ namespace Ryujinx.Audio.Renderer.Parameter
|
||||
/// <typeparam name="T">The PCM sample type</typeparam>
|
||||
/// <returns>Returns true if the sample offset are in range of the size.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private bool IsSampleOffsetInRangeForPcm<T>() where T : unmanaged
|
||||
private readonly bool IsSampleOffsetInRangeForPcm<T>() where T : unmanaged
|
||||
{
|
||||
uint dataTypeSize = (uint)Unsafe.SizeOf<T>();
|
||||
|
||||
@@ -273,27 +273,15 @@ namespace Ryujinx.Audio.Renderer.Parameter
|
||||
/// </summary>
|
||||
/// <param name="format">The target <see cref="SampleFormat"/></param>
|
||||
/// <returns>Returns true if the sample offset are in range of the size.</returns>
|
||||
public bool IsSampleOffsetValid(SampleFormat format)
|
||||
public readonly bool IsSampleOffsetValid(SampleFormat format)
|
||||
{
|
||||
bool result;
|
||||
|
||||
switch (format)
|
||||
return format switch
|
||||
{
|
||||
case SampleFormat.PcmInt16:
|
||||
result = IsSampleOffsetInRangeForPcm<ushort>();
|
||||
break;
|
||||
case SampleFormat.PcmFloat:
|
||||
result = IsSampleOffsetInRangeForPcm<float>();
|
||||
break;
|
||||
case SampleFormat.Adpcm:
|
||||
result = AdpcmHelper.GetAdpcmDataSize((int)StartSampleOffset) <= Size &&
|
||||
AdpcmHelper.GetAdpcmDataSize((int)EndSampleOffset) <= Size;
|
||||
break;
|
||||
default:
|
||||
throw new NotImplementedException($"{format} not implemented!");
|
||||
}
|
||||
|
||||
return result;
|
||||
SampleFormat.PcmInt16 => IsSampleOffsetInRangeForPcm<ushort>(),
|
||||
SampleFormat.PcmFloat => IsSampleOffsetInRangeForPcm<float>(),
|
||||
SampleFormat.Adpcm => AdpcmHelper.GetAdpcmDataSize((int)StartSampleOffset) <= Size && AdpcmHelper.GetAdpcmDataSize((int)EndSampleOffset) <= Size,
|
||||
_ => throw new NotImplementedException($"{format} not implemented!"),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -316,7 +304,7 @@ namespace Ryujinx.Audio.Renderer.Parameter
|
||||
/// <summary>
|
||||
/// Skip pitch and Sample Rate Conversion (SRC).
|
||||
/// </summary>
|
||||
SkipPitchAndSampleRateConversion = 2
|
||||
SkipPitchAndSampleRateConversion = 2,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -338,7 +326,7 @@ namespace Ryujinx.Audio.Renderer.Parameter
|
||||
/// <summary>
|
||||
/// Resample interpolating 1 samples per output sample.
|
||||
/// </summary>
|
||||
Low
|
||||
Low,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,4 +32,4 @@ namespace Ryujinx.Audio.Renderer.Parameter
|
||||
/// </summary>
|
||||
private unsafe fixed byte _reserved[3];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user