misc: Reformat Ryujinx.Audio with dotnet-format (#3485)

This is the first commit of a series of reformat around the codebase as
discussed internally some weeks ago.

This project being one that isn't touched that much, it shouldn't cause
conflict with any opened PRs.
This commit is contained in:
Mary-nyan
2022-07-25 20:46:33 +02:00
committed by GitHub
parent 62f8ceb60b
commit 1825bd87b4
200 changed files with 306 additions and 309 deletions
@@ -29,34 +29,34 @@ namespace Ryujinx.Audio.Renderer.Server
private object _lock = new object();
private AudioRendererExecutionMode _executionMode;
private IWritableEvent _systemEvent;
private ManualResetEvent _terminationEvent;
private MemoryPoolState _dspMemoryPoolState;
private VoiceContext _voiceContext;
private MixContext _mixContext;
private SinkContext _sinkContext;
private SplitterContext _splitterContext;
private EffectContext _effectContext;
private PerformanceManager _performanceManager;
private UpsamplerManager _upsamplerManager;
private bool _isActive;
private BehaviourContext _behaviourContext;
private ulong _totalElapsedTicksUpdating;
private ulong _totalElapsedTicks;
private int _sessionId;
private Memory<MemoryPoolState> _memoryPools;
private IWritableEvent _systemEvent;
private ManualResetEvent _terminationEvent;
private MemoryPoolState _dspMemoryPoolState;
private VoiceContext _voiceContext;
private MixContext _mixContext;
private SinkContext _sinkContext;
private SplitterContext _splitterContext;
private EffectContext _effectContext;
private PerformanceManager _performanceManager;
private UpsamplerManager _upsamplerManager;
private bool _isActive;
private BehaviourContext _behaviourContext;
private ulong _totalElapsedTicksUpdating;
private ulong _totalElapsedTicks;
private int _sessionId;
private Memory<MemoryPoolState> _memoryPools;
private uint _sampleRate;
private uint _sampleCount;
private uint _mixBufferCount;
private uint _voiceChannelCountMax;
private uint _upsamplerCount;
private uint _memoryPoolCount;
private uint _processHandle;
private uint _sampleRate;
private uint _sampleCount;
private uint _mixBufferCount;
private uint _voiceChannelCountMax;
private uint _upsamplerCount;
private uint _memoryPoolCount;
private uint _processHandle;
private ulong _appletResourceId;
private WritableRegion _workBufferRegion;
private MemoryHandle _workBufferMemoryPin;
private MemoryHandle _workBufferMemoryPin;
private Memory<float> _mixBuffer;
private Memory<float> _depopBuffer;
@@ -81,21 +81,21 @@ namespace Ryujinx.Audio.Renderer.Server
public AudioRenderSystem(AudioRendererManager manager, IWritableEvent systemEvent)
{
_manager = manager;
_terminationEvent = new ManualResetEvent(false);
_manager = manager;
_terminationEvent = new ManualResetEvent(false);
_dspMemoryPoolState = MemoryPoolState.Create(MemoryPoolState.LocationType.Dsp);
_voiceContext = new VoiceContext();
_mixContext = new MixContext();
_sinkContext = new SinkContext();
_splitterContext = new SplitterContext();
_effectContext = new EffectContext();
_voiceContext = new VoiceContext();
_mixContext = new MixContext();
_sinkContext = new SinkContext();
_splitterContext = new SplitterContext();
_effectContext = new EffectContext();
_commandProcessingTimeEstimator = null;
_systemEvent = systemEvent;
_behaviourContext = new BehaviourContext();
_totalElapsedTicksUpdating = 0;
_sessionId = 0;
_sessionId = 0;
}
public ResultCode Initialize(ref AudioRendererConfiguration parameter, uint processHandle, CpuAddress workBuffer, ulong workBufferSize, int sessionId, ulong appletResourceId, IVirtualMemoryManager memoryManager)
@@ -116,7 +116,7 @@ namespace Ryujinx.Audio.Renderer.Server
_behaviourContext.SetUserRevision(parameter.Revision);
_sampleRate = parameter.SampleRate;
_sampleRate = parameter.SampleRate;
_sampleCount = parameter.SampleCount;
_mixBufferCount = parameter.MixBufferCount;
_voiceChannelCountMax = Constants.VoiceChannelCountMax;
@@ -203,7 +203,7 @@ namespace Ryujinx.Audio.Renderer.Server
{
ref VoiceChannelResource voiceChannelResource = ref voiceChannelResources.Span[(int)id];
voiceChannelResource.Id = id;
voiceChannelResource.Id = id;
voiceChannelResource.IsUsed = false;
}
@@ -852,4 +852,4 @@ namespace Ryujinx.Audio.Renderer.Server
}
}
}
}
}
@@ -381,4 +381,4 @@ namespace Ryujinx.Audio.Renderer.Server
}
}
}
}
}
@@ -141,8 +141,8 @@ namespace Ryujinx.Audio.Renderer.Server
public BehaviourContext()
{
UserRevision = 0;
_errorInfos = new ErrorInfo[Constants.MaxErrorInfos];
_errorIndex = 0;
_errorInfos = new ErrorInfo[Constants.MaxErrorInfos];
_errorIndex = 0;
}
/// <summary>
@@ -448,4 +448,4 @@ namespace Ryujinx.Audio.Renderer.Server
_errorIndex = 0;
}
}
}
}
@@ -554,4 +554,4 @@ namespace Ryujinx.Audio.Renderer.Server
AddCommand(command);
}
}
}
}
@@ -1011,4 +1011,4 @@ namespace Ryujinx.Audio.Renderer.Server
}
}
}
}
}
@@ -180,4 +180,4 @@ namespace Ryujinx.Audio.Renderer.Server
return 0;
}
}
}
}
@@ -544,4 +544,4 @@ namespace Ryujinx.Audio.Renderer.Server
return 0;
}
}
}
}
@@ -748,4 +748,4 @@ namespace Ryujinx.Audio.Renderer.Server
return 0;
}
}
}
}
@@ -48,4 +48,4 @@ namespace Ryujinx.Audio.Renderer.Server
return (uint)435.2f;
}
}
}
}
@@ -233,4 +233,4 @@ namespace Ryujinx.Audio.Renderer.Server
}
}
}
}
}
@@ -82,4 +82,4 @@ namespace Ryujinx.Audio.Renderer.Server.Effect
UpdateUsageStateForCommandGeneration();
}
}
}
}
@@ -81,7 +81,7 @@ namespace Ryujinx.Audio.Renderer.Server.Effect
/// </summary>
/// <param name="parameter">The user parameter.</param>
/// <returns>Returns true if the <see cref="EffectType"/> sent by the user matches the internal <see cref="EffectType"/>.</returns>
public bool IsTypeValid<T>(ref T parameter) where T: unmanaged, IEffectInParameter
public bool IsTypeValid<T>(ref T parameter) where T : unmanaged, IEffectInParameter
{
return parameter.Type == TargetEffectType;
}
@@ -140,14 +140,14 @@ namespace Ryujinx.Audio.Renderer.Server.Effect
/// Initialize the given <paramref name="state"/> result state.
/// </summary>
/// <param name="state">The state to initalize</param>
public virtual void InitializeResultState(ref EffectResultState state) {}
public virtual void InitializeResultState(ref EffectResultState state) { }
/// <summary>
/// Update the <paramref name="destState"/> result state with <paramref name="srcState"/>.
/// </summary>
/// <param name="destState">The destination result state</param>
/// <param name="srcState">The source result state</param>
public virtual void UpdateResultState(ref EffectResultState destState, ref EffectResultState srcState) {}
public virtual void UpdateResultState(ref EffectResultState destState, ref EffectResultState srcState) { }
/// <summary>
/// Update the internal state from a user version 1 parameter.
@@ -215,7 +215,7 @@ namespace Ryujinx.Audio.Renderer.Server.Effect
/// </summary>
/// <param name="outStatus">The given user output.</param>
/// <param name="isAudioRendererActive">If set to true, the <see cref="AudioRenderSystem"/> is active.</param>
public void StoreStatus<T>(ref T outStatus, bool isAudioRendererActive) where T: unmanaged, IEffectOutStatus
public void StoreStatus<T>(ref T outStatus, bool isAudioRendererActive) where T : unmanaged, IEffectOutStatus
{
if (isAudioRendererActive)
{
@@ -267,4 +267,4 @@ namespace Ryujinx.Audio.Renderer.Server.Effect
}
}
}
}
}
@@ -64,4 +64,4 @@ namespace Ryujinx.Audio.Renderer.Server.Effect
Parameter.Status = UsageState.Enabled;
}
}
}
}
@@ -46,4 +46,4 @@ namespace Ryujinx.Audio.Renderer.Server.Effect
UpdateUsageStateForCommandGeneration();
}
}
}
}
@@ -79,4 +79,4 @@ namespace Ryujinx.Audio.Renderer.Server.Effect
UpdateUsageStateForCommandGeneration();
}
}
}
}
@@ -90,4 +90,4 @@ namespace Ryujinx.Audio.Renderer.Server.Effect
Parameter.Status = UsageState.Enabled;
}
}
}
}
@@ -120,4 +120,4 @@ namespace Ryujinx.Audio.Renderer.Server.Effect
}
}
}
}
}
@@ -92,4 +92,4 @@ namespace Ryujinx.Audio.Renderer.Server.Effect
destState = srcState;
}
}
}
}
@@ -46,7 +46,7 @@ namespace Ryujinx.Audio.Renderer.Server.Effect
Update(out updateErrorInfo, ref parameter, mapper);
}
public void Update<T>(out BehaviourParameter.ErrorInfo updateErrorInfo, ref T parameter, PoolMapper mapper) where T: unmanaged, IEffectInParameter
public void Update<T>(out BehaviourParameter.ErrorInfo updateErrorInfo, ref T parameter, PoolMapper mapper) where T : unmanaged, IEffectInParameter
{
Debug.Assert(IsTypeValid(ref parameter));
@@ -89,4 +89,4 @@ namespace Ryujinx.Audio.Renderer.Server.Effect
Parameter.ParameterStatus = UsageState.Enabled;
}
}
}
}
@@ -92,4 +92,4 @@ namespace Ryujinx.Audio.Renderer.Server.Effect
Parameter.Status = UsageState.Enabled;
}
}
}
}
@@ -25,4 +25,4 @@ namespace Ryujinx.Audio.Renderer.Server.Effect
/// </summary>
Disabled
}
}
}
@@ -36,4 +36,4 @@ namespace Ryujinx.Audio.Renderer.Server
uint Estimate(GroupedBiquadFilterCommand command);
uint Estimate(CaptureBufferCommand command);
}
}
}
@@ -1,8 +1,7 @@
using System;
using System.Runtime.InteropServices;
using DspAddress = System.UInt64;
using CpuAddress = System.UInt64;
using DspAddress = System.UInt64;
namespace Ryujinx.Audio.Renderer.Server.MemoryPool
{
@@ -53,9 +52,9 @@ namespace Ryujinx.Audio.Renderer.Server.MemoryPool
{
return new AddressInfo
{
CpuAddress = cpuAddress,
_memoryPools = MemoryPoolState.Null,
Size = size,
CpuAddress = cpuAddress,
_memoryPools = MemoryPoolState.Null,
Size = size,
ForceMappedDspAddress = 0
};
}
@@ -68,8 +67,8 @@ namespace Ryujinx.Audio.Renderer.Server.MemoryPool
/// <param name="size">The size of the region.</param>
public void Setup(CpuAddress cpuAddress, ulong size)
{
CpuAddress = cpuAddress;
Size = size;
CpuAddress = cpuAddress;
Size = size;
ForceMappedDspAddress = 0;
unsafe
@@ -131,4 +130,4 @@ namespace Ryujinx.Audio.Renderer.Server.MemoryPool
return MemoryPoolState.Translate(CpuAddress, Size);
}
}
}
}
@@ -1,8 +1,7 @@
using System;
using System.Runtime.InteropServices;
using DspAddress = System.UInt64;
using CpuAddress = System.UInt64;
using DspAddress = System.UInt64;
namespace Ryujinx.Audio.Renderer.Server.MemoryPool
{
@@ -69,8 +68,8 @@ namespace Ryujinx.Audio.Renderer.Server.MemoryPool
{
CpuAddress = 0,
DspAddress = 0,
Size = 0,
Location = location
Size = 0,
Location = location
};
}
@@ -82,7 +81,7 @@ namespace Ryujinx.Audio.Renderer.Server.MemoryPool
public void SetCpuAddress(CpuAddress cpuAddress, ulong size)
{
CpuAddress = cpuAddress;
Size = size;
Size = size;
}
/// <summary>
@@ -128,4 +127,4 @@ namespace Ryujinx.Audio.Renderer.Server.MemoryPool
return DspAddress != 0;
}
}
}
}
@@ -229,14 +229,14 @@ namespace Ryujinx.Audio.Renderer.Server.MemoryPool
if (AssignDspAddress(ref addressInfo))
{
errorInfo.ErrorCode = 0x0;
errorInfo.ErrorCode = 0x0;
errorInfo.ExtraErrorInfo = 0x0;
return true;
}
else
{
errorInfo.ErrorCode = ResultCode.InvalidAddressInfo;
errorInfo.ErrorCode = ResultCode.InvalidAddressInfo;
errorInfo.ExtraErrorInfo = addressInfo.CpuAddress;
return _isForceMapEnabled;
@@ -363,4 +363,4 @@ namespace Ryujinx.Audio.Renderer.Server.MemoryPool
}
}
}
}
}
@@ -256,4 +256,4 @@ namespace Ryujinx.Audio.Renderer.Server.Mix
}
}
}
}
}
@@ -310,4 +310,4 @@ namespace Ryujinx.Audio.Renderer.Server.Mix
return isDirty;
}
}
}
}
@@ -49,4 +49,4 @@ namespace Ryujinx.Audio.Renderer.Server.Performance
/// <param name="detailType">The type to use.</param>
void SetDetailType(PerformanceDetailType detailType);
}
}
}
@@ -43,4 +43,4 @@ namespace Ryujinx.Audio.Renderer.Server.Performance
/// <param name="type">The type to use.</param>
void SetEntryType(PerformanceEntryType type);
}
}
}
@@ -77,4 +77,4 @@ namespace Ryujinx.Audio.Renderer.Server.Performance
/// <param name="entryDetailCount">The total count of detailed entries in this frame.</param>
void SetEntryDetailCount(int entryDetailCount);
}
}
}
@@ -69,4 +69,4 @@ namespace Ryujinx.Audio.Renderer.Server.Performance
NodeId = nodeId;
}
}
}
}
@@ -69,4 +69,4 @@ namespace Ryujinx.Audio.Renderer.Server.Performance
NodeId = nodeId;
}
}
}
}
@@ -53,4 +53,4 @@ namespace Ryujinx.Audio.Renderer.Server.Performance
BaseMemory.Span[(int)ProcessingTimeOffset / 4] = (int)(endTimeNano / 1000) - BaseMemory.Span[(int)StartTimeOffset / 4];
}
}
}
}
@@ -59,4 +59,4 @@ namespace Ryujinx.Audio.Renderer.Server.Performance
NodeId = nodeId;
}
}
}
}
@@ -59,4 +59,4 @@ namespace Ryujinx.Audio.Renderer.Server.Performance
NodeId = nodeId;
}
}
}
}
@@ -98,4 +98,4 @@ namespace Ryujinx.Audio.Renderer.Server.Performance
VoiceDropCount = voiceCount;
}
}
}
}
@@ -114,4 +114,4 @@ namespace Ryujinx.Audio.Renderer.Server.Performance
VoiceDropCount = voiceCount;
}
}
}
}
@@ -103,4 +103,4 @@ namespace Ryujinx.Audio.Renderer.Server.Performance
}
}
}
}
}
@@ -13,7 +13,7 @@ namespace Ryujinx.Audio.Renderer.Server.Performance
/// <typeparam name="THeader">The header implementation of the performance frame.</typeparam>
/// <typeparam name="TEntry">The entry implementation of the performance frame.</typeparam>
/// <typeparam name="TEntryDetail">A detailed implementation of the performance frame.</typeparam>
public class PerformanceManagerGeneric<THeader, TEntry, TEntryDetail> : PerformanceManager where THeader: unmanaged, IPerformanceHeader where TEntry : unmanaged, IPerformanceEntry where TEntryDetail: unmanaged, IPerformanceDetailEntry
public class PerformanceManagerGeneric<THeader, TEntry, TEntryDetail> : PerformanceManager where THeader : unmanaged, IPerformanceHeader where TEntry : unmanaged, IPerformanceEntry where TEntryDetail : unmanaged, IPerformanceDetailEntry
{
/// <summary>
/// The magic used for the <see cref="THeader"/>.
@@ -301,4 +301,4 @@ namespace Ryujinx.Audio.Renderer.Server.Performance
}
}
}
}
}
@@ -45,4 +45,4 @@ namespace Ryujinx.Audio.Renderer.Server
/// </remarks>
public Memory<float> DepopBuffer;
}
}
}
@@ -99,4 +99,4 @@ namespace Ryujinx.Audio.Renderer.Server.Sink
errorInfo = new ErrorInfo();
}
}
}
}
@@ -106,4 +106,4 @@ namespace Ryujinx.Audio.Renderer.Server.Sink
base.CleanUp();
}
}
}
}
@@ -72,4 +72,4 @@ namespace Ryujinx.Audio.Renderer.Server.Sink
outStatus = new SinkOutStatus();
}
}
}
}
@@ -53,4 +53,4 @@ namespace Ryujinx.Audio.Renderer.Server.Sink
return ref _sinks[id];
}
}
}
}
@@ -300,4 +300,4 @@ namespace Ryujinx.Audio.Renderer.Server.Splitter
}
}
}
}
}
@@ -172,7 +172,7 @@ namespace Ryujinx.Audio.Renderer.Server.Splitter
{
unsafe
{
fixed (SplitterDestination *nextPtr = &next)
fixed (SplitterDestination* nextPtr = &next)
{
_next = nextPtr;
}
@@ -190,4 +190,4 @@ namespace Ryujinx.Audio.Renderer.Server.Splitter
}
}
}
}
}
@@ -218,4 +218,4 @@ namespace Ryujinx.Audio.Renderer.Server.Splitter
}
}
}
}
}
@@ -21,7 +21,7 @@ namespace Ryujinx.Audio.Renderer.Server
public class StateUpdater
{
private readonly ReadOnlyMemory<byte> _inputOrigin;
private ReadOnlyMemory <byte> _outputOrigin;
private ReadOnlyMemory<byte> _outputOrigin;
private ReadOnlyMemory<byte> _input;
private Memory<byte> _output;
@@ -207,7 +207,7 @@ namespace Ryujinx.Audio.Renderer.Server
return ResultCode.Success;
}
private static void ResetEffect<T>(ref BaseEffect effect, ref T parameter, PoolMapper mapper) where T: unmanaged, IEffectInParameter
private static void ResetEffect<T>(ref BaseEffect effect, ref T parameter, PoolMapper mapper) where T : unmanaged, IEffectInParameter
{
effect.ForceUnmapBuffers(mapper);
@@ -629,4 +629,4 @@ namespace Ryujinx.Audio.Renderer.Server
return ResultCode.Success;
}
}
}
}
@@ -21,4 +21,4 @@ namespace Ryujinx.Audio.Renderer.Server.Types
/// </remarks>
Cpu
}
}
}
@@ -36,4 +36,4 @@ namespace Ryujinx.Audio.Renderer.Server.Types
/// </remarks>
Paused
}
}
}
@@ -81,4 +81,4 @@ namespace Ryujinx.Audio.Renderer.Server.Upsampler
}
}
}
}
}
@@ -60,4 +60,4 @@ namespace Ryujinx.Audio.Renderer.Server.Upsampler
_manager.Free(_index);
}
}
}
}
@@ -37,4 +37,4 @@ namespace Ryujinx.Audio.Renderer.Server.Voice
Mix.ToSpan().CopyTo(PreviousMix.ToSpan());
}
}
}
}
@@ -146,4 +146,4 @@ namespace Ryujinx.Audio.Renderer.Server.Voice
sortedVoicesTemp.AsSpan().CopyTo(_sortedVoices.Span);
}
}
}
}
@@ -200,7 +200,7 @@ namespace Ryujinx.Audio.Renderer.Server.Voice
SampleFormat = SampleFormat.Invalid;
ChannelsCount = 0;
Pitch = 0.0f;
Volume= 0.0f;
Volume = 0.0f;
PreviousVolume = 0.0f;
BiquadFilters.ToSpan().Fill(new BiquadFilterParameter());
WaveBuffersCount = 0;
@@ -260,7 +260,7 @@ namespace Ryujinx.Audio.Renderer.Server.Voice
}
return DataSourceStateAddressInfo.CpuAddress != parameter.DataSourceStateAddress ||
DataSourceStateAddressInfo.Size != parameter.DataSourceStateSize ||
DataSourceStateAddressInfo.Size != parameter.DataSourceStateSize ||
DataSourceStateUnmapped;
}
@@ -696,4 +696,4 @@ namespace Ryujinx.Audio.Renderer.Server.Voice
return UpdateParametersForCommandGeneration(voiceUpdateStates);
}
}
}
}
@@ -101,4 +101,4 @@ namespace Ryujinx.Audio.Renderer.Server.Voice
return waveBuffer;
}
}
}
}