|
@@ -17,7 +17,7 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
|
|
|
|
|
|
|
public CommandType CommandType => CommandType.Delay;
|
|
public CommandType CommandType => CommandType.Delay;
|
|
|
|
|
|
|
|
- public ulong EstimatedProcessingTime { get; set; }
|
|
|
|
|
|
|
+ public uint EstimatedProcessingTime { get; set; }
|
|
|
|
|
|
|
|
public DelayParameter Parameter => _parameter;
|
|
public DelayParameter Parameter => _parameter;
|
|
|
public Memory<DelayState> State { get; }
|
|
public Memory<DelayState> State { get; }
|
|
@@ -49,15 +49,15 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
|
|
OutputBufferIndices[i] = (ushort)(bufferOffset + Parameter.Output[i]);
|
|
OutputBufferIndices[i] = (ushort)(bufferOffset + Parameter.Output[i]);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // NOTE: We do the opposite as Nintendo here for now to restore previous behaviour
|
|
|
|
|
- // TODO: Update delay processing and remove this to use RemapLegacyChannelEffectMappingToChannelResourceMapping.
|
|
|
|
|
- DataSourceHelper.RemapChannelResourceMappingToLegacy(newEffectChannelMappingSupported, InputBufferIndices);
|
|
|
|
|
- DataSourceHelper.RemapChannelResourceMappingToLegacy(newEffectChannelMappingSupported, OutputBufferIndices);
|
|
|
|
|
|
|
+ DataSourceHelper.RemapLegacyChannelEffectMappingToChannelResourceMapping(newEffectChannelMappingSupported, InputBufferIndices);
|
|
|
|
|
+ DataSourceHelper.RemapLegacyChannelEffectMappingToChannelResourceMapping(newEffectChannelMappingSupported, OutputBufferIndices);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
|
|
|
private unsafe void ProcessDelayMono(ref DelayState state, float* outputBuffer, float* inputBuffer, uint sampleCount)
|
|
private unsafe void ProcessDelayMono(ref DelayState state, float* outputBuffer, float* inputBuffer, uint sampleCount)
|
|
|
{
|
|
{
|
|
|
|
|
+ const ushort channelCount = 1;
|
|
|
|
|
+
|
|
|
float feedbackGain = FixedPointHelper.ToFloat(Parameter.FeedbackGain, FixedPointPrecision);
|
|
float feedbackGain = FixedPointHelper.ToFloat(Parameter.FeedbackGain, FixedPointPrecision);
|
|
|
float inGain = FixedPointHelper.ToFloat(Parameter.InGain, FixedPointPrecision);
|
|
float inGain = FixedPointHelper.ToFloat(Parameter.InGain, FixedPointPrecision);
|
|
|
float dryGain = FixedPointHelper.ToFloat(Parameter.DryGain, FixedPointPrecision);
|
|
float dryGain = FixedPointHelper.ToFloat(Parameter.DryGain, FixedPointPrecision);
|
|
@@ -70,7 +70,7 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
|
|
|
|
|
|
|
float temp = input * inGain + delayLineValue * feedbackGain;
|
|
float temp = input * inGain + delayLineValue * feedbackGain;
|
|
|
|
|
|
|
|
- state.UpdateLowPassFilter(ref temp, 1);
|
|
|
|
|
|
|
+ state.UpdateLowPassFilter(ref temp, channelCount);
|
|
|
|
|
|
|
|
outputBuffer[i] = (input * dryGain + delayLineValue * outGain) / 64;
|
|
outputBuffer[i] = (input * dryGain + delayLineValue * outGain) / 64;
|
|
|
}
|
|
}
|
|
@@ -104,7 +104,7 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
|
|
Y = state.DelayLines[1].Read(),
|
|
Y = state.DelayLines[1].Read(),
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- Vector2 temp = MatrixHelper.Transform(ref channelInput, ref delayFeedback) + channelInput * inGain;
|
|
|
|
|
|
|
+ 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);
|
|
|
|
|
|
|
@@ -148,7 +148,7 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
|
|
W = state.DelayLines[3].Read()
|
|
W = state.DelayLines[3].Read()
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- Vector4 temp = MatrixHelper.Transform(ref channelInput, ref delayFeedback) + channelInput * inGain;
|
|
|
|
|
|
|
+ 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);
|
|
|
|
|
|
|
@@ -171,12 +171,12 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
|
|
float dryGain = FixedPointHelper.ToFloat(Parameter.DryGain, FixedPointPrecision);
|
|
float dryGain = FixedPointHelper.ToFloat(Parameter.DryGain, FixedPointPrecision);
|
|
|
float outGain = FixedPointHelper.ToFloat(Parameter.OutGain, FixedPointPrecision);
|
|
float outGain = FixedPointHelper.ToFloat(Parameter.OutGain, FixedPointPrecision);
|
|
|
|
|
|
|
|
- Matrix6x6 delayFeedback = new Matrix6x6(delayFeedbackBaseGain, 0.0f, 0.0f, 0.0f, delayFeedbackCrossGain, delayFeedbackCrossGain,
|
|
|
|
|
- 0.0f, delayFeedbackBaseGain, 0.0f, delayFeedbackCrossGain, delayFeedbackCrossGain, 0.0f,
|
|
|
|
|
- delayFeedbackCrossGain, 0.0f, delayFeedbackBaseGain, delayFeedbackCrossGain, 0.0f, 0.0f,
|
|
|
|
|
- 0.0f, delayFeedbackCrossGain, delayFeedbackCrossGain, delayFeedbackBaseGain, 0.0f, 0.0f,
|
|
|
|
|
- delayFeedbackCrossGain, delayFeedbackCrossGain, 0.0f, 0.0f, delayFeedbackBaseGain, 0.0f,
|
|
|
|
|
- 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, feedbackGain);
|
|
|
|
|
|
|
+ Matrix6x6 delayFeedback = new Matrix6x6(delayFeedbackBaseGain, 0.0f, delayFeedbackCrossGain, 0.0f, delayFeedbackCrossGain, 0.0f,
|
|
|
|
|
+ 0.0f, delayFeedbackBaseGain, delayFeedbackCrossGain, 0.0f, 0.0f, delayFeedbackCrossGain,
|
|
|
|
|
+ delayFeedbackCrossGain, delayFeedbackCrossGain, delayFeedbackBaseGain, 0.0f, 0.0f, 0.0f,
|
|
|
|
|
+ 0.0f, 0.0f, 0.0f, feedbackGain, 0.0f, 0.0f,
|
|
|
|
|
+ delayFeedbackCrossGain, 0.0f, 0.0f, 0.0f, delayFeedbackBaseGain, delayFeedbackCrossGain,
|
|
|
|
|
+ 0.0f, delayFeedbackCrossGain, 0.0f, 0.0f, delayFeedbackCrossGain, delayFeedbackBaseGain);
|
|
|
|
|
|
|
|
for (int i = 0; i < sampleCount; i++)
|
|
for (int i = 0; i < sampleCount; i++)
|
|
|
{
|
|
{
|
|
@@ -200,7 +200,7 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
|
|
U = state.DelayLines[5].Read()
|
|
U = state.DelayLines[5].Read()
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- Vector6 temp = MatrixHelper.Transform(ref channelInput, ref delayFeedback) + channelInput * inGain;
|
|
|
|
|
|
|
+ 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);
|
|
|
|
|
|