aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Audio/Renderer
diff options
context:
space:
mode:
Diffstat (limited to 'src/Ryujinx.Audio/Renderer')
-rw-r--r--src/Ryujinx.Audio/Renderer/Dsp/Command/CircularBufferSinkCommand.cs8
-rw-r--r--src/Ryujinx.Audio/Renderer/Dsp/Command/DelayCommand.cs18
-rw-r--r--src/Ryujinx.Audio/Renderer/Dsp/Command/DeviceSinkCommand.cs10
-rw-r--r--src/Ryujinx.Audio/Renderer/Dsp/Command/Reverb3dCommand.cs8
-rw-r--r--src/Ryujinx.Audio/Renderer/Dsp/DataSourceHelper.cs10
-rw-r--r--src/Ryujinx.Audio/Renderer/Dsp/UpsamplerHelper.cs16
-rw-r--r--src/Ryujinx.Audio/Renderer/Server/CommandProcessingTimeEstimatorVersion2.cs6
-rw-r--r--src/Ryujinx.Audio/Renderer/Server/MemoryPool/PoolMapper.cs8
8 files changed, 42 insertions, 42 deletions
diff --git a/src/Ryujinx.Audio/Renderer/Dsp/Command/CircularBufferSinkCommand.cs b/src/Ryujinx.Audio/Renderer/Dsp/Command/CircularBufferSinkCommand.cs
index e50637eb..59ef7093 100644
--- a/src/Ryujinx.Audio/Renderer/Dsp/Command/CircularBufferSinkCommand.cs
+++ b/src/Ryujinx.Audio/Renderer/Dsp/Command/CircularBufferSinkCommand.cs
@@ -43,7 +43,7 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
public void Process(CommandList context)
{
- const int targetChannelCount = 2;
+ const int TargetChannelCount = 2;
ulong currentOffset = CurrentOffset;
@@ -59,10 +59,10 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
for (int y = 0; y < context.SampleCount; y++)
{
- context.MemoryManager.Write(targetOffset + (ulong)y * targetChannelCount, PcmHelper.Saturate(inputBuffer[y]));
+ context.MemoryManager.Write(targetOffset + (ulong)y * TargetChannelCount, PcmHelper.Saturate(inputBuffer[y]));
}
- currentOffset += context.SampleCount * targetChannelCount;
+ currentOffset += context.SampleCount * TargetChannelCount;
if (currentOffset >= CircularBufferSize)
{
@@ -73,4 +73,4 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
}
}
}
-} \ No newline at end of file
+}
diff --git a/src/Ryujinx.Audio/Renderer/Dsp/Command/DelayCommand.cs b/src/Ryujinx.Audio/Renderer/Dsp/Command/DelayCommand.cs
index 6dc76659..e7e17938 100644
--- a/src/Ryujinx.Audio/Renderer/Dsp/Command/DelayCommand.cs
+++ b/src/Ryujinx.Audio/Renderer/Dsp/Command/DelayCommand.cs
@@ -56,7 +56,7 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
private unsafe void ProcessDelayMono(ref DelayState state, float* outputBuffer, float* inputBuffer, uint sampleCount)
{
- const ushort channelCount = 1;
+ const ushort ChannelCount = 1;
float feedbackGain = FixedPointHelper.ToFloat(Parameter.FeedbackGain, FixedPointPrecision);
float inGain = FixedPointHelper.ToFloat(Parameter.InGain, FixedPointPrecision);
@@ -70,7 +70,7 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
float temp = input * inGain + delayLineValue * feedbackGain;
- state.UpdateLowPassFilter(ref temp, channelCount);
+ state.UpdateLowPassFilter(ref temp, ChannelCount);
outputBuffer[i] = (input * dryGain + delayLineValue * outGain) / 64;
}
@@ -79,7 +79,7 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
private unsafe void ProcessDelayStereo(ref DelayState state, Span<IntPtr> outputBuffers, ReadOnlySpan<IntPtr> inputBuffers, uint sampleCount)
{
- const ushort channelCount = 2;
+ const ushort ChannelCount = 2;
float delayFeedbackBaseGain = state.DelayFeedbackBaseGain;
float delayFeedbackCrossGain = state.DelayFeedbackCrossGain;
@@ -106,7 +106,7 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
Vector2 temp = MatrixHelper.Transform(ref delayLineValues, ref delayFeedback) + channelInput * inGain;
- state.UpdateLowPassFilter(ref Unsafe.As<Vector2, float>(ref temp), channelCount);
+ state.UpdateLowPassFilter(ref Unsafe.As<Vector2, float>(ref temp), ChannelCount);
*((float*)outputBuffers[0] + i) = (channelInput.X * dryGain + delayLineValues.X * outGain) / 64;
*((float*)outputBuffers[1] + i) = (channelInput.Y * dryGain + delayLineValues.Y * outGain) / 64;
@@ -116,7 +116,7 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
private unsafe void ProcessDelayQuadraphonic(ref DelayState state, Span<IntPtr> outputBuffers, ReadOnlySpan<IntPtr> inputBuffers, uint sampleCount)
{
- const ushort channelCount = 4;
+ const ushort ChannelCount = 4;
float delayFeedbackBaseGain = state.DelayFeedbackBaseGain;
float delayFeedbackCrossGain = state.DelayFeedbackCrossGain;
@@ -150,7 +150,7 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
Vector4 temp = MatrixHelper.Transform(ref delayLineValues, ref delayFeedback) + channelInput * inGain;
- state.UpdateLowPassFilter(ref Unsafe.As<Vector4, float>(ref temp), channelCount);
+ state.UpdateLowPassFilter(ref Unsafe.As<Vector4, float>(ref temp), ChannelCount);
*((float*)outputBuffers[0] + i) = (channelInput.X * dryGain + delayLineValues.X * outGain) / 64;
*((float*)outputBuffers[1] + i) = (channelInput.Y * dryGain + delayLineValues.Y * outGain) / 64;
@@ -162,7 +162,7 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
private unsafe void ProcessDelaySurround(ref DelayState state, Span<IntPtr> outputBuffers, ReadOnlySpan<IntPtr> inputBuffers, uint sampleCount)
{
- const ushort channelCount = 6;
+ const ushort ChannelCount = 6;
float feedbackGain = FixedPointHelper.ToFloat(Parameter.FeedbackGain, FixedPointPrecision);
float delayFeedbackBaseGain = state.DelayFeedbackBaseGain;
@@ -202,7 +202,7 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
Vector6 temp = MatrixHelper.Transform(ref delayLineValues, ref delayFeedback) + channelInput * inGain;
- state.UpdateLowPassFilter(ref Unsafe.As<Vector6, float>(ref temp), channelCount);
+ state.UpdateLowPassFilter(ref Unsafe.As<Vector6, float>(ref temp), ChannelCount);
*((float*)outputBuffers[0] + i) = (channelInput.X * dryGain + delayLineValues.X * outGain) / 64;
*((float*)outputBuffers[1] + i) = (channelInput.Y * dryGain + delayLineValues.Y * outGain) / 64;
@@ -277,4 +277,4 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
ProcessDelay(context, ref state);
}
}
-} \ No newline at end of file
+}
diff --git a/src/Ryujinx.Audio/Renderer/Dsp/Command/DeviceSinkCommand.cs b/src/Ryujinx.Audio/Renderer/Dsp/Command/DeviceSinkCommand.cs
index 27bb34bf..19afc66f 100644
--- a/src/Ryujinx.Audio/Renderer/Dsp/Command/DeviceSinkCommand.cs
+++ b/src/Ryujinx.Audio/Renderer/Dsp/Command/DeviceSinkCommand.cs
@@ -65,7 +65,7 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
int channelCount = (int)device.GetChannelCount();
uint bufferCount = Math.Min(device.GetChannelCount(), InputCount);
- const int sampleCount = Constants.TargetSampleCount;
+ const int SampleCount = Constants.TargetSampleCount;
uint inputCount;
@@ -79,13 +79,13 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
inputCount = bufferCount;
}
- short[] outputBuffer = new short[inputCount * sampleCount];
+ short[] outputBuffer = new short[inputCount * SampleCount];
for (int i = 0; i < bufferCount; i++)
{
- ReadOnlySpan<float> inputBuffer = GetBuffer(InputBufferIndices[i], sampleCount);
+ ReadOnlySpan<float> inputBuffer = GetBuffer(InputBufferIndices[i], SampleCount);
- for (int j = 0; j < sampleCount; j++)
+ for (int j = 0; j < SampleCount; j++)
{
outputBuffer[i + j * channelCount] = PcmHelper.Saturate(inputBuffer[j]);
}
@@ -100,4 +100,4 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
}
}
}
-} \ No newline at end of file
+}
diff --git a/src/Ryujinx.Audio/Renderer/Dsp/Command/Reverb3dCommand.cs b/src/Ryujinx.Audio/Renderer/Dsp/Command/Reverb3dCommand.cs
index 74b53b24..d1177e60 100644
--- a/src/Ryujinx.Audio/Renderer/Dsp/Command/Reverb3dCommand.cs
+++ b/src/Ryujinx.Audio/Renderer/Dsp/Command/Reverb3dCommand.cs
@@ -96,7 +96,7 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
private unsafe void ProcessReverb3dGeneric(ref Reverb3dState state, ReadOnlySpan<IntPtr> outputBuffers, ReadOnlySpan<IntPtr> inputBuffers, uint sampleCount, ReadOnlySpan<int> outputEarlyIndicesTable, ReadOnlySpan<int> targetEarlyDelayLineIndicesTable, ReadOnlySpan<int> targetOutputFeedbackIndicesTable)
{
- const int delayLineSampleIndexOffset = 1;
+ const int DelayLineSampleIndexOffset = 1;
bool isMono = Parameter.ChannelCount == 1;
bool isSurround = Parameter.ChannelCount == 6;
@@ -111,14 +111,14 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
{
outputValues.Fill(0);
- float tapOut = state.PreDelayLine.TapUnsafe(state.ReflectionDelayTime, delayLineSampleIndexOffset);
+ float tapOut = state.PreDelayLine.TapUnsafe(state.ReflectionDelayTime, DelayLineSampleIndexOffset);
for (int i = 0; i < targetEarlyDelayLineIndicesTable.Length; i++)
{
int earlyDelayIndex = targetEarlyDelayLineIndicesTable[i];
int outputIndex = outputEarlyIndicesTable[earlyDelayIndex];
- float tempTapOut = state.PreDelayLine.TapUnsafe(state.EarlyDelayTime[earlyDelayIndex], delayLineSampleIndexOffset);
+ float tempTapOut = state.PreDelayLine.TapUnsafe(state.EarlyDelayTime[earlyDelayIndex], DelayLineSampleIndexOffset);
outputValues[outputIndex] += tempTapOut * state.EarlyGain[earlyDelayIndex];
}
@@ -251,4 +251,4 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
ProcessReverb3d(context, ref state);
}
}
-} \ No newline at end of file
+}
diff --git a/src/Ryujinx.Audio/Renderer/Dsp/DataSourceHelper.cs b/src/Ryujinx.Audio/Renderer/Dsp/DataSourceHelper.cs
index 721830c9..12e0f13f 100644
--- a/src/Ryujinx.Audio/Renderer/Dsp/DataSourceHelper.cs
+++ b/src/Ryujinx.Audio/Renderer/Dsp/DataSourceHelper.cs
@@ -44,9 +44,9 @@ namespace Ryujinx.Audio.Renderer.Dsp
public static void ProcessWaveBuffers(IVirtualMemoryManager memoryManager, Span<float> outputBuffer, ref WaveBufferInformation info, Span<WaveBuffer> wavebuffers, ref VoiceUpdateState voiceState, uint targetSampleRate, int sampleCount)
{
- const int tempBufferSize = 0x3F00;
+ const int TempBufferSize = 0x3F00;
- Span<short> tempBuffer = stackalloc short[tempBufferSize];
+ Span<short> tempBuffer = stackalloc short[TempBufferSize];
float sampleRateRatio = (float)info.SourceSampleRate / targetSampleRate * info.Pitch;
@@ -60,11 +60,11 @@ namespace Ryujinx.Audio.Renderer.Dsp
int totalNeededSize = (int)MathF.Truncate(fraction + sampleRateRatio * sampleCount);
- if (totalNeededSize + pitchMaxLength <= tempBufferSize && totalNeededSize >= 0)
+ if (totalNeededSize + pitchMaxLength <= TempBufferSize && totalNeededSize >= 0)
{
int sourceSampleCountToProcess = sampleCount;
- int maxSampleCountPerIteration = Math.Min((int)MathF.Truncate((tempBufferSize - fraction) / sampleRateRatio), sampleCount);
+ int maxSampleCountPerIteration = Math.Min((int)MathF.Truncate((TempBufferSize - fraction) / sampleRateRatio), sampleCount);
bool isStarving = false;
@@ -463,4 +463,4 @@ namespace Ryujinx.Audio.Renderer.Dsp
}
}
}
-} \ No newline at end of file
+}
diff --git a/src/Ryujinx.Audio/Renderer/Dsp/UpsamplerHelper.cs b/src/Ryujinx.Audio/Renderer/Dsp/UpsamplerHelper.cs
index 6cdab5a7..54a63ace 100644
--- a/src/Ryujinx.Audio/Renderer/Dsp/UpsamplerHelper.cs
+++ b/src/Ryujinx.Audio/Renderer/Dsp/UpsamplerHelper.cs
@@ -32,13 +32,13 @@ namespace Ryujinx.Audio.Renderer.Dsp
float BlackmanWindow(float x)
{
- const float a = 0.18f;
- const float a0 = 0.5f - 0.5f * a;
- const float a1 = -0.5f;
- const float a2 = 0.5f * a;
- return a0 + a1 * MathF.Cos(2 * MathF.PI * x) + a2 * MathF.Cos(4 * MathF.PI * x);
+ const float A = 0.18f;
+ const float A0 = 0.5f - 0.5f * A;
+ const float A1 = -0.5f;
+ const float A2 = 0.5f * A;
+ return A0 + A1 * MathF.Cos(2 * MathF.PI * x) + A2 * MathF.Cos(4 * MathF.PI * x);
}
-
+
Array20<float> result = new Array20<float>();
for (int i = 0; i < FilterBankLength; i++)
@@ -112,7 +112,7 @@ namespace Ryujinx.Audio.Renderer.Dsp
int inputBufferIndex = 0;
switch (state.Scale)
- {
+ {
case 6.0f:
for (int i = 0; i < outputSampleCount; i++)
{
@@ -189,4 +189,4 @@ namespace Ryujinx.Audio.Renderer.Dsp
}
}
}
-} \ No newline at end of file
+}
diff --git a/src/Ryujinx.Audio/Renderer/Server/CommandProcessingTimeEstimatorVersion2.cs b/src/Ryujinx.Audio/Renderer/Server/CommandProcessingTimeEstimatorVersion2.cs
index 7ee491cd..d4f28a07 100644
--- a/src/Ryujinx.Audio/Renderer/Server/CommandProcessingTimeEstimatorVersion2.cs
+++ b/src/Ryujinx.Audio/Renderer/Server/CommandProcessingTimeEstimatorVersion2.cs
@@ -60,7 +60,7 @@ namespace Ryujinx.Audio.Renderer.Server
public uint Estimate(MixRampGroupedCommand command)
{
- const float costPerSample = 7.245f;
+ const float CostPerSample = 7.245f;
Debug.Assert(_sampleCount == 160 || _sampleCount == 240);
@@ -74,7 +74,7 @@ namespace Ryujinx.Audio.Renderer.Server
}
}
- return (uint)(_sampleCount * costPerSample * volumeCount);
+ return (uint)(_sampleCount * CostPerSample * volumeCount);
}
public uint Estimate(MixRampCommand command)
@@ -549,4 +549,4 @@ namespace Ryujinx.Audio.Renderer.Server
return 0;
}
}
-} \ No newline at end of file
+}
diff --git a/src/Ryujinx.Audio/Renderer/Server/MemoryPool/PoolMapper.cs b/src/Ryujinx.Audio/Renderer/Server/MemoryPool/PoolMapper.cs
index 6c79da15..4a29ead3 100644
--- a/src/Ryujinx.Audio/Renderer/Server/MemoryPool/PoolMapper.cs
+++ b/src/Ryujinx.Audio/Renderer/Server/MemoryPool/PoolMapper.cs
@@ -256,19 +256,19 @@ namespace Ryujinx.Audio.Renderer.Server.MemoryPool
MemoryPoolUserState outputState;
- const uint pageSize = 0x1000;
+ const uint PageSize = 0x1000;
if (inputState != MemoryPoolUserState.RequestAttach && inputState != MemoryPoolUserState.RequestDetach)
{
return UpdateResult.Success;
}
- if (inParameter.CpuAddress == 0 || (inParameter.CpuAddress % pageSize) != 0)
+ if (inParameter.CpuAddress == 0 || (inParameter.CpuAddress % PageSize) != 0)
{
return UpdateResult.InvalidParameter;
}
- if (inParameter.Size == 0 || (inParameter.Size % pageSize) != 0)
+ if (inParameter.Size == 0 || (inParameter.Size % PageSize) != 0)
{
return UpdateResult.InvalidParameter;
}
@@ -363,4 +363,4 @@ namespace Ryujinx.Audio.Renderer.Server.MemoryPool
}
}
}
-} \ No newline at end of file
+}