mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-10-25 07:34:25 +00:00
SDK20 and REV15 support (ryubing/ryujinx!50)
See merge request ryubing/ryujinx!50
This commit is contained in:
@@ -1,9 +1,11 @@
|
|||||||
|
using Ryujinx.Audio.Renderer.Server;
|
||||||
|
using Ryujinx.Audio.Renderer.Server.MemoryPool;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace Ryujinx.Audio.Renderer.Common
|
namespace Ryujinx.Audio.Renderer.Common
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents the input parameter for <see cref="Server.BehaviourContext"/>.
|
/// Represents the input parameter for <see cref="BehaviourInfo"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||||
public struct BehaviourParameter
|
public struct BehaviourParameter
|
||||||
@@ -21,7 +23,7 @@ namespace Ryujinx.Audio.Renderer.Common
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The flags given controlling behaviour of the audio renderer
|
/// The flags given controlling behaviour of the audio renderer
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>See <see cref="Server.BehaviourContext.UpdateFlags(ulong)"/> and <see cref="Server.BehaviourContext.IsMemoryPoolForceMappingEnabled"/>.</remarks>
|
/// <remarks>See <see cref="BehaviourInfo.UpdateFlags(ulong)"/> and <see cref="BehaviourInfo.IsMemoryPoolForceMappingEnabled"/>.</remarks>
|
||||||
public ulong Flags;
|
public ulong Flags;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -43,7 +45,7 @@ namespace Ryujinx.Audio.Renderer.Common
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Extra information given with the <see cref="ResultCode"/>
|
/// Extra information given with the <see cref="ResultCode"/>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>This is usually used to report a faulting cpu address when a <see cref="Server.MemoryPool.MemoryPoolState"/> mapping fail.</remarks>
|
/// <remarks>This is usually used to report a faulting cpu address when a <see cref="MemoryPoolInfo"/> mapping fail.</remarks>
|
||||||
public ulong ExtraErrorInfo;
|
public ulong ExtraErrorInfo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using Ryujinx.Audio.Renderer.Dsp.State;
|
using Ryujinx.Audio.Renderer.Dsp.State;
|
||||||
|
using Ryujinx.Audio.Renderer.Parameter;
|
||||||
using Ryujinx.Common.Memory;
|
using Ryujinx.Common.Memory;
|
||||||
using Ryujinx.Common.Utilities;
|
using Ryujinx.Common.Utilities;
|
||||||
using System;
|
using System;
|
||||||
@@ -11,7 +12,7 @@ namespace Ryujinx.Audio.Renderer.Common
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>This is shared between the server and audio processor.</remarks>
|
/// <remarks>This is shared between the server and audio processor.</remarks>
|
||||||
[StructLayout(LayoutKind.Sequential, Pack = Align)]
|
[StructLayout(LayoutKind.Sequential, Pack = Align)]
|
||||||
public struct VoiceUpdateState
|
public struct VoiceState
|
||||||
{
|
{
|
||||||
public const int Align = 0x10;
|
public const int Align = 0x10;
|
||||||
public const int BiquadStateOffset = 0x0;
|
public const int BiquadStateOffset = 0x0;
|
||||||
@@ -25,7 +26,7 @@ namespace Ryujinx.Audio.Renderer.Common
|
|||||||
/// The total amount of samples that was played.
|
/// The total amount of samples that was played.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>This is reset to 0 when a <see cref="WaveBuffer"/> finishes playing and <see cref="WaveBuffer.IsEndOfStream"/> is set.</remarks>
|
/// <remarks>This is reset to 0 when a <see cref="WaveBuffer"/> finishes playing and <see cref="WaveBuffer.IsEndOfStream"/> is set.</remarks>
|
||||||
/// <remarks>This is reset to 0 when looping while <see cref="Parameter.VoiceInParameter.DecodingBehaviour.PlayedSampleCountResetWhenLooping"/> is set.</remarks>
|
/// <remarks>This is reset to 0 when looping while <see cref="VoiceInParameter1.DecodingBehaviour.PlayedSampleCountResetWhenLooping"/> is set.</remarks>
|
||||||
public ulong PlayedSampleCount;
|
public ulong PlayedSampleCount;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
using Ryujinx.Audio.Renderer.Dsp.State;
|
using Ryujinx.Audio.Renderer.Dsp.State;
|
||||||
using Ryujinx.Audio.Renderer.Parameter;
|
using Ryujinx.Audio.Renderer.Parameter;
|
||||||
|
using Ryujinx.Audio.Renderer.Parameter.Effect;
|
||||||
|
using Ryujinx.Common.Memory;
|
||||||
using System;
|
using System;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
@@ -9,6 +11,112 @@ namespace Ryujinx.Audio.Renderer.Dsp
|
|||||||
{
|
{
|
||||||
private const int FixedPointPrecisionForParameter = 14;
|
private const int FixedPointPrecisionForParameter = 14;
|
||||||
|
|
||||||
|
public static BiquadFilterParameter1 ToBiquadFilterParameter1(BiquadFilterParameter2 parameter)
|
||||||
|
{
|
||||||
|
BiquadFilterParameter1 result = new()
|
||||||
|
{
|
||||||
|
Enable = parameter.Enable, Numerator = new Array3<short>(), Denominator = new Array2<short>()
|
||||||
|
};
|
||||||
|
|
||||||
|
Span<short> resultNumeratorSpan = result.Numerator.AsSpan();
|
||||||
|
Span<short> resultDenominatorSpan = result.Denominator.AsSpan();
|
||||||
|
|
||||||
|
Span<float> parameterNumeratorSpan = parameter.Numerator.AsSpan();
|
||||||
|
Span<float> parameterDenominatorSpan = parameter.Denominator.AsSpan();
|
||||||
|
|
||||||
|
|
||||||
|
resultNumeratorSpan[0] = (short)FixedPointHelper.ToFixed(parameterNumeratorSpan[0], FixedPointPrecisionForParameter);
|
||||||
|
resultNumeratorSpan[1] = (short)FixedPointHelper.ToFixed(parameterNumeratorSpan[1], FixedPointPrecisionForParameter);
|
||||||
|
resultNumeratorSpan[2] = (short)FixedPointHelper.ToFixed(parameterNumeratorSpan[2], FixedPointPrecisionForParameter);
|
||||||
|
|
||||||
|
resultDenominatorSpan[0] = (short)FixedPointHelper.ToFixed(parameterDenominatorSpan[0], FixedPointPrecisionForParameter);
|
||||||
|
resultDenominatorSpan[1] = (short)FixedPointHelper.ToFixed(parameterDenominatorSpan[1], FixedPointPrecisionForParameter);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static BiquadFilterParameter2 ToBiquadFilterParameter2(BiquadFilterParameter1 parameter)
|
||||||
|
{
|
||||||
|
BiquadFilterParameter2 result = new()
|
||||||
|
{
|
||||||
|
Enable = parameter.Enable, Numerator = new Array3<float>(), Denominator = new Array2<float>()
|
||||||
|
};
|
||||||
|
|
||||||
|
Span<float> resultNumeratorSpan = result.Numerator.AsSpan();
|
||||||
|
Span<float> resultDenominatorSpan = result.Denominator.AsSpan();
|
||||||
|
|
||||||
|
Span<short> parameterNumeratorSpan = parameter.Numerator.AsSpan();
|
||||||
|
Span<short> parameterDenominatorSpan = parameter.Denominator.AsSpan();
|
||||||
|
|
||||||
|
|
||||||
|
resultNumeratorSpan[0] = FixedPointHelper.ToFloat(parameterNumeratorSpan[0], FixedPointPrecisionForParameter);
|
||||||
|
resultNumeratorSpan[1] = FixedPointHelper.ToFloat(parameterNumeratorSpan[1], FixedPointPrecisionForParameter);
|
||||||
|
resultNumeratorSpan[2] = FixedPointHelper.ToFloat(parameterNumeratorSpan[2], FixedPointPrecisionForParameter);
|
||||||
|
|
||||||
|
resultDenominatorSpan[0] = FixedPointHelper.ToFloat(parameterDenominatorSpan[0], FixedPointPrecisionForParameter);
|
||||||
|
resultDenominatorSpan[1] = FixedPointHelper.ToFloat(parameterDenominatorSpan[1], FixedPointPrecisionForParameter);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static BiquadFilterEffectParameter1 ToBiquadFilterEffectParameter1(BiquadFilterEffectParameter2 parameter)
|
||||||
|
{
|
||||||
|
BiquadFilterEffectParameter1 result = new()
|
||||||
|
{
|
||||||
|
Input = parameter.Input,
|
||||||
|
Output = parameter.Output,
|
||||||
|
Numerator = new Array3<short>(),
|
||||||
|
Denominator = new Array2<short>(),
|
||||||
|
ChannelCount = parameter.ChannelCount,
|
||||||
|
Status = parameter.Status,
|
||||||
|
};
|
||||||
|
|
||||||
|
Span<short> resultNumeratorSpan = result.Numerator.AsSpan();
|
||||||
|
Span<short> resultDenominatorSpan = result.Denominator.AsSpan();
|
||||||
|
|
||||||
|
Span<float> parameterNumeratorSpan = parameter.Numerator.AsSpan();
|
||||||
|
Span<float> parameterDenominatorSpan = parameter.Denominator.AsSpan();
|
||||||
|
|
||||||
|
|
||||||
|
resultNumeratorSpan[0] = (short)FixedPointHelper.ToFixed(parameterNumeratorSpan[0], FixedPointPrecisionForParameter);
|
||||||
|
resultNumeratorSpan[1] = (short)FixedPointHelper.ToFixed(parameterNumeratorSpan[1], FixedPointPrecisionForParameter);
|
||||||
|
resultNumeratorSpan[2] = (short)FixedPointHelper.ToFixed(parameterNumeratorSpan[2], FixedPointPrecisionForParameter);
|
||||||
|
|
||||||
|
resultDenominatorSpan[0] = (short)FixedPointHelper.ToFixed(parameterDenominatorSpan[0], FixedPointPrecisionForParameter);
|
||||||
|
resultDenominatorSpan[1] = (short)FixedPointHelper.ToFixed(parameterDenominatorSpan[1], FixedPointPrecisionForParameter);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static BiquadFilterEffectParameter2 ToBiquadFilterEffectParameter2(BiquadFilterEffectParameter1 parameter)
|
||||||
|
{
|
||||||
|
BiquadFilterEffectParameter2 result = new()
|
||||||
|
{
|
||||||
|
Input = parameter.Input,
|
||||||
|
Output = parameter.Output,
|
||||||
|
Numerator = new Array3<float>(),
|
||||||
|
Denominator = new Array2<float>(),
|
||||||
|
ChannelCount = parameter.ChannelCount,
|
||||||
|
Status = parameter.Status,
|
||||||
|
};
|
||||||
|
|
||||||
|
Span<float> resultNumeratorSpan = result.Numerator.AsSpan();
|
||||||
|
Span<float> resultDenominatorSpan = result.Denominator.AsSpan();
|
||||||
|
|
||||||
|
Span<short> parameterNumeratorSpan = parameter.Numerator.AsSpan();
|
||||||
|
Span<short> parameterDenominatorSpan = parameter.Denominator.AsSpan();
|
||||||
|
|
||||||
|
|
||||||
|
resultNumeratorSpan[0] = FixedPointHelper.ToFloat(parameterNumeratorSpan[0], FixedPointPrecisionForParameter);
|
||||||
|
resultNumeratorSpan[1] = FixedPointHelper.ToFloat(parameterNumeratorSpan[1], FixedPointPrecisionForParameter);
|
||||||
|
resultNumeratorSpan[2] = FixedPointHelper.ToFloat(parameterNumeratorSpan[2], FixedPointPrecisionForParameter);
|
||||||
|
|
||||||
|
resultDenominatorSpan[0] = FixedPointHelper.ToFloat(parameterDenominatorSpan[0], FixedPointPrecisionForParameter);
|
||||||
|
resultDenominatorSpan[1] = FixedPointHelper.ToFloat(parameterDenominatorSpan[1], FixedPointPrecisionForParameter);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Apply a single biquad filter.
|
/// Apply a single biquad filter.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -20,21 +128,21 @@ namespace Ryujinx.Audio.Renderer.Dsp
|
|||||||
/// <param name="sampleCount">The count of samples to process</param>
|
/// <param name="sampleCount">The count of samples to process</param>
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static void ProcessBiquadFilter(
|
public static void ProcessBiquadFilter(
|
||||||
ref BiquadFilterParameter parameter,
|
ref BiquadFilterParameter2 parameter,
|
||||||
ref BiquadFilterState state,
|
ref BiquadFilterState state,
|
||||||
Span<float> outputBuffer,
|
Span<float> outputBuffer,
|
||||||
ReadOnlySpan<float> inputBuffer,
|
ReadOnlySpan<float> inputBuffer,
|
||||||
uint sampleCount)
|
uint sampleCount)
|
||||||
{
|
{
|
||||||
Span<short> numeratorSpan = parameter.Numerator.AsSpan();
|
Span<float> numeratorSpan = parameter.Numerator.AsSpan();
|
||||||
Span<short> denominatorSpan = parameter.Denominator.AsSpan();
|
Span<float> denominatorSpan = parameter.Denominator.AsSpan();
|
||||||
|
|
||||||
float a0 = FixedPointHelper.ToFloat(numeratorSpan[0], FixedPointPrecisionForParameter);
|
float a0 = numeratorSpan[0];
|
||||||
float a1 = FixedPointHelper.ToFloat(numeratorSpan[1], FixedPointPrecisionForParameter);
|
float a1 = numeratorSpan[1];
|
||||||
float a2 = FixedPointHelper.ToFloat(numeratorSpan[2], FixedPointPrecisionForParameter);
|
float a2 = numeratorSpan[2];
|
||||||
|
|
||||||
float b1 = FixedPointHelper.ToFloat(denominatorSpan[0], FixedPointPrecisionForParameter);
|
float b1 = denominatorSpan[0];
|
||||||
float b2 = FixedPointHelper.ToFloat(denominatorSpan[1], FixedPointPrecisionForParameter);
|
float b2 = denominatorSpan[1];
|
||||||
|
|
||||||
for (int i = 0; i < sampleCount; i++)
|
for (int i = 0; i < sampleCount; i++)
|
||||||
{
|
{
|
||||||
@@ -60,22 +168,22 @@ namespace Ryujinx.Audio.Renderer.Dsp
|
|||||||
/// <param name="volume">Mix volume</param>
|
/// <param name="volume">Mix volume</param>
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static void ProcessBiquadFilterAndMix(
|
public static void ProcessBiquadFilterAndMix(
|
||||||
ref BiquadFilterParameter parameter,
|
ref BiquadFilterParameter2 parameter,
|
||||||
ref BiquadFilterState state,
|
ref BiquadFilterState state,
|
||||||
Span<float> outputBuffer,
|
Span<float> outputBuffer,
|
||||||
ReadOnlySpan<float> inputBuffer,
|
ReadOnlySpan<float> inputBuffer,
|
||||||
uint sampleCount,
|
uint sampleCount,
|
||||||
float volume)
|
float volume)
|
||||||
{
|
{
|
||||||
Span<short> numeratorSpan = parameter.Numerator.AsSpan();
|
Span<float> numeratorSpan = parameter.Numerator.AsSpan();
|
||||||
Span<short> denominatorSpan = parameter.Denominator.AsSpan();
|
Span<float> denominatorSpan = parameter.Denominator.AsSpan();
|
||||||
|
|
||||||
float a0 = FixedPointHelper.ToFloat(numeratorSpan[0], FixedPointPrecisionForParameter);
|
float a0 = numeratorSpan[0];
|
||||||
float a1 = FixedPointHelper.ToFloat(numeratorSpan[1], FixedPointPrecisionForParameter);
|
float a1 = numeratorSpan[1];
|
||||||
float a2 = FixedPointHelper.ToFloat(numeratorSpan[2], FixedPointPrecisionForParameter);
|
float a2 = numeratorSpan[2];
|
||||||
|
|
||||||
float b1 = FixedPointHelper.ToFloat(denominatorSpan[0], FixedPointPrecisionForParameter);
|
float b1 = denominatorSpan[0];
|
||||||
float b2 = FixedPointHelper.ToFloat(denominatorSpan[1], FixedPointPrecisionForParameter);
|
float b2 = denominatorSpan[1];
|
||||||
|
|
||||||
for (int i = 0; i < sampleCount; i++)
|
for (int i = 0; i < sampleCount; i++)
|
||||||
{
|
{
|
||||||
@@ -105,7 +213,7 @@ namespace Ryujinx.Audio.Renderer.Dsp
|
|||||||
/// <returns>Last filtered sample value</returns>
|
/// <returns>Last filtered sample value</returns>
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static float ProcessBiquadFilterAndMixRamp(
|
public static float ProcessBiquadFilterAndMixRamp(
|
||||||
ref BiquadFilterParameter parameter,
|
ref BiquadFilterParameter2 parameter,
|
||||||
ref BiquadFilterState state,
|
ref BiquadFilterState state,
|
||||||
Span<float> outputBuffer,
|
Span<float> outputBuffer,
|
||||||
ReadOnlySpan<float> inputBuffer,
|
ReadOnlySpan<float> inputBuffer,
|
||||||
@@ -113,15 +221,15 @@ namespace Ryujinx.Audio.Renderer.Dsp
|
|||||||
float volume,
|
float volume,
|
||||||
float ramp)
|
float ramp)
|
||||||
{
|
{
|
||||||
Span<short> numeratorSpan = parameter.Numerator.AsSpan();
|
Span<float> numeratorSpan = parameter.Numerator.AsSpan();
|
||||||
Span<short> denominatorSpan = parameter.Denominator.AsSpan();
|
Span<float> denominatorSpan = parameter.Denominator.AsSpan();
|
||||||
|
|
||||||
float a0 = FixedPointHelper.ToFloat(numeratorSpan[0], FixedPointPrecisionForParameter);
|
float a0 = numeratorSpan[0];
|
||||||
float a1 = FixedPointHelper.ToFloat(numeratorSpan[1], FixedPointPrecisionForParameter);
|
float a1 = numeratorSpan[1];
|
||||||
float a2 = FixedPointHelper.ToFloat(numeratorSpan[2], FixedPointPrecisionForParameter);
|
float a2 = numeratorSpan[2];
|
||||||
|
|
||||||
float b1 = FixedPointHelper.ToFloat(denominatorSpan[0], FixedPointPrecisionForParameter);
|
float b1 = denominatorSpan[0];
|
||||||
float b2 = FixedPointHelper.ToFloat(denominatorSpan[1], FixedPointPrecisionForParameter);
|
float b2 = denominatorSpan[1];
|
||||||
|
|
||||||
float mixState = 0f;
|
float mixState = 0f;
|
||||||
|
|
||||||
@@ -155,7 +263,7 @@ namespace Ryujinx.Audio.Renderer.Dsp
|
|||||||
/// <param name="sampleCount">The count of samples to process</param>
|
/// <param name="sampleCount">The count of samples to process</param>
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static void ProcessBiquadFilter(
|
public static void ProcessBiquadFilter(
|
||||||
ReadOnlySpan<BiquadFilterParameter> parameters,
|
ReadOnlySpan<BiquadFilterParameter2> parameters,
|
||||||
Span<BiquadFilterState> states,
|
Span<BiquadFilterState> states,
|
||||||
Span<float> outputBuffer,
|
Span<float> outputBuffer,
|
||||||
ReadOnlySpan<float> inputBuffer,
|
ReadOnlySpan<float> inputBuffer,
|
||||||
@@ -163,19 +271,19 @@ namespace Ryujinx.Audio.Renderer.Dsp
|
|||||||
{
|
{
|
||||||
for (int stageIndex = 0; stageIndex < parameters.Length; stageIndex++)
|
for (int stageIndex = 0; stageIndex < parameters.Length; stageIndex++)
|
||||||
{
|
{
|
||||||
BiquadFilterParameter parameter = parameters[stageIndex];
|
BiquadFilterParameter2 parameter = parameters[stageIndex];
|
||||||
|
|
||||||
ref BiquadFilterState state = ref states[stageIndex];
|
ref BiquadFilterState state = ref states[stageIndex];
|
||||||
|
|
||||||
Span<short> numeratorSpan = parameter.Numerator.AsSpan();
|
Span<float> numeratorSpan = parameter.Numerator.AsSpan();
|
||||||
Span<short> denominatorSpan = parameter.Denominator.AsSpan();
|
Span<float> denominatorSpan = parameter.Denominator.AsSpan();
|
||||||
|
|
||||||
float a0 = FixedPointHelper.ToFloat(numeratorSpan[0], FixedPointPrecisionForParameter);
|
float a0 = numeratorSpan[0];
|
||||||
float a1 = FixedPointHelper.ToFloat(numeratorSpan[1], FixedPointPrecisionForParameter);
|
float a1 = numeratorSpan[1];
|
||||||
float a2 = FixedPointHelper.ToFloat(numeratorSpan[2], FixedPointPrecisionForParameter);
|
float a2 = numeratorSpan[2];
|
||||||
|
|
||||||
float b1 = FixedPointHelper.ToFloat(denominatorSpan[0], FixedPointPrecisionForParameter);
|
float b1 = denominatorSpan[0];
|
||||||
float b2 = FixedPointHelper.ToFloat(denominatorSpan[1], FixedPointPrecisionForParameter);
|
float b2 = denominatorSpan[1];
|
||||||
|
|
||||||
for (int i = 0; i < sampleCount; i++)
|
for (int i = 0; i < sampleCount; i++)
|
||||||
{
|
{
|
||||||
@@ -204,8 +312,8 @@ namespace Ryujinx.Audio.Renderer.Dsp
|
|||||||
/// <param name="volume">Mix volume</param>
|
/// <param name="volume">Mix volume</param>
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static void ProcessDoubleBiquadFilterAndMix(
|
public static void ProcessDoubleBiquadFilterAndMix(
|
||||||
ref BiquadFilterParameter parameter0,
|
ref BiquadFilterParameter2 parameter0,
|
||||||
ref BiquadFilterParameter parameter1,
|
ref BiquadFilterParameter2 parameter1,
|
||||||
ref BiquadFilterState state0,
|
ref BiquadFilterState state0,
|
||||||
ref BiquadFilterState state1,
|
ref BiquadFilterState state1,
|
||||||
Span<float> outputBuffer,
|
Span<float> outputBuffer,
|
||||||
@@ -213,25 +321,25 @@ namespace Ryujinx.Audio.Renderer.Dsp
|
|||||||
uint sampleCount,
|
uint sampleCount,
|
||||||
float volume)
|
float volume)
|
||||||
{
|
{
|
||||||
Span<short> numerator0Span = parameter0.Numerator.AsSpan();
|
Span<float> numerator0Span = parameter0.Numerator.AsSpan();
|
||||||
Span<short> numerator1Span = parameter1.Numerator.AsSpan();
|
Span<float> numerator1Span = parameter1.Numerator.AsSpan();
|
||||||
Span<short> denominator0Span = parameter0.Denominator.AsSpan();
|
Span<float> denominator0Span = parameter0.Denominator.AsSpan();
|
||||||
Span<short> denominator1Span = parameter1.Denominator.AsSpan();
|
Span<float> denominator1Span = parameter1.Denominator.AsSpan();
|
||||||
|
|
||||||
|
|
||||||
float a00 = FixedPointHelper.ToFloat(numerator0Span[0], FixedPointPrecisionForParameter);
|
float a00 = numerator0Span[0];
|
||||||
float a10 = FixedPointHelper.ToFloat(numerator0Span[1], FixedPointPrecisionForParameter);
|
float a10 = numerator0Span[1];
|
||||||
float a20 = FixedPointHelper.ToFloat(numerator0Span[2], FixedPointPrecisionForParameter);
|
float a20 = numerator0Span[2];
|
||||||
|
|
||||||
float b10 = FixedPointHelper.ToFloat(denominator0Span[0], FixedPointPrecisionForParameter);
|
float b10 = denominator0Span[0];
|
||||||
float b20 = FixedPointHelper.ToFloat(denominator0Span[1], FixedPointPrecisionForParameter);
|
float b20 = denominator0Span[1];
|
||||||
|
|
||||||
float a01 = FixedPointHelper.ToFloat(numerator1Span[0], FixedPointPrecisionForParameter);
|
float a01 = numerator1Span[0];
|
||||||
float a11 = FixedPointHelper.ToFloat(numerator1Span[1], FixedPointPrecisionForParameter);
|
float a11 = numerator1Span[1];
|
||||||
float a21 = FixedPointHelper.ToFloat(numerator1Span[2], FixedPointPrecisionForParameter);
|
float a21 = numerator1Span[2];
|
||||||
|
|
||||||
float b11 = FixedPointHelper.ToFloat(denominator1Span[0], FixedPointPrecisionForParameter);
|
float b11 = denominator1Span[0];
|
||||||
float b21 = FixedPointHelper.ToFloat(denominator1Span[1], FixedPointPrecisionForParameter);
|
float b21 = denominator1Span[1];
|
||||||
|
|
||||||
for (int i = 0; i < sampleCount; i++)
|
for (int i = 0; i < sampleCount; i++)
|
||||||
{
|
{
|
||||||
@@ -269,8 +377,8 @@ namespace Ryujinx.Audio.Renderer.Dsp
|
|||||||
/// <returns>Last filtered sample value</returns>
|
/// <returns>Last filtered sample value</returns>
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static float ProcessDoubleBiquadFilterAndMixRamp(
|
public static float ProcessDoubleBiquadFilterAndMixRamp(
|
||||||
ref BiquadFilterParameter parameter0,
|
ref BiquadFilterParameter2 parameter0,
|
||||||
ref BiquadFilterParameter parameter1,
|
ref BiquadFilterParameter2 parameter1,
|
||||||
ref BiquadFilterState state0,
|
ref BiquadFilterState state0,
|
||||||
ref BiquadFilterState state1,
|
ref BiquadFilterState state1,
|
||||||
Span<float> outputBuffer,
|
Span<float> outputBuffer,
|
||||||
@@ -279,24 +387,24 @@ namespace Ryujinx.Audio.Renderer.Dsp
|
|||||||
float volume,
|
float volume,
|
||||||
float ramp)
|
float ramp)
|
||||||
{
|
{
|
||||||
Span<short> numerator0Span = parameter0.Numerator.AsSpan();
|
Span<float> numerator0Span = parameter0.Numerator.AsSpan();
|
||||||
Span<short> numerator1Span = parameter1.Numerator.AsSpan();
|
Span<float> numerator1Span = parameter1.Numerator.AsSpan();
|
||||||
Span<short> denominator0Span = parameter0.Denominator.AsSpan();
|
Span<float> denominator0Span = parameter0.Denominator.AsSpan();
|
||||||
Span<short> denominator1Span = parameter1.Denominator.AsSpan();
|
Span<float> denominator1Span = parameter1.Denominator.AsSpan();
|
||||||
|
|
||||||
float a00 = FixedPointHelper.ToFloat(numerator0Span[0], FixedPointPrecisionForParameter);
|
float a00 = numerator0Span[0];
|
||||||
float a10 = FixedPointHelper.ToFloat(numerator0Span[1], FixedPointPrecisionForParameter);
|
float a10 = numerator0Span[1];
|
||||||
float a20 = FixedPointHelper.ToFloat(numerator0Span[2], FixedPointPrecisionForParameter);
|
float a20 = numerator0Span[2];
|
||||||
|
|
||||||
float b10 = FixedPointHelper.ToFloat(denominator0Span[0], FixedPointPrecisionForParameter);
|
float b10 = denominator0Span[0];
|
||||||
float b20 = FixedPointHelper.ToFloat(denominator0Span[1], FixedPointPrecisionForParameter);
|
float b20 = denominator0Span[1];
|
||||||
|
|
||||||
float a01 = FixedPointHelper.ToFloat(numerator1Span[0], FixedPointPrecisionForParameter);
|
float a01 = numerator1Span[0];
|
||||||
float a11 = FixedPointHelper.ToFloat(numerator1Span[1], FixedPointPrecisionForParameter);
|
float a11 = numerator1Span[1];
|
||||||
float a21 = FixedPointHelper.ToFloat(numerator1Span[2], FixedPointPrecisionForParameter);
|
float a21 = numerator1Span[2];
|
||||||
|
|
||||||
float b11 = FixedPointHelper.ToFloat(denominator1Span[0], FixedPointPrecisionForParameter);
|
float b11 = denominator1Span[0];
|
||||||
float b21 = FixedPointHelper.ToFloat(denominator1Span[1], FixedPointPrecisionForParameter);
|
float b21 = denominator1Span[1];
|
||||||
|
|
||||||
float mixState = 0f;
|
float mixState = 0f;
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ using Ryujinx.Audio.Common;
|
|||||||
using Ryujinx.Audio.Renderer.Common;
|
using Ryujinx.Audio.Renderer.Common;
|
||||||
using Ryujinx.Audio.Renderer.Server.Voice;
|
using Ryujinx.Audio.Renderer.Server.Voice;
|
||||||
using System;
|
using System;
|
||||||
using static Ryujinx.Audio.Renderer.Parameter.VoiceInParameter;
|
using Ryujinx.Audio.Renderer.Parameter;
|
||||||
using WaveBuffer = Ryujinx.Audio.Renderer.Common.WaveBuffer;
|
using WaveBuffer = Ryujinx.Audio.Renderer.Common.WaveBuffer;
|
||||||
|
|
||||||
namespace Ryujinx.Audio.Renderer.Dsp.Command
|
namespace Ryujinx.Audio.Renderer.Dsp.Command
|
||||||
@@ -24,23 +24,23 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
|||||||
|
|
||||||
public WaveBuffer[] WaveBuffers { get; }
|
public WaveBuffer[] WaveBuffers { get; }
|
||||||
|
|
||||||
public Memory<VoiceUpdateState> State { get; }
|
public Memory<VoiceState> State { get; }
|
||||||
|
|
||||||
public ulong AdpcmParameter { get; }
|
public ulong AdpcmParameter { get; }
|
||||||
public ulong AdpcmParameterSize { get; }
|
public ulong AdpcmParameterSize { get; }
|
||||||
|
|
||||||
public DecodingBehaviour DecodingBehaviour { get; }
|
public DecodingBehaviour DecodingBehaviour { get; }
|
||||||
|
|
||||||
public AdpcmDataSourceCommandVersion1(ref VoiceState serverState, Memory<VoiceUpdateState> state, ushort outputBufferIndex, int nodeId)
|
public AdpcmDataSourceCommandVersion1(ref VoiceInfo serverInfo, Memory<VoiceState> state, ushort outputBufferIndex, int nodeId)
|
||||||
{
|
{
|
||||||
Enabled = true;
|
Enabled = true;
|
||||||
NodeId = nodeId;
|
NodeId = nodeId;
|
||||||
|
|
||||||
OutputBufferIndex = outputBufferIndex;
|
OutputBufferIndex = outputBufferIndex;
|
||||||
SampleRate = serverState.SampleRate;
|
SampleRate = serverInfo.SampleRate;
|
||||||
Pitch = serverState.Pitch;
|
Pitch = serverInfo.Pitch;
|
||||||
|
|
||||||
Span<Server.Voice.WaveBuffer> waveBufferSpan = serverState.WaveBuffers.AsSpan();
|
Span<Server.Voice.WaveBuffer> waveBufferSpan = serverInfo.WaveBuffers.AsSpan();
|
||||||
|
|
||||||
WaveBuffers = new WaveBuffer[Constants.VoiceWaveBufferCount];
|
WaveBuffers = new WaveBuffer[Constants.VoiceWaveBufferCount];
|
||||||
|
|
||||||
@@ -51,10 +51,10 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
|||||||
WaveBuffers[i] = voiceWaveBuffer.ToCommon(1);
|
WaveBuffers[i] = voiceWaveBuffer.ToCommon(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
AdpcmParameter = serverState.DataSourceStateAddressInfo.GetReference(true);
|
AdpcmParameter = serverInfo.DataSourceStateAddressInfo.GetReference(true);
|
||||||
AdpcmParameterSize = serverState.DataSourceStateAddressInfo.Size;
|
AdpcmParameterSize = serverInfo.DataSourceStateAddressInfo.Size;
|
||||||
State = state;
|
State = state;
|
||||||
DecodingBehaviour = serverState.DecodingBehaviour;
|
DecodingBehaviour = serverInfo.DecodingBehaviour;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Process(CommandList context)
|
public void Process(CommandList context)
|
||||||
|
|||||||
@@ -18,12 +18,12 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
|||||||
public ushort InputBufferIndex { get; }
|
public ushort InputBufferIndex { get; }
|
||||||
public ushort OutputBufferIndex { get; }
|
public ushort OutputBufferIndex { get; }
|
||||||
|
|
||||||
private BiquadFilterParameter _parameter;
|
private BiquadFilterParameter2 _parameter;
|
||||||
|
|
||||||
public Memory<BiquadFilterState> BiquadFilterState { get; }
|
public Memory<BiquadFilterState> BiquadFilterState { get; }
|
||||||
public Memory<BiquadFilterState> PreviousBiquadFilterState { get; }
|
public Memory<BiquadFilterState> PreviousBiquadFilterState { get; }
|
||||||
|
|
||||||
public Memory<VoiceUpdateState> State { get; }
|
public Memory<VoiceState> State { get; }
|
||||||
|
|
||||||
public int LastSampleIndex { get; }
|
public int LastSampleIndex { get; }
|
||||||
|
|
||||||
@@ -40,8 +40,8 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
|||||||
uint inputBufferIndex,
|
uint inputBufferIndex,
|
||||||
uint outputBufferIndex,
|
uint outputBufferIndex,
|
||||||
int lastSampleIndex,
|
int lastSampleIndex,
|
||||||
Memory<VoiceUpdateState> state,
|
Memory<VoiceState> state,
|
||||||
ref BiquadFilterParameter filter,
|
ref BiquadFilterParameter2 filter,
|
||||||
Memory<BiquadFilterState> biquadFilterState,
|
Memory<BiquadFilterState> biquadFilterState,
|
||||||
Memory<BiquadFilterState> previousBiquadFilterState,
|
Memory<BiquadFilterState> previousBiquadFilterState,
|
||||||
bool needInitialization,
|
bool needInitialization,
|
||||||
|
|||||||
@@ -19,11 +19,11 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
|||||||
public int OutputBufferIndex { get; }
|
public int OutputBufferIndex { get; }
|
||||||
public bool NeedInitialization { get; }
|
public bool NeedInitialization { get; }
|
||||||
|
|
||||||
private BiquadFilterParameter _parameter;
|
private BiquadFilterParameter2 _parameter;
|
||||||
|
|
||||||
public BiquadFilterCommand(
|
public BiquadFilterCommand(
|
||||||
int baseIndex,
|
int baseIndex,
|
||||||
ref BiquadFilterParameter filter,
|
ref BiquadFilterParameter2 filter,
|
||||||
Memory<BiquadFilterState> biquadFilterStateMemory,
|
Memory<BiquadFilterState> biquadFilterStateMemory,
|
||||||
int inputBufferOffset,
|
int inputBufferOffset,
|
||||||
int outputBufferOffset,
|
int outputBufferOffset,
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
|||||||
{
|
{
|
||||||
startTime = PerformanceCounter.ElapsedNanoseconds;
|
startTime = PerformanceCounter.ElapsedNanoseconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
command.Process(this);
|
command.Process(this);
|
||||||
|
|
||||||
if (shouldMeter)
|
if (shouldMeter)
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
|||||||
Volume,
|
Volume,
|
||||||
VolumeRamp,
|
VolumeRamp,
|
||||||
BiquadFilter,
|
BiquadFilter,
|
||||||
|
BiquadFilterFloatCoeff, // new
|
||||||
Mix,
|
Mix,
|
||||||
MixRamp,
|
MixRamp,
|
||||||
MixRampGrouped,
|
MixRampGrouped,
|
||||||
@@ -31,9 +32,17 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
|||||||
LimiterVersion1,
|
LimiterVersion1,
|
||||||
LimiterVersion2,
|
LimiterVersion2,
|
||||||
MultiTapBiquadFilter,
|
MultiTapBiquadFilter,
|
||||||
|
MultiTapBiquadFilterFloatCoeff, // new
|
||||||
CaptureBuffer,
|
CaptureBuffer,
|
||||||
Compressor,
|
Compressor,
|
||||||
BiquadFilterAndMix,
|
BiquadFilterAndMix,
|
||||||
|
BiquadFilterAndMixFloatCoeff, // new
|
||||||
MultiTapBiquadFilterAndMix,
|
MultiTapBiquadFilterAndMix,
|
||||||
|
MultiTapBiquadFilterAndMixFloatCoef, // new
|
||||||
|
AuxiliaryBufferGrouped, // new
|
||||||
|
FillMixBuffer, // new
|
||||||
|
BiquadFilterCrossFade, // new
|
||||||
|
MultiTapBiquadFilterCrossFade, // new
|
||||||
|
FillBuffer, // new
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ using Ryujinx.Audio.Common;
|
|||||||
using Ryujinx.Audio.Renderer.Common;
|
using Ryujinx.Audio.Renderer.Common;
|
||||||
using Ryujinx.Audio.Renderer.Server.Voice;
|
using Ryujinx.Audio.Renderer.Server.Voice;
|
||||||
using System;
|
using System;
|
||||||
using static Ryujinx.Audio.Renderer.Parameter.VoiceInParameter;
|
using Ryujinx.Audio.Renderer.Parameter;
|
||||||
using WaveBuffer = Ryujinx.Audio.Renderer.Common.WaveBuffer;
|
using WaveBuffer = Ryujinx.Audio.Renderer.Common.WaveBuffer;
|
||||||
|
|
||||||
namespace Ryujinx.Audio.Renderer.Dsp.Command
|
namespace Ryujinx.Audio.Renderer.Dsp.Command
|
||||||
@@ -24,7 +24,7 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
|||||||
|
|
||||||
public WaveBuffer[] WaveBuffers { get; }
|
public WaveBuffer[] WaveBuffers { get; }
|
||||||
|
|
||||||
public Memory<VoiceUpdateState> State { get; }
|
public Memory<VoiceState> State { get; }
|
||||||
|
|
||||||
public ulong ExtraParameter { get; }
|
public ulong ExtraParameter { get; }
|
||||||
public ulong ExtraParameterSize { get; }
|
public ulong ExtraParameterSize { get; }
|
||||||
@@ -39,21 +39,21 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
|||||||
|
|
||||||
public SampleRateConversionQuality SrcQuality { get; }
|
public SampleRateConversionQuality SrcQuality { get; }
|
||||||
|
|
||||||
public DataSourceVersion2Command(ref VoiceState serverState, Memory<VoiceUpdateState> state, ushort outputBufferIndex, ushort channelIndex, int nodeId)
|
public DataSourceVersion2Command(ref VoiceInfo serverInfo, Memory<VoiceState> state, ushort outputBufferIndex, ushort channelIndex, int nodeId)
|
||||||
{
|
{
|
||||||
Enabled = true;
|
Enabled = true;
|
||||||
NodeId = nodeId;
|
NodeId = nodeId;
|
||||||
ChannelIndex = channelIndex;
|
ChannelIndex = channelIndex;
|
||||||
ChannelCount = serverState.ChannelsCount;
|
ChannelCount = serverInfo.ChannelsCount;
|
||||||
SampleFormat = serverState.SampleFormat;
|
SampleFormat = serverInfo.SampleFormat;
|
||||||
SrcQuality = serverState.SrcQuality;
|
SrcQuality = serverInfo.SrcQuality;
|
||||||
CommandType = GetCommandTypeBySampleFormat(SampleFormat);
|
CommandType = GetCommandTypeBySampleFormat(SampleFormat);
|
||||||
|
|
||||||
OutputBufferIndex = (ushort)(channelIndex + outputBufferIndex);
|
OutputBufferIndex = (ushort)(channelIndex + outputBufferIndex);
|
||||||
SampleRate = serverState.SampleRate;
|
SampleRate = serverInfo.SampleRate;
|
||||||
Pitch = serverState.Pitch;
|
Pitch = serverInfo.Pitch;
|
||||||
|
|
||||||
Span<Server.Voice.WaveBuffer> waveBufferSpan = serverState.WaveBuffers.AsSpan();
|
Span<Server.Voice.WaveBuffer> waveBufferSpan = serverInfo.WaveBuffers.AsSpan();
|
||||||
|
|
||||||
WaveBuffers = new WaveBuffer[Constants.VoiceWaveBufferCount];
|
WaveBuffers = new WaveBuffer[Constants.VoiceWaveBufferCount];
|
||||||
|
|
||||||
@@ -66,12 +66,12 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
|||||||
|
|
||||||
if (SampleFormat == SampleFormat.Adpcm)
|
if (SampleFormat == SampleFormat.Adpcm)
|
||||||
{
|
{
|
||||||
ExtraParameter = serverState.DataSourceStateAddressInfo.GetReference(true);
|
ExtraParameter = serverInfo.DataSourceStateAddressInfo.GetReference(true);
|
||||||
ExtraParameterSize = serverState.DataSourceStateAddressInfo.Size;
|
ExtraParameterSize = serverInfo.DataSourceStateAddressInfo.Size;
|
||||||
}
|
}
|
||||||
|
|
||||||
State = state;
|
State = state;
|
||||||
DecodingBehaviour = serverState.DecodingBehaviour;
|
DecodingBehaviour = serverInfo.DecodingBehaviour;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static CommandType GetCommandTypeBySampleFormat(SampleFormat sampleFormat)
|
private static CommandType GetCommandTypeBySampleFormat(SampleFormat sampleFormat)
|
||||||
|
|||||||
@@ -17,10 +17,10 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
|||||||
|
|
||||||
public ushort[] OutputBufferIndices { get; }
|
public ushort[] OutputBufferIndices { get; }
|
||||||
|
|
||||||
public Memory<VoiceUpdateState> State { get; }
|
public Memory<VoiceState> State { get; }
|
||||||
public Memory<float> DepopBuffer { get; }
|
public Memory<float> DepopBuffer { get; }
|
||||||
|
|
||||||
public DepopPrepareCommand(Memory<VoiceUpdateState> state, Memory<float> depopBuffer, uint mixBufferCount, uint bufferOffset, int nodeId, bool enabled)
|
public DepopPrepareCommand(Memory<VoiceState> state, Memory<float> depopBuffer, uint mixBufferCount, uint bufferOffset, int nodeId, bool enabled)
|
||||||
{
|
{
|
||||||
Enabled = enabled;
|
Enabled = enabled;
|
||||||
NodeId = nodeId;
|
NodeId = nodeId;
|
||||||
@@ -39,7 +39,7 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
|||||||
|
|
||||||
public void Process(CommandList context)
|
public void Process(CommandList context)
|
||||||
{
|
{
|
||||||
ref VoiceUpdateState state = ref State.Span[0];
|
ref VoiceState state = ref State.Span[0];
|
||||||
|
|
||||||
Span<float> depopBuffer = DepopBuffer.Span;
|
Span<float> depopBuffer = DepopBuffer.Span;
|
||||||
Span<float> lastSamplesSpan = state.LastSamples.AsSpan();
|
Span<float> lastSamplesSpan = state.LastSamples.AsSpan();
|
||||||
|
|||||||
@@ -42,9 +42,9 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
|||||||
InputBufferIndices[i] = (ushort)(bufferOffset + inputSpan[i]);
|
InputBufferIndices[i] = (ushort)(bufferOffset + inputSpan[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sink.UpsamplerState != null)
|
if (sink.UpsamplerInfo != null)
|
||||||
{
|
{
|
||||||
Buffers = sink.UpsamplerState.OutputBuffer;
|
Buffers = sink.UpsamplerInfo.OutputBuffer;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
69
src/Ryujinx.Audio/Renderer/Dsp/Command/FillBufferCommand.cs
Normal file
69
src/Ryujinx.Audio/Renderer/Dsp/Command/FillBufferCommand.cs
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
using Ryujinx.Audio.Renderer.Server.Splitter;
|
||||||
|
using System;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
|
namespace Ryujinx.Audio.Renderer.Dsp.Command
|
||||||
|
{
|
||||||
|
public class FillBufferCommand : ICommand
|
||||||
|
{
|
||||||
|
public bool Enabled { get; set; }
|
||||||
|
|
||||||
|
public int NodeId { get; }
|
||||||
|
|
||||||
|
public CommandType CommandType => CommandType.FillBuffer;
|
||||||
|
|
||||||
|
public uint EstimatedProcessingTime { get; set; }
|
||||||
|
|
||||||
|
public SplitterDestinationVersion1 Destination1 { get; }
|
||||||
|
public SplitterDestinationVersion2 Destination2 { get; }
|
||||||
|
public bool IsV2 { get; }
|
||||||
|
public int Length { get; }
|
||||||
|
public float Value { get; }
|
||||||
|
|
||||||
|
public FillBufferCommand(SplitterDestinationVersion1 destination, int length, float value, int nodeId)
|
||||||
|
{
|
||||||
|
Enabled = true;
|
||||||
|
NodeId = nodeId;
|
||||||
|
|
||||||
|
Destination1 = destination;
|
||||||
|
IsV2 = false;
|
||||||
|
Length = length;
|
||||||
|
Value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FillBufferCommand(SplitterDestinationVersion2 destination, int length, float value, int nodeId)
|
||||||
|
{
|
||||||
|
Enabled = true;
|
||||||
|
NodeId = nodeId;
|
||||||
|
|
||||||
|
Destination2 = destination;
|
||||||
|
IsV2 = true;
|
||||||
|
Length = length;
|
||||||
|
Value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
private void ProcessFillBuffer()
|
||||||
|
{
|
||||||
|
if (IsV2)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < Length; i++)
|
||||||
|
{
|
||||||
|
Destination2.PreviousMixBufferVolume[i] = Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (int i = 0; i < Length; i++)
|
||||||
|
{
|
||||||
|
Destination1.PreviousMixBufferVolume[i] = Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Process(CommandList context)
|
||||||
|
{
|
||||||
|
ProcessFillBuffer();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -20,11 +20,11 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
|||||||
public float Volume0 { get; }
|
public float Volume0 { get; }
|
||||||
public float Volume1 { get; }
|
public float Volume1 { get; }
|
||||||
|
|
||||||
public Memory<VoiceUpdateState> State { get; }
|
public Memory<VoiceState> State { get; }
|
||||||
|
|
||||||
public int LastSampleIndex { get; }
|
public int LastSampleIndex { get; }
|
||||||
|
|
||||||
public MixRampCommand(float volume0, float volume1, uint inputBufferIndex, uint outputBufferIndex, int lastSampleIndex, Memory<VoiceUpdateState> state, int nodeId)
|
public MixRampCommand(float volume0, float volume1, uint inputBufferIndex, uint outputBufferIndex, int lastSampleIndex, Memory<VoiceState> state, int nodeId)
|
||||||
{
|
{
|
||||||
Enabled = true;
|
Enabled = true;
|
||||||
NodeId = nodeId;
|
NodeId = nodeId;
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
|||||||
public float[] Volume0 { get; }
|
public float[] Volume0 { get; }
|
||||||
public float[] Volume1 { get; }
|
public float[] Volume1 { get; }
|
||||||
|
|
||||||
public Memory<VoiceUpdateState> State { get; }
|
public Memory<VoiceState> State { get; }
|
||||||
|
|
||||||
public MixRampGroupedCommand(
|
public MixRampGroupedCommand(
|
||||||
uint mixBufferCount,
|
uint mixBufferCount,
|
||||||
@@ -30,7 +30,7 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
|||||||
uint outputBufferIndex,
|
uint outputBufferIndex,
|
||||||
ReadOnlySpan<float> volume0,
|
ReadOnlySpan<float> volume0,
|
||||||
ReadOnlySpan<float> volume1,
|
ReadOnlySpan<float> volume1,
|
||||||
Memory<VoiceUpdateState> state,
|
Memory<VoiceState> state,
|
||||||
int nodeId)
|
int nodeId)
|
||||||
{
|
{
|
||||||
Enabled = true;
|
Enabled = true;
|
||||||
@@ -79,7 +79,7 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
|||||||
|
|
||||||
public void Process(CommandList context)
|
public void Process(CommandList context)
|
||||||
{
|
{
|
||||||
ref VoiceUpdateState state = ref State.Span[0];
|
ref VoiceState state = ref State.Span[0];
|
||||||
|
|
||||||
Span<float> lastSamplesSpan = state.LastSamples.AsSpan();
|
Span<float> lastSamplesSpan = state.LastSamples.AsSpan();
|
||||||
|
|
||||||
|
|||||||
@@ -18,15 +18,15 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
|||||||
public ushort InputBufferIndex { get; }
|
public ushort InputBufferIndex { get; }
|
||||||
public ushort OutputBufferIndex { get; }
|
public ushort OutputBufferIndex { get; }
|
||||||
|
|
||||||
private BiquadFilterParameter _parameter0;
|
private BiquadFilterParameter2 _parameter0;
|
||||||
private BiquadFilterParameter _parameter1;
|
private BiquadFilterParameter2 _parameter1;
|
||||||
|
|
||||||
public Memory<BiquadFilterState> BiquadFilterState0 { get; }
|
public Memory<BiquadFilterState> BiquadFilterState0 { get; }
|
||||||
public Memory<BiquadFilterState> BiquadFilterState1 { get; }
|
public Memory<BiquadFilterState> BiquadFilterState1 { get; }
|
||||||
public Memory<BiquadFilterState> PreviousBiquadFilterState0 { get; }
|
public Memory<BiquadFilterState> PreviousBiquadFilterState0 { get; }
|
||||||
public Memory<BiquadFilterState> PreviousBiquadFilterState1 { get; }
|
public Memory<BiquadFilterState> PreviousBiquadFilterState1 { get; }
|
||||||
|
|
||||||
public Memory<VoiceUpdateState> State { get; }
|
public Memory<VoiceState> State { get; }
|
||||||
|
|
||||||
public int LastSampleIndex { get; }
|
public int LastSampleIndex { get; }
|
||||||
|
|
||||||
@@ -44,9 +44,9 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
|||||||
uint inputBufferIndex,
|
uint inputBufferIndex,
|
||||||
uint outputBufferIndex,
|
uint outputBufferIndex,
|
||||||
int lastSampleIndex,
|
int lastSampleIndex,
|
||||||
Memory<VoiceUpdateState> state,
|
Memory<VoiceState> state,
|
||||||
ref BiquadFilterParameter filter0,
|
ref BiquadFilterParameter2 filter0,
|
||||||
ref BiquadFilterParameter filter1,
|
ref BiquadFilterParameter2 filter1,
|
||||||
Memory<BiquadFilterState> biquadFilterState0,
|
Memory<BiquadFilterState> biquadFilterState0,
|
||||||
Memory<BiquadFilterState> biquadFilterState1,
|
Memory<BiquadFilterState> biquadFilterState1,
|
||||||
Memory<BiquadFilterState> previousBiquadFilterState0,
|
Memory<BiquadFilterState> previousBiquadFilterState0,
|
||||||
|
|||||||
@@ -14,13 +14,13 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
|||||||
|
|
||||||
public uint EstimatedProcessingTime { get; set; }
|
public uint EstimatedProcessingTime { get; set; }
|
||||||
|
|
||||||
private readonly BiquadFilterParameter[] _parameters;
|
private readonly BiquadFilterParameter2[] _parameters;
|
||||||
private readonly Memory<BiquadFilterState> _biquadFilterStates;
|
private readonly Memory<BiquadFilterState> _biquadFilterStates;
|
||||||
private readonly int _inputBufferIndex;
|
private readonly int _inputBufferIndex;
|
||||||
private readonly int _outputBufferIndex;
|
private readonly int _outputBufferIndex;
|
||||||
private readonly bool[] _isInitialized;
|
private readonly bool[] _isInitialized;
|
||||||
|
|
||||||
public MultiTapBiquadFilterCommand(int baseIndex, ReadOnlySpan<BiquadFilterParameter> filters, Memory<BiquadFilterState> biquadFilterStateMemory, int inputBufferOffset, int outputBufferOffset, ReadOnlySpan<bool> isInitialized, int nodeId)
|
public MultiTapBiquadFilterCommand(int baseIndex, ReadOnlySpan<BiquadFilterParameter2> filters, Memory<BiquadFilterState> biquadFilterStateMemory, int inputBufferOffset, int outputBufferOffset, ReadOnlySpan<bool> isInitialized, int nodeId)
|
||||||
{
|
{
|
||||||
_parameters = filters.ToArray();
|
_parameters = filters.ToArray();
|
||||||
_biquadFilterStates = biquadFilterStateMemory;
|
_biquadFilterStates = biquadFilterStateMemory;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ using Ryujinx.Audio.Common;
|
|||||||
using Ryujinx.Audio.Renderer.Common;
|
using Ryujinx.Audio.Renderer.Common;
|
||||||
using Ryujinx.Audio.Renderer.Server.Voice;
|
using Ryujinx.Audio.Renderer.Server.Voice;
|
||||||
using System;
|
using System;
|
||||||
using static Ryujinx.Audio.Renderer.Parameter.VoiceInParameter;
|
using Ryujinx.Audio.Renderer.Parameter;
|
||||||
using WaveBuffer = Ryujinx.Audio.Renderer.Common.WaveBuffer;
|
using WaveBuffer = Ryujinx.Audio.Renderer.Common.WaveBuffer;
|
||||||
|
|
||||||
namespace Ryujinx.Audio.Renderer.Dsp.Command
|
namespace Ryujinx.Audio.Renderer.Dsp.Command
|
||||||
@@ -27,23 +27,23 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
|||||||
|
|
||||||
public WaveBuffer[] WaveBuffers { get; }
|
public WaveBuffer[] WaveBuffers { get; }
|
||||||
|
|
||||||
public Memory<VoiceUpdateState> State { get; }
|
public Memory<VoiceState> State { get; }
|
||||||
public DecodingBehaviour DecodingBehaviour { get; }
|
public DecodingBehaviour DecodingBehaviour { get; }
|
||||||
|
|
||||||
public PcmFloatDataSourceCommandVersion1(ref VoiceState serverState, Memory<VoiceUpdateState> state, ushort outputBufferIndex, ushort channelIndex, int nodeId)
|
public PcmFloatDataSourceCommandVersion1(ref VoiceInfo serverInfo, Memory<VoiceState> state, ushort outputBufferIndex, ushort channelIndex, int nodeId)
|
||||||
{
|
{
|
||||||
Enabled = true;
|
Enabled = true;
|
||||||
NodeId = nodeId;
|
NodeId = nodeId;
|
||||||
|
|
||||||
OutputBufferIndex = (ushort)(channelIndex + outputBufferIndex);
|
OutputBufferIndex = (ushort)(channelIndex + outputBufferIndex);
|
||||||
SampleRate = serverState.SampleRate;
|
SampleRate = serverInfo.SampleRate;
|
||||||
ChannelIndex = channelIndex;
|
ChannelIndex = channelIndex;
|
||||||
ChannelCount = serverState.ChannelsCount;
|
ChannelCount = serverInfo.ChannelsCount;
|
||||||
Pitch = serverState.Pitch;
|
Pitch = serverInfo.Pitch;
|
||||||
|
|
||||||
WaveBuffers = new WaveBuffer[Constants.VoiceWaveBufferCount];
|
WaveBuffers = new WaveBuffer[Constants.VoiceWaveBufferCount];
|
||||||
|
|
||||||
Span<Server.Voice.WaveBuffer> waveBufferSpan = serverState.WaveBuffers.AsSpan();
|
Span<Server.Voice.WaveBuffer> waveBufferSpan = serverInfo.WaveBuffers.AsSpan();
|
||||||
|
|
||||||
for (int i = 0; i < WaveBuffers.Length; i++)
|
for (int i = 0; i < WaveBuffers.Length; i++)
|
||||||
{
|
{
|
||||||
@@ -53,7 +53,7 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
State = state;
|
State = state;
|
||||||
DecodingBehaviour = serverState.DecodingBehaviour;
|
DecodingBehaviour = serverInfo.DecodingBehaviour;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Process(CommandList context)
|
public void Process(CommandList context)
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ using Ryujinx.Audio.Common;
|
|||||||
using Ryujinx.Audio.Renderer.Common;
|
using Ryujinx.Audio.Renderer.Common;
|
||||||
using Ryujinx.Audio.Renderer.Server.Voice;
|
using Ryujinx.Audio.Renderer.Server.Voice;
|
||||||
using System;
|
using System;
|
||||||
using static Ryujinx.Audio.Renderer.Parameter.VoiceInParameter;
|
using Ryujinx.Audio.Renderer.Parameter;
|
||||||
using WaveBuffer = Ryujinx.Audio.Renderer.Common.WaveBuffer;
|
using WaveBuffer = Ryujinx.Audio.Renderer.Common.WaveBuffer;
|
||||||
|
|
||||||
namespace Ryujinx.Audio.Renderer.Dsp.Command
|
namespace Ryujinx.Audio.Renderer.Dsp.Command
|
||||||
@@ -27,23 +27,23 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
|||||||
|
|
||||||
public WaveBuffer[] WaveBuffers { get; }
|
public WaveBuffer[] WaveBuffers { get; }
|
||||||
|
|
||||||
public Memory<VoiceUpdateState> State { get; }
|
public Memory<VoiceState> State { get; }
|
||||||
public DecodingBehaviour DecodingBehaviour { get; }
|
public DecodingBehaviour DecodingBehaviour { get; }
|
||||||
|
|
||||||
public PcmInt16DataSourceCommandVersion1(ref VoiceState serverState, Memory<VoiceUpdateState> state, ushort outputBufferIndex, ushort channelIndex, int nodeId)
|
public PcmInt16DataSourceCommandVersion1(ref VoiceInfo serverInfo, Memory<VoiceState> state, ushort outputBufferIndex, ushort channelIndex, int nodeId)
|
||||||
{
|
{
|
||||||
Enabled = true;
|
Enabled = true;
|
||||||
NodeId = nodeId;
|
NodeId = nodeId;
|
||||||
|
|
||||||
OutputBufferIndex = (ushort)(channelIndex + outputBufferIndex);
|
OutputBufferIndex = (ushort)(channelIndex + outputBufferIndex);
|
||||||
SampleRate = serverState.SampleRate;
|
SampleRate = serverInfo.SampleRate;
|
||||||
ChannelIndex = channelIndex;
|
ChannelIndex = channelIndex;
|
||||||
ChannelCount = serverState.ChannelsCount;
|
ChannelCount = serverInfo.ChannelsCount;
|
||||||
Pitch = serverState.Pitch;
|
Pitch = serverInfo.Pitch;
|
||||||
|
|
||||||
WaveBuffers = new WaveBuffer[Constants.VoiceWaveBufferCount];
|
WaveBuffers = new WaveBuffer[Constants.VoiceWaveBufferCount];
|
||||||
|
|
||||||
Span<Server.Voice.WaveBuffer> waveBufferSpan = serverState.WaveBuffers.AsSpan();
|
Span<Server.Voice.WaveBuffer> waveBufferSpan = serverInfo.WaveBuffers.AsSpan();
|
||||||
|
|
||||||
for (int i = 0; i < WaveBuffers.Length; i++)
|
for (int i = 0; i < WaveBuffers.Length; i++)
|
||||||
{
|
{
|
||||||
@@ -53,7 +53,7 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
State = state;
|
State = state;
|
||||||
DecodingBehaviour = serverState.DecodingBehaviour;
|
DecodingBehaviour = serverInfo.DecodingBehaviour;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Process(CommandList context)
|
public void Process(CommandList context)
|
||||||
|
|||||||
@@ -18,11 +18,11 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
|
|||||||
public uint InputSampleCount { get; }
|
public uint InputSampleCount { get; }
|
||||||
public uint InputSampleRate { get; }
|
public uint InputSampleRate { get; }
|
||||||
|
|
||||||
public UpsamplerState UpsamplerInfo { get; }
|
public UpsamplerInfo UpsamplerInfo { get; }
|
||||||
|
|
||||||
public Memory<float> OutBuffer { get; }
|
public Memory<float> OutBuffer { get; }
|
||||||
|
|
||||||
public UpsampleCommand(uint bufferOffset, UpsamplerState info, uint inputCount, Span<byte> inputBufferOffset, uint bufferCount, uint sampleCount, uint sampleRate, int nodeId)
|
public UpsampleCommand(uint bufferOffset, UpsamplerInfo info, uint inputCount, Span<byte> inputBufferOffset, uint bufferCount, uint sampleCount, uint sampleRate, int nodeId)
|
||||||
{
|
{
|
||||||
Enabled = true;
|
Enabled = true;
|
||||||
NodeId = nodeId;
|
NodeId = nodeId;
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
|
|||||||
using System.Runtime.Intrinsics;
|
using System.Runtime.Intrinsics;
|
||||||
using System.Runtime.Intrinsics.Arm;
|
using System.Runtime.Intrinsics.Arm;
|
||||||
using System.Runtime.Intrinsics.X86;
|
using System.Runtime.Intrinsics.X86;
|
||||||
using static Ryujinx.Audio.Renderer.Parameter.VoiceInParameter;
|
using Ryujinx.Audio.Renderer.Parameter;
|
||||||
|
|
||||||
namespace Ryujinx.Audio.Renderer.Dsp
|
namespace Ryujinx.Audio.Renderer.Dsp
|
||||||
{
|
{
|
||||||
@@ -42,7 +42,7 @@ 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)
|
public static void ProcessWaveBuffers(IVirtualMemoryManager memoryManager, Span<float> outputBuffer, ref WaveBufferInformation info, Span<WaveBuffer> wavebuffers, ref VoiceState voiceState, uint targetSampleRate, int sampleCount)
|
||||||
{
|
{
|
||||||
const int TempBufferSize = 0x3F00;
|
const int TempBufferSize = 0x3F00;
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ using System.Linq;
|
|||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Runtime.Intrinsics;
|
using System.Runtime.Intrinsics;
|
||||||
using System.Runtime.Intrinsics.X86;
|
using System.Runtime.Intrinsics.X86;
|
||||||
using static Ryujinx.Audio.Renderer.Parameter.VoiceInParameter;
|
using Ryujinx.Audio.Renderer.Parameter;
|
||||||
|
|
||||||
namespace Ryujinx.Audio.Renderer.Dsp
|
namespace Ryujinx.Audio.Renderer.Dsp
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using Ryujinx.Audio.Renderer.Server;
|
||||||
using Ryujinx.Audio.Renderer.Server.Types;
|
using Ryujinx.Audio.Renderer.Server.Types;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
@@ -93,7 +94,7 @@ namespace Ryujinx.Audio.Renderer.Parameter
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The user audio revision
|
/// The user audio revision
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <seealso cref="Server.BehaviourContext"/>
|
/// <seealso cref="BehaviourInfo"/>
|
||||||
public int Revision;
|
public int Revision;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ namespace Ryujinx.Audio.Renderer.Parameter
|
|||||||
/// Biquad filter parameters.
|
/// Biquad filter parameters.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[StructLayout(LayoutKind.Sequential, Size = 0xC, Pack = 1)]
|
[StructLayout(LayoutKind.Sequential, Size = 0xC, Pack = 1)]
|
||||||
public struct BiquadFilterParameter
|
public struct BiquadFilterParameter1
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Set to true if the biquad filter is active.
|
/// Set to true if the biquad filter is active.
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
using Ryujinx.Common.Memory;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace Ryujinx.Audio.Renderer.Parameter
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Biquad filter parameters.
|
||||||
|
/// </summary>
|
||||||
|
[StructLayout(LayoutKind.Sequential, Size = 0x18, Pack = 1)]
|
||||||
|
public struct BiquadFilterParameter2
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Set to true if the biquad filter is active.
|
||||||
|
/// </summary>
|
||||||
|
[MarshalAs(UnmanagedType.I1)]
|
||||||
|
public bool Enable;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Reserved/padding.
|
||||||
|
/// </summary>
|
||||||
|
private readonly byte _reserved1;
|
||||||
|
private readonly byte _reserved2;
|
||||||
|
private readonly byte _reserved3;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Biquad filter numerator (b0, b1, b2).
|
||||||
|
/// </summary>
|
||||||
|
public Array3<float> Numerator;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Biquad filter denominator (a1, a2).
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>a0 = 1</remarks>
|
||||||
|
public Array2<float> Denominator;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,7 +8,7 @@ namespace Ryujinx.Audio.Renderer.Parameter.Effect
|
|||||||
/// <see cref="IEffectInParameter.SpecificData"/> for <see cref="Common.EffectType.BiquadFilter"/>.
|
/// <see cref="IEffectInParameter.SpecificData"/> for <see cref="Common.EffectType.BiquadFilter"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||||
public struct BiquadFilterEffectParameter
|
public struct BiquadFilterEffectParameter1
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The input channel indices that will be used by the <see cref="Dsp.AudioProcessor"/>.
|
/// The input channel indices that will be used by the <see cref="Dsp.AudioProcessor"/>.
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
using Ryujinx.Audio.Renderer.Server.Effect;
|
||||||
|
using Ryujinx.Common.Memory;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace Ryujinx.Audio.Renderer.Parameter.Effect
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// <see cref="IEffectInParameter.SpecificData"/> for <see cref="Common.EffectType.BiquadFilter"/>.
|
||||||
|
/// </summary>
|
||||||
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||||
|
public struct BiquadFilterEffectParameter2
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The input channel indices that will be used by the <see cref="Dsp.AudioProcessor"/>.
|
||||||
|
/// </summary>
|
||||||
|
public Array6<byte> Input;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The output channel indices that will be used by the <see cref="Dsp.AudioProcessor"/>.
|
||||||
|
/// </summary>
|
||||||
|
public Array6<byte> Output;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Biquad filter numerator (b0, b1, b2).
|
||||||
|
/// </summary>
|
||||||
|
public Array3<float> Numerator;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Biquad filter denominator (a1, a2).
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>a0 = 1</remarks>
|
||||||
|
public Array2<float> Denominator;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The total channel count used.
|
||||||
|
/// </summary>
|
||||||
|
public byte ChannelCount;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The current usage status of the effect on the client side.
|
||||||
|
/// </summary>
|
||||||
|
public UsageState Status;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Reserved/unused.
|
||||||
|
/// </summary>
|
||||||
|
private readonly ushort _reserved;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,97 @@
|
|||||||
|
using Ryujinx.Audio.Renderer.Common;
|
||||||
|
using Ryujinx.Common.Utilities;
|
||||||
|
using System;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace Ryujinx.Audio.Renderer.Parameter
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Input information for an effect version 2. (added with REV9)
|
||||||
|
/// </summary>
|
||||||
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||||
|
public struct EffectInParameterVersion3 : IEffectInParameter
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Type of the effect.
|
||||||
|
/// </summary>
|
||||||
|
public EffectType Type;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Set to true if the effect is new.
|
||||||
|
/// </summary>
|
||||||
|
[MarshalAs(UnmanagedType.I1)]
|
||||||
|
public bool IsNew;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Set to true if the effect must be active.
|
||||||
|
/// </summary>
|
||||||
|
[MarshalAs(UnmanagedType.I1)]
|
||||||
|
public bool IsEnabled;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Reserved/padding.
|
||||||
|
/// </summary>
|
||||||
|
private readonly byte _reserved1;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The target mix id of the effect.
|
||||||
|
/// </summary>
|
||||||
|
public int MixId;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Address of the processing workbuffer.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>This is additional data that could be required by the effect processing.</remarks>
|
||||||
|
public ulong BufferBase;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Size of the processing workbuffer.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>This is additional data that could be required by the effect processing.</remarks>
|
||||||
|
public ulong BufferSize;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Position of the effect while processing effects.
|
||||||
|
/// </summary>
|
||||||
|
public uint ProcessingOrder;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Reserved/padding.
|
||||||
|
/// </summary>
|
||||||
|
private readonly uint _reserved2;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Specific data storage.
|
||||||
|
/// </summary>
|
||||||
|
private SpecificDataStruct _specificDataStart;
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential, Size = 0xA0, Pack = 1)]
|
||||||
|
private struct SpecificDataStruct { }
|
||||||
|
|
||||||
|
public Span<byte> SpecificData => SpanHelpers.AsSpan<SpecificDataStruct, byte>(ref _specificDataStart);
|
||||||
|
|
||||||
|
readonly EffectType IEffectInParameter.Type => Type;
|
||||||
|
|
||||||
|
readonly bool IEffectInParameter.IsNew => IsNew;
|
||||||
|
|
||||||
|
readonly bool IEffectInParameter.IsEnabled => IsEnabled;
|
||||||
|
|
||||||
|
readonly int IEffectInParameter.MixId => MixId;
|
||||||
|
|
||||||
|
readonly ulong IEffectInParameter.BufferBase => BufferBase;
|
||||||
|
|
||||||
|
readonly ulong IEffectInParameter.BufferSize => BufferSize;
|
||||||
|
|
||||||
|
readonly uint IEffectInParameter.ProcessingOrder => ProcessingOrder;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Check if the given channel count is valid.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="channelCount">The channel count to check</param>
|
||||||
|
/// <returns>Returns true if the channel count is valid.</returns>
|
||||||
|
public static bool IsChannelCountValid(int channelCount)
|
||||||
|
{
|
||||||
|
return channelCount is 1 or 2 or 4 or 6;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,11 +17,11 @@ namespace Ryujinx.Audio.Renderer.Parameter
|
|||||||
/// The mix to output the result of the splitter.
|
/// The mix to output the result of the splitter.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
int DestinationId { get; }
|
int DestinationId { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Biquad filter parameters.
|
/// Biquad filter parameters.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Array2<BiquadFilterParameter> BiquadFilters { get; }
|
Array2<BiquadFilterParameter2> BiquadFilters2 { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Set to true if in use.
|
/// Set to true if in use.
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ namespace Ryujinx.Audio.Renderer.Parameter
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reserved/padding.
|
/// Reserved/padding.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly ushort _reserved1;
|
private readonly ushort _magic; // 0xCAFE
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The node id of the sink.
|
/// The node id of the sink.
|
||||||
|
|||||||
@@ -60,8 +60,8 @@ namespace Ryujinx.Audio.Renderer.Parameter
|
|||||||
readonly int ISplitterDestinationInParameter.Id => Id;
|
readonly int ISplitterDestinationInParameter.Id => Id;
|
||||||
|
|
||||||
readonly int ISplitterDestinationInParameter.DestinationId => DestinationId;
|
readonly int ISplitterDestinationInParameter.DestinationId => DestinationId;
|
||||||
|
|
||||||
readonly Array2<BiquadFilterParameter> ISplitterDestinationInParameter.BiquadFilters => default;
|
readonly Array2<BiquadFilterParameter2> ISplitterDestinationInParameter.BiquadFilters2 => default;
|
||||||
|
|
||||||
readonly bool ISplitterDestinationInParameter.IsUsed => IsUsed;
|
readonly bool ISplitterDestinationInParameter.IsUsed => IsUsed;
|
||||||
readonly bool ISplitterDestinationInParameter.ResetPrevVolume => ResetPrevVolume;
|
readonly bool ISplitterDestinationInParameter.ResetPrevVolume => ResetPrevVolume;
|
||||||
|
|||||||
@@ -0,0 +1,100 @@
|
|||||||
|
using Ryujinx.Audio.Renderer.Dsp;
|
||||||
|
using Ryujinx.Common.Memory;
|
||||||
|
using Ryujinx.Common.Utilities;
|
||||||
|
using System;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace Ryujinx.Audio.Renderer.Parameter
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Input header for a splitter destination version 2 update.
|
||||||
|
/// </summary>
|
||||||
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||||
|
public struct SplitterDestinationInParameterVersion2a : ISplitterDestinationInParameter
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Magic of the input header.
|
||||||
|
/// </summary>
|
||||||
|
public uint Magic;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Target splitter destination data id.
|
||||||
|
/// </summary>
|
||||||
|
public int Id;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Mix buffer volumes storage.
|
||||||
|
/// </summary>
|
||||||
|
private MixArray _mixBufferVolume;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The mix to output the result of the splitter.
|
||||||
|
/// </summary>
|
||||||
|
public int DestinationId;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Biquad filter parameters.
|
||||||
|
/// </summary>
|
||||||
|
public Array2<BiquadFilterParameter1> BiquadFilters;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Set to true if in use.
|
||||||
|
/// </summary>
|
||||||
|
[MarshalAs(UnmanagedType.I1)]
|
||||||
|
public bool IsUsed;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Set to true to force resetting the previous mix volumes.
|
||||||
|
/// </summary>
|
||||||
|
[MarshalAs(UnmanagedType.I1)]
|
||||||
|
public bool ResetPrevVolume;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Reserved/padding.
|
||||||
|
/// </summary>
|
||||||
|
private unsafe fixed byte _reserved[10];
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential, Size = sizeof(float) * Constants.MixBufferCountMax, Pack = 1)]
|
||||||
|
private struct MixArray { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Mix buffer volumes.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>Used when a splitter id is specified in the mix.</remarks>
|
||||||
|
public Span<float> MixBufferVolume => SpanHelpers.AsSpan<MixArray, float>(ref _mixBufferVolume);
|
||||||
|
|
||||||
|
readonly int ISplitterDestinationInParameter.Id => Id;
|
||||||
|
|
||||||
|
readonly int ISplitterDestinationInParameter.DestinationId => DestinationId;
|
||||||
|
|
||||||
|
readonly Array2<BiquadFilterParameter2> ISplitterDestinationInParameter.BiquadFilters2
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
Array2<BiquadFilterParameter2> newFilters = new();
|
||||||
|
Span<BiquadFilterParameter2> newFiltersSpan = newFilters.AsSpan();
|
||||||
|
newFiltersSpan[0] = BiquadFilterHelper.ToBiquadFilterParameter2(BiquadFilters[0]);
|
||||||
|
newFiltersSpan[1] = BiquadFilterHelper.ToBiquadFilterParameter2(BiquadFilters[1]);
|
||||||
|
|
||||||
|
return newFilters;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
readonly bool ISplitterDestinationInParameter.IsUsed => IsUsed;
|
||||||
|
readonly bool ISplitterDestinationInParameter.ResetPrevVolume => ResetPrevVolume;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The expected constant of any input header.
|
||||||
|
/// </summary>
|
||||||
|
private const uint ValidMagic = 0x44444E53;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Check if the magic is valid.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Returns true if the magic is valid.</returns>
|
||||||
|
public readonly bool IsMagicValid()
|
||||||
|
{
|
||||||
|
return Magic == ValidMagic;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,7 +9,7 @@ namespace Ryujinx.Audio.Renderer.Parameter
|
|||||||
/// Input header for a splitter destination version 2 update.
|
/// Input header for a splitter destination version 2 update.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||||
public struct SplitterDestinationInParameterVersion2 : ISplitterDestinationInParameter
|
public struct SplitterDestinationInParameterVersion2b : ISplitterDestinationInParameter
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Magic of the input header.
|
/// Magic of the input header.
|
||||||
@@ -34,7 +34,7 @@ namespace Ryujinx.Audio.Renderer.Parameter
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Biquad filter parameters.
|
/// Biquad filter parameters.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Array2<BiquadFilterParameter> BiquadFilters;
|
public Array2<BiquadFilterParameter2> BiquadFilters;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Set to true if in use.
|
/// Set to true if in use.
|
||||||
@@ -66,7 +66,7 @@ namespace Ryujinx.Audio.Renderer.Parameter
|
|||||||
|
|
||||||
readonly int ISplitterDestinationInParameter.DestinationId => DestinationId;
|
readonly int ISplitterDestinationInParameter.DestinationId => DestinationId;
|
||||||
|
|
||||||
readonly Array2<BiquadFilterParameter> ISplitterDestinationInParameter.BiquadFilters => BiquadFilters;
|
readonly Array2<BiquadFilterParameter2> ISplitterDestinationInParameter.BiquadFilters2 => BiquadFilters;
|
||||||
|
|
||||||
readonly bool ISplitterDestinationInParameter.IsUsed => IsUsed;
|
readonly bool ISplitterDestinationInParameter.IsUsed => IsUsed;
|
||||||
readonly bool ISplitterDestinationInParameter.ResetPrevVolume => ResetPrevVolume;
|
readonly bool ISplitterDestinationInParameter.ResetPrevVolume => ResetPrevVolume;
|
||||||
@@ -12,7 +12,7 @@ namespace Ryujinx.Audio.Renderer.Parameter
|
|||||||
/// Input information for a voice.
|
/// Input information for a voice.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[StructLayout(LayoutKind.Sequential, Size = 0x170, Pack = 1)]
|
[StructLayout(LayoutKind.Sequential, Size = 0x170, Pack = 1)]
|
||||||
public struct VoiceInParameter
|
public struct VoiceInParameter1
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Id of the voice.
|
/// Id of the voice.
|
||||||
@@ -79,7 +79,7 @@ namespace Ryujinx.Audio.Renderer.Parameter
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Biquad filters to apply to the output of the voice.
|
/// Biquad filters to apply to the output of the voice.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Array2<BiquadFilterParameter> BiquadFilters;
|
public Array2<BiquadFilterParameter1> BiquadFilters;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Total count of <see cref="WaveBufferInternal"/> of the voice.
|
/// Total count of <see cref="WaveBufferInternal"/> of the voice.
|
||||||
@@ -171,8 +171,9 @@ namespace Ryujinx.Audio.Renderer.Parameter
|
|||||||
/// Reserved/unused.
|
/// Reserved/unused.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private unsafe fixed uint _reserved3[2];
|
private unsafe fixed uint _reserved3[2];
|
||||||
|
}
|
||||||
/// <summary>
|
|
||||||
|
/// <summary>
|
||||||
/// Input information for a voice wavebuffer.
|
/// Input information for a voice wavebuffer.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[StructLayout(LayoutKind.Sequential, Size = 0x38, Pack = 1)]
|
[StructLayout(LayoutKind.Sequential, Size = 0x38, Pack = 1)]
|
||||||
@@ -328,5 +329,4 @@ namespace Ryujinx.Audio.Renderer.Parameter
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
Low,
|
Low,
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
176
src/Ryujinx.Audio/Renderer/Parameter/VoiceInParameter2.cs
Normal file
176
src/Ryujinx.Audio/Renderer/Parameter/VoiceInParameter2.cs
Normal file
@@ -0,0 +1,176 @@
|
|||||||
|
using Ryujinx.Audio.Common;
|
||||||
|
using Ryujinx.Audio.Renderer.Common;
|
||||||
|
using Ryujinx.Audio.Renderer.Dsp;
|
||||||
|
using Ryujinx.Common.Memory;
|
||||||
|
using System;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace Ryujinx.Audio.Renderer.Parameter
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Input information for a voice.
|
||||||
|
/// </summary>
|
||||||
|
[StructLayout(LayoutKind.Sequential, Size = 0x188, Pack = 1)]
|
||||||
|
public struct VoiceInParameter2
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Id of the voice.
|
||||||
|
/// </summary>
|
||||||
|
public int Id;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Node id of the voice.
|
||||||
|
/// </summary>
|
||||||
|
public int NodeId;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Set to true if the voice is new.
|
||||||
|
/// </summary>
|
||||||
|
[MarshalAs(UnmanagedType.I1)]
|
||||||
|
public bool IsNew;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Set to true if the voice is used.
|
||||||
|
/// </summary>
|
||||||
|
[MarshalAs(UnmanagedType.I1)]
|
||||||
|
public bool InUse;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The voice <see cref="PlayState"/> wanted by the user.
|
||||||
|
/// </summary>
|
||||||
|
public PlayState PlayState;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The <see cref="SampleFormat"/> of the voice.
|
||||||
|
/// </summary>
|
||||||
|
public SampleFormat SampleFormat;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The sample rate of the voice.
|
||||||
|
/// </summary>
|
||||||
|
public uint SampleRate;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The priority of the voice.
|
||||||
|
/// </summary>
|
||||||
|
public uint Priority;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Target sorting position of the voice. (Used to sort voices with the same <see cref="Priority"/>)
|
||||||
|
/// </summary>
|
||||||
|
public uint SortingOrder;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The total channel count used.
|
||||||
|
/// </summary>
|
||||||
|
public uint ChannelCount;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The pitch used on the voice.
|
||||||
|
/// </summary>
|
||||||
|
public float Pitch;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The output volume of the voice.
|
||||||
|
/// </summary>
|
||||||
|
public float Volume;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Biquad filters to apply to the output of the voice.
|
||||||
|
/// </summary>
|
||||||
|
public Array2<BiquadFilterParameter2> BiquadFilters;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Total count of <see cref="WaveBufferInternal"/> of the voice.
|
||||||
|
/// </summary>
|
||||||
|
public uint WaveBuffersCount;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Current playing <see cref="WaveBufferInternal"/> of the voice.
|
||||||
|
/// </summary>
|
||||||
|
public uint WaveBuffersIndex;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Reserved/unused.
|
||||||
|
/// </summary>
|
||||||
|
private readonly uint
|
||||||
|
_reserved1;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// User state address required by the data source.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>Only used for <see cref="SampleFormat.Adpcm"/> as the address of the GC-ADPCM coefficients.</remarks>
|
||||||
|
public ulong DataSourceStateAddress;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// User state size required by the data source.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>Only used for <see cref="SampleFormat.Adpcm"/> as the size of the GC-ADPCM coefficients.</remarks>
|
||||||
|
public ulong DataSourceStateSize;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The target mix id of the voice.
|
||||||
|
/// </summary>
|
||||||
|
public int MixId;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The target splitter id of the voice.
|
||||||
|
/// </summary>
|
||||||
|
public uint SplitterId;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The wavebuffer parameters of this voice.
|
||||||
|
/// </summary>
|
||||||
|
public Array4<WaveBufferInternal> WaveBuffers;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The channel resource ids associated to the voice.
|
||||||
|
/// </summary>
|
||||||
|
public Array6<int> ChannelResourceIds;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Reset the voice drop flag during voice server update.
|
||||||
|
/// </summary>
|
||||||
|
[MarshalAs(UnmanagedType.I1)]
|
||||||
|
public bool ResetVoiceDropFlag;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Flush the amount of wavebuffer specified. This will result in the wavebuffer being skipped and marked played.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>This was added on REV5.</remarks>
|
||||||
|
public byte FlushWaveBufferCount;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Reserved/unused.
|
||||||
|
/// </summary>
|
||||||
|
private readonly ushort _reserved2;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Change the behaviour of the voice.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>This was added on REV5.</remarks>
|
||||||
|
public DecodingBehaviour DecodingBehaviourFlags;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Change the Sample Rate Conversion (SRC) quality of the voice.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>This was added on REV8.</remarks>
|
||||||
|
public SampleRateConversionQuality SrcQuality;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This was previously used for opus codec support on the Audio Renderer and was removed on REV3.
|
||||||
|
/// </summary>
|
||||||
|
public uint ExternalContext;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This was previously used for opus codec support on the Audio Renderer and was removed on REV3.
|
||||||
|
/// </summary>
|
||||||
|
public uint ExternalContextSize;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Reserved/unused.
|
||||||
|
/// </summary>
|
||||||
|
private unsafe fixed uint _reserved3[2];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
using Ryujinx.Audio.Renderer.Common;
|
||||||
|
using Ryujinx.Audio.Renderer.Server;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace Ryujinx.Audio.Renderer.Parameter
|
namespace Ryujinx.Audio.Renderer.Parameter
|
||||||
@@ -5,7 +7,7 @@ namespace Ryujinx.Audio.Renderer.Parameter
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Output information about a voice.
|
/// Output information about a voice.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>See <seealso cref="Server.StateUpdater.UpdateVoices(Server.Voice.VoiceContext, System.Memory{Server.MemoryPool.MemoryPoolState})"/></remarks>
|
/// <remarks>See <seealso cref="StateUpdater.UpdateVoices1"/></remarks>
|
||||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||||
public struct VoiceOutStatus
|
public struct VoiceOutStatus
|
||||||
{
|
{
|
||||||
@@ -13,7 +15,7 @@ namespace Ryujinx.Audio.Renderer.Parameter
|
|||||||
/// The total amount of samples that was played.
|
/// The total amount of samples that was played.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>This is reset to 0 when a <see cref="Common.WaveBuffer"/> finishes playing and <see cref="Common.WaveBuffer.IsEndOfStream"/> is set.</remarks>
|
/// <remarks>This is reset to 0 when a <see cref="Common.WaveBuffer"/> finishes playing and <see cref="Common.WaveBuffer.IsEndOfStream"/> is set.</remarks>
|
||||||
/// <remarks>This is reset to 0 when looping while <see cref="Parameter.VoiceInParameter.DecodingBehaviour.PlayedSampleCountResetWhenLooping"/> is set.</remarks>
|
/// <remarks>This is reset to 0 when looping while <see cref="DecodingBehaviour.PlayedSampleCountResetWhenLooping"/> is set.</remarks>
|
||||||
public ulong PlayedSampleCount;
|
public ulong PlayedSampleCount;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
private AudioRendererRenderingDevice _renderingDevice;
|
private AudioRendererRenderingDevice _renderingDevice;
|
||||||
private AudioRendererExecutionMode _executionMode;
|
private AudioRendererExecutionMode _executionMode;
|
||||||
private readonly IWritableEvent _systemEvent;
|
private readonly IWritableEvent _systemEvent;
|
||||||
private MemoryPoolState _dspMemoryPoolState;
|
private MemoryPoolInfo _dspMemoryPoolInfo;
|
||||||
private readonly VoiceContext _voiceContext;
|
private readonly VoiceContext _voiceContext;
|
||||||
private readonly MixContext _mixContext;
|
private readonly MixContext _mixContext;
|
||||||
private readonly SinkContext _sinkContext;
|
private readonly SinkContext _sinkContext;
|
||||||
@@ -40,13 +40,13 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
private PerformanceManager _performanceManager;
|
private PerformanceManager _performanceManager;
|
||||||
private UpsamplerManager _upsamplerManager;
|
private UpsamplerManager _upsamplerManager;
|
||||||
private bool _isActive;
|
private bool _isActive;
|
||||||
private BehaviourContext _behaviourContext;
|
private BehaviourInfo _behaviourInfo;
|
||||||
#pragma warning disable IDE0052 // Remove unread private member
|
#pragma warning disable IDE0052 // Remove unread private member
|
||||||
private ulong _totalElapsedTicksUpdating;
|
private ulong _totalElapsedTicksUpdating;
|
||||||
private ulong _totalElapsedTicks;
|
private ulong _totalElapsedTicks;
|
||||||
#pragma warning restore IDE0052
|
#pragma warning restore IDE0052
|
||||||
private int _sessionId;
|
private int _sessionId;
|
||||||
private Memory<MemoryPoolState> _memoryPools;
|
private Memory<MemoryPoolInfo> _memoryPools;
|
||||||
|
|
||||||
private uint _sampleRate;
|
private uint _sampleRate;
|
||||||
private uint _sampleCount;
|
private uint _sampleCount;
|
||||||
@@ -84,7 +84,7 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
public AudioRenderSystem(AudioRendererManager manager, IWritableEvent systemEvent)
|
public AudioRenderSystem(AudioRendererManager manager, IWritableEvent systemEvent)
|
||||||
{
|
{
|
||||||
_manager = manager;
|
_manager = manager;
|
||||||
_dspMemoryPoolState = MemoryPoolState.Create(MemoryPoolState.LocationType.Dsp);
|
_dspMemoryPoolInfo = MemoryPoolInfo.Create(MemoryPoolInfo.LocationType.Dsp);
|
||||||
_voiceContext = new VoiceContext();
|
_voiceContext = new VoiceContext();
|
||||||
_mixContext = new MixContext();
|
_mixContext = new MixContext();
|
||||||
_sinkContext = new SinkContext();
|
_sinkContext = new SinkContext();
|
||||||
@@ -93,7 +93,7 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
|
|
||||||
_commandProcessingTimeEstimator = null;
|
_commandProcessingTimeEstimator = null;
|
||||||
_systemEvent = systemEvent;
|
_systemEvent = systemEvent;
|
||||||
_behaviourContext = new BehaviourContext();
|
_behaviourInfo = new BehaviourInfo();
|
||||||
|
|
||||||
_totalElapsedTicksUpdating = 0;
|
_totalElapsedTicksUpdating = 0;
|
||||||
_sessionId = 0;
|
_sessionId = 0;
|
||||||
@@ -110,7 +110,7 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
ulong appletResourceId,
|
ulong appletResourceId,
|
||||||
IVirtualMemoryManager memoryManager)
|
IVirtualMemoryManager memoryManager)
|
||||||
{
|
{
|
||||||
if (!BehaviourContext.CheckValidRevision(parameter.Revision))
|
if (!BehaviourInfo.CheckValidRevision(parameter.Revision))
|
||||||
{
|
{
|
||||||
return ResultCode.OperationFailed;
|
return ResultCode.OperationFailed;
|
||||||
}
|
}
|
||||||
@@ -122,9 +122,9 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
|
|
||||||
Debug.Assert(parameter.RenderingDevice == AudioRendererRenderingDevice.Dsp && parameter.ExecutionMode == AudioRendererExecutionMode.Auto);
|
Debug.Assert(parameter.RenderingDevice == AudioRendererRenderingDevice.Dsp && parameter.ExecutionMode == AudioRendererExecutionMode.Auto);
|
||||||
|
|
||||||
Logger.Info?.Print(LogClass.AudioRenderer, $"Initializing with REV{BehaviourContext.GetRevisionNumber(parameter.Revision)}");
|
Logger.Info?.Print(LogClass.AudioRenderer, $"Initializing with REV{BehaviourInfo.GetRevisionNumber(parameter.Revision)}");
|
||||||
|
|
||||||
_behaviourContext.SetUserRevision(parameter.Revision);
|
_behaviourInfo.SetUserRevision(parameter.Revision);
|
||||||
|
|
||||||
_sampleRate = parameter.SampleRate;
|
_sampleRate = parameter.SampleRate;
|
||||||
_sampleCount = parameter.SampleCount;
|
_sampleCount = parameter.SampleCount;
|
||||||
@@ -151,7 +151,7 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
workBufferAllocator = new WorkBufferAllocator(workBufferMemory);
|
workBufferAllocator = new WorkBufferAllocator(workBufferMemory);
|
||||||
|
|
||||||
PoolMapper poolMapper = new(processHandle, false);
|
PoolMapper poolMapper = new(processHandle, false);
|
||||||
poolMapper.InitializeSystemPool(ref _dspMemoryPoolState, workBuffer, workBufferSize);
|
poolMapper.InitializeSystemPool(ref _dspMemoryPoolInfo, workBuffer, workBufferSize);
|
||||||
|
|
||||||
_mixBuffer = workBufferAllocator.Allocate<float>(_sampleCount * (_voiceChannelCountMax + _mixBufferCount), 0x10);
|
_mixBuffer = workBufferAllocator.Allocate<float>(_sampleCount * (_voiceChannelCountMax + _mixBufferCount), 0x10);
|
||||||
|
|
||||||
@@ -176,7 +176,7 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
|
|
||||||
Memory<BiquadFilterState> splitterBqfStates = Memory<BiquadFilterState>.Empty;
|
Memory<BiquadFilterState> splitterBqfStates = Memory<BiquadFilterState>.Empty;
|
||||||
|
|
||||||
if (_behaviourContext.IsBiquadFilterParameterForSplitterEnabled() &&
|
if (_behaviourInfo.IsBiquadFilterParameterForSplitterEnabled() &&
|
||||||
parameter.SplitterCount > 0 &&
|
parameter.SplitterCount > 0 &&
|
||||||
parameter.SplitterDestinationCount > 0)
|
parameter.SplitterDestinationCount > 0)
|
||||||
{
|
{
|
||||||
@@ -191,23 +191,23 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Invalidate DSP cache on what was currently allocated with workBuffer.
|
// Invalidate DSP cache on what was currently allocated with workBuffer.
|
||||||
AudioProcessorMemoryManager.InvalidateDspCache(_dspMemoryPoolState.Translate(workBuffer, workBufferAllocator.Offset), workBufferAllocator.Offset);
|
AudioProcessorMemoryManager.InvalidateDspCache(_dspMemoryPoolInfo.Translate(workBuffer, workBufferAllocator.Offset), workBufferAllocator.Offset);
|
||||||
|
|
||||||
Debug.Assert((workBufferAllocator.Offset % Constants.BufferAlignment) == 0);
|
Debug.Assert((workBufferAllocator.Offset % Constants.BufferAlignment) == 0);
|
||||||
|
|
||||||
Memory<VoiceState> voices = workBufferAllocator.Allocate<VoiceState>(parameter.VoiceCount, VoiceState.Alignment);
|
Memory<VoiceInfo> voices = workBufferAllocator.Allocate<VoiceInfo>(parameter.VoiceCount, VoiceInfo.Alignment);
|
||||||
|
|
||||||
if (voices.IsEmpty)
|
if (voices.IsEmpty)
|
||||||
{
|
{
|
||||||
return ResultCode.WorkBufferTooSmall;
|
return ResultCode.WorkBufferTooSmall;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (ref VoiceState voice in voices.Span)
|
foreach (ref VoiceInfo voice in voices.Span)
|
||||||
{
|
{
|
||||||
voice.Initialize();
|
voice.Initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
// A pain to handle as we can't have VoiceState*, use indices to be a bit more safe
|
// A pain to handle as we can't have VoiceInfo*, use indices to be a bit more safe
|
||||||
Memory<int> sortedVoices = workBufferAllocator.Allocate<int>(parameter.VoiceCount, 0x10);
|
Memory<int> sortedVoices = workBufferAllocator.Allocate<int>(parameter.VoiceCount, 0x10);
|
||||||
|
|
||||||
if (sortedVoices.IsEmpty)
|
if (sortedVoices.IsEmpty)
|
||||||
@@ -233,16 +233,16 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
voiceChannelResource.IsUsed = false;
|
voiceChannelResource.IsUsed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Memory<VoiceUpdateState> voiceUpdateStates = workBufferAllocator.Allocate<VoiceUpdateState>(parameter.VoiceCount, VoiceUpdateState.Align);
|
Memory<VoiceState> voiceStates = workBufferAllocator.Allocate<VoiceState>(parameter.VoiceCount, VoiceState.Align);
|
||||||
|
|
||||||
if (voiceUpdateStates.IsEmpty)
|
if (voiceStates.IsEmpty)
|
||||||
{
|
{
|
||||||
return ResultCode.WorkBufferTooSmall;
|
return ResultCode.WorkBufferTooSmall;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint mixesCount = parameter.SubMixBufferCount + 1;
|
uint mixesCount = parameter.SubMixBufferCount + 1;
|
||||||
|
|
||||||
Memory<MixState> mixes = workBufferAllocator.Allocate<MixState>(mixesCount, MixState.Alignment);
|
Memory<MixInfo> mixes = workBufferAllocator.Allocate<MixInfo>(mixesCount, MixInfo.Alignment);
|
||||||
|
|
||||||
if (mixes.IsEmpty)
|
if (mixes.IsEmpty)
|
||||||
{
|
{
|
||||||
@@ -251,18 +251,18 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
|
|
||||||
if (parameter.EffectCount == 0)
|
if (parameter.EffectCount == 0)
|
||||||
{
|
{
|
||||||
foreach (ref MixState mix in mixes.Span)
|
foreach (ref MixInfo mix in mixes.Span)
|
||||||
{
|
{
|
||||||
mix = new MixState(Memory<int>.Empty, ref _behaviourContext);
|
mix = new MixInfo(Memory<int>.Empty, ref _behaviourInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Memory<int> effectProcessingOrderArray = workBufferAllocator.Allocate<int>(parameter.EffectCount * mixesCount, 0x10);
|
Memory<int> effectProcessingOrderArray = workBufferAllocator.Allocate<int>(parameter.EffectCount * mixesCount, 0x10);
|
||||||
|
|
||||||
foreach (ref MixState mix in mixes.Span)
|
foreach (ref MixInfo mix in mixes.Span)
|
||||||
{
|
{
|
||||||
mix = new MixState(effectProcessingOrderArray[..(int)parameter.EffectCount], ref _behaviourContext);
|
mix = new MixInfo(effectProcessingOrderArray[..(int)parameter.EffectCount], ref _behaviourInfo);
|
||||||
|
|
||||||
effectProcessingOrderArray = effectProcessingOrderArray[(int)parameter.EffectCount..];
|
effectProcessingOrderArray = effectProcessingOrderArray[(int)parameter.EffectCount..];
|
||||||
}
|
}
|
||||||
@@ -271,20 +271,20 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
// Initialize the final mix id
|
// Initialize the final mix id
|
||||||
mixes.Span[0].MixId = Constants.FinalMixId;
|
mixes.Span[0].MixId = Constants.FinalMixId;
|
||||||
|
|
||||||
Memory<int> sortedMixesState = workBufferAllocator.Allocate<int>(mixesCount, 0x10);
|
Memory<int> sortedMixesInfo = workBufferAllocator.Allocate<int>(mixesCount, 0x10);
|
||||||
|
|
||||||
if (sortedMixesState.IsEmpty)
|
if (sortedMixesInfo.IsEmpty)
|
||||||
{
|
{
|
||||||
return ResultCode.WorkBufferTooSmall;
|
return ResultCode.WorkBufferTooSmall;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clear memory (use -1 as it's an invalid index)
|
// Clear memory (use -1 as it's an invalid index)
|
||||||
sortedMixesState.Span.Fill(-1);
|
sortedMixesInfo.Span.Fill(-1);
|
||||||
|
|
||||||
Memory<byte> nodeStatesWorkBuffer = Memory<byte>.Empty;
|
Memory<byte> nodeStatesWorkBuffer = Memory<byte>.Empty;
|
||||||
Memory<byte> edgeMatrixWorkBuffer = Memory<byte>.Empty;
|
Memory<byte> edgeMatrixWorkBuffer = Memory<byte>.Empty;
|
||||||
|
|
||||||
if (_behaviourContext.IsSplitterSupported())
|
if (_behaviourInfo.IsSplitterSupported())
|
||||||
{
|
{
|
||||||
nodeStatesWorkBuffer = workBufferAllocator.Allocate((uint)NodeStates.GetWorkBufferSize((int)mixesCount), 1);
|
nodeStatesWorkBuffer = workBufferAllocator.Allocate((uint)NodeStates.GetWorkBufferSize((int)mixesCount), 1);
|
||||||
edgeMatrixWorkBuffer = workBufferAllocator.Allocate((uint)EdgeMatrix.GetWorkBufferSize((int)mixesCount), 1);
|
edgeMatrixWorkBuffer = workBufferAllocator.Allocate((uint)EdgeMatrix.GetWorkBufferSize((int)mixesCount), 1);
|
||||||
@@ -295,21 +295,21 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_mixContext.Initialize(sortedMixesState, mixes, nodeStatesWorkBuffer, edgeMatrixWorkBuffer);
|
_mixContext.Initialize(sortedMixesInfo, mixes, nodeStatesWorkBuffer, edgeMatrixWorkBuffer);
|
||||||
|
|
||||||
_memoryPools = workBufferAllocator.Allocate<MemoryPoolState>(_memoryPoolCount, MemoryPoolState.Alignment);
|
_memoryPools = workBufferAllocator.Allocate<MemoryPoolInfo>(_memoryPoolCount, MemoryPoolInfo.Alignment);
|
||||||
|
|
||||||
if (_memoryPools.IsEmpty)
|
if (_memoryPools.IsEmpty)
|
||||||
{
|
{
|
||||||
return ResultCode.WorkBufferTooSmall;
|
return ResultCode.WorkBufferTooSmall;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (ref MemoryPoolState state in _memoryPools.Span)
|
foreach (ref MemoryPoolInfo info in _memoryPools.Span)
|
||||||
{
|
{
|
||||||
state = MemoryPoolState.Create(MemoryPoolState.LocationType.Cpu);
|
info = MemoryPoolInfo.Create(MemoryPoolInfo.LocationType.Cpu);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_splitterContext.Initialize(ref _behaviourContext, ref parameter, workBufferAllocator, splitterBqfStates))
|
if (!_splitterContext.Initialize(ref _behaviourInfo, ref parameter, workBufferAllocator, splitterBqfStates))
|
||||||
{
|
{
|
||||||
return ResultCode.WorkBufferTooSmall;
|
return ResultCode.WorkBufferTooSmall;
|
||||||
}
|
}
|
||||||
@@ -318,21 +318,21 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
|
|
||||||
_upsamplerManager = new UpsamplerManager(upSamplerWorkBuffer, _upsamplerCount);
|
_upsamplerManager = new UpsamplerManager(upSamplerWorkBuffer, _upsamplerCount);
|
||||||
|
|
||||||
_effectContext.Initialize(parameter.EffectCount, _behaviourContext.IsEffectInfoVersion2Supported() ? parameter.EffectCount : 0);
|
_effectContext.Initialize(parameter.EffectCount, _behaviourInfo.IsEffectInfoVersion2Supported() ? parameter.EffectCount : 0);
|
||||||
_sinkContext.Initialize(parameter.SinkCount);
|
_sinkContext.Initialize(parameter.SinkCount);
|
||||||
|
|
||||||
Memory<VoiceUpdateState> voiceUpdateStatesDsp = workBufferAllocator.Allocate<VoiceUpdateState>(parameter.VoiceCount, VoiceUpdateState.Align);
|
Memory<VoiceState> voiceStatesDsp = workBufferAllocator.Allocate<VoiceState>(parameter.VoiceCount, VoiceState.Align);
|
||||||
|
|
||||||
if (voiceUpdateStatesDsp.IsEmpty)
|
if (voiceStatesDsp.IsEmpty)
|
||||||
{
|
{
|
||||||
return ResultCode.WorkBufferTooSmall;
|
return ResultCode.WorkBufferTooSmall;
|
||||||
}
|
}
|
||||||
|
|
||||||
_voiceContext.Initialize(sortedVoices, voices, voiceChannelResources, voiceUpdateStates, voiceUpdateStatesDsp, parameter.VoiceCount);
|
_voiceContext.Initialize(sortedVoices, voices, voiceChannelResources, voiceStates, voiceStatesDsp, parameter.VoiceCount);
|
||||||
|
|
||||||
if (parameter.PerformanceMetricFramesCount > 0)
|
if (parameter.PerformanceMetricFramesCount > 0)
|
||||||
{
|
{
|
||||||
ulong performanceBufferSize = PerformanceManager.GetRequiredBufferSizeForPerformanceMetricsPerFrame(ref parameter, ref _behaviourContext) * (parameter.PerformanceMetricFramesCount + 1) + 0xC;
|
ulong performanceBufferSize = PerformanceManager.GetRequiredBufferSizeForPerformanceMetricsPerFrame(ref parameter, ref _behaviourInfo) * (parameter.PerformanceMetricFramesCount + 1) + 0xC;
|
||||||
|
|
||||||
_performanceBuffer = workBufferAllocator.Allocate(performanceBufferSize, Constants.BufferAlignment);
|
_performanceBuffer = workBufferAllocator.Allocate(performanceBufferSize, Constants.BufferAlignment);
|
||||||
|
|
||||||
@@ -341,7 +341,7 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
return ResultCode.WorkBufferTooSmall;
|
return ResultCode.WorkBufferTooSmall;
|
||||||
}
|
}
|
||||||
|
|
||||||
_performanceManager = PerformanceManager.Create(_performanceBuffer, ref parameter, _behaviourContext);
|
_performanceManager = PerformanceManager.Create(_performanceBuffer, ref parameter, _behaviourInfo);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -359,14 +359,14 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
_elapsedFrameCount = 0;
|
_elapsedFrameCount = 0;
|
||||||
_voiceDropParameter = 1.0f;
|
_voiceDropParameter = 1.0f;
|
||||||
|
|
||||||
_commandProcessingTimeEstimator = _behaviourContext.GetCommandProcessingTimeEstimatorVersion() switch
|
_commandProcessingTimeEstimator = _behaviourInfo.GetCommandProcessingTimeEstimatorVersion() switch
|
||||||
{
|
{
|
||||||
1 => new CommandProcessingTimeEstimatorVersion1(_sampleCount, _mixBufferCount),
|
1 => new CommandProcessingTimeEstimatorVersion1(_sampleCount, _mixBufferCount),
|
||||||
2 => new CommandProcessingTimeEstimatorVersion2(_sampleCount, _mixBufferCount),
|
2 => new CommandProcessingTimeEstimatorVersion2(_sampleCount, _mixBufferCount),
|
||||||
3 => new CommandProcessingTimeEstimatorVersion3(_sampleCount, _mixBufferCount),
|
3 => new CommandProcessingTimeEstimatorVersion3(_sampleCount, _mixBufferCount),
|
||||||
4 => new CommandProcessingTimeEstimatorVersion4(_sampleCount, _mixBufferCount),
|
4 => new CommandProcessingTimeEstimatorVersion4(_sampleCount, _mixBufferCount),
|
||||||
5 => new CommandProcessingTimeEstimatorVersion5(_sampleCount, _mixBufferCount),
|
5 => new CommandProcessingTimeEstimatorVersion5(_sampleCount, _mixBufferCount),
|
||||||
_ => throw new NotImplementedException($"Unsupported processing time estimator version {_behaviourContext.GetCommandProcessingTimeEstimatorVersion()}."),
|
_ => throw new NotImplementedException($"Unsupported processing time estimator version {_behaviourInfo.GetCommandProcessingTimeEstimatorVersion()}."),
|
||||||
};
|
};
|
||||||
|
|
||||||
return ResultCode.Success;
|
return ResultCode.Success;
|
||||||
@@ -411,11 +411,11 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
|
|
||||||
output.Span.Clear();
|
output.Span.Clear();
|
||||||
|
|
||||||
StateUpdater stateUpdater = new(input, output, _processHandle, _behaviourContext);
|
StateUpdater stateUpdater = new(input, output, _processHandle, _behaviourInfo);
|
||||||
|
|
||||||
ResultCode result;
|
ResultCode result;
|
||||||
|
|
||||||
result = stateUpdater.UpdateBehaviourContext();
|
result = stateUpdater.UpdateBehaviourInfo();
|
||||||
|
|
||||||
if (result != ResultCode.Success)
|
if (result != ResultCode.Success)
|
||||||
{
|
{
|
||||||
@@ -436,9 +436,16 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
PoolMapper poolMapper = new(_processHandle, _memoryPools, _behaviourContext.IsMemoryPoolForceMappingEnabled());
|
PoolMapper poolMapper = new(_processHandle, _memoryPools, _behaviourInfo.IsMemoryPoolForceMappingEnabled());
|
||||||
|
|
||||||
result = stateUpdater.UpdateVoices(_voiceContext, poolMapper);
|
if (_behaviourInfo.IsBiquadFilterParameterFloatSupported())
|
||||||
|
{
|
||||||
|
result = stateUpdater.UpdateVoices2(_voiceContext, poolMapper);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = stateUpdater.UpdateVoices1(_voiceContext, poolMapper);
|
||||||
|
}
|
||||||
|
|
||||||
if (result != ResultCode.Success)
|
if (result != ResultCode.Success)
|
||||||
{
|
{
|
||||||
@@ -452,7 +459,7 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_behaviourContext.IsSplitterSupported())
|
if (_behaviourInfo.IsSplitterSupported())
|
||||||
{
|
{
|
||||||
result = stateUpdater.UpdateSplitter(_splitterContext);
|
result = stateUpdater.UpdateSplitter(_splitterContext);
|
||||||
|
|
||||||
@@ -490,7 +497,7 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_behaviourContext.IsElapsedFrameCountSupported())
|
if (_behaviourInfo.IsElapsedFrameCountSupported())
|
||||||
{
|
{
|
||||||
result = stateUpdater.UpdateRendererInfo(_elapsedFrameCount);
|
result = stateUpdater.UpdateRendererInfo(_elapsedFrameCount);
|
||||||
|
|
||||||
@@ -557,7 +564,7 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ref VoiceState voice = ref _voiceContext.GetState(NodeIdHelper.GetBase(targetNodeId));
|
ref VoiceInfo voice = ref _voiceContext.GetState(NodeIdHelper.GetBase(targetNodeId));
|
||||||
|
|
||||||
if (voice.Priority == Constants.VoiceHighestPriority)
|
if (voice.Priority == Constants.VoiceHighestPriority)
|
||||||
{
|
{
|
||||||
@@ -646,7 +653,7 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
|
|
||||||
_voiceContext.UpdateForCommandGeneration();
|
_voiceContext.UpdateForCommandGeneration();
|
||||||
|
|
||||||
if (_behaviourContext.IsEffectInfoVersion2Supported())
|
if (_behaviourInfo.IsEffectInfoVersion2Supported())
|
||||||
{
|
{
|
||||||
_effectContext.UpdateResultStateForCommandGeneration();
|
_effectContext.UpdateResultStateForCommandGeneration();
|
||||||
}
|
}
|
||||||
@@ -661,7 +668,7 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
|
|
||||||
private int GetMaxAllocatedTimeForDsp()
|
private int GetMaxAllocatedTimeForDsp()
|
||||||
{
|
{
|
||||||
return (int)(Constants.AudioProcessorMaxUpdateTimePerSessions * _behaviourContext.GetAudioRendererProcessingTimeLimit() * (GetRenderingTimeLimit() / 100.0f));
|
return (int)(Constants.AudioProcessorMaxUpdateTimePerSessions * _behaviourInfo.GetAudioRendererProcessingTimeLimit() * (GetRenderingTimeLimit() / 100.0f));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendCommands()
|
public void SendCommands()
|
||||||
@@ -736,7 +743,7 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
return new RendererSystemContext
|
return new RendererSystemContext
|
||||||
{
|
{
|
||||||
ChannelCount = _manager.Processor.OutputDevices[_sessionId].GetChannelCount(),
|
ChannelCount = _manager.Processor.OutputDevices[_sessionId].GetChannelCount(),
|
||||||
BehaviourContext = _behaviourContext,
|
BehaviourInfo = _behaviourInfo,
|
||||||
DepopBuffer = _depopBuffer,
|
DepopBuffer = _depopBuffer,
|
||||||
MixBufferCount = GetMixBufferCount(),
|
MixBufferCount = GetMixBufferCount(),
|
||||||
SessionId = _sessionId,
|
SessionId = _sessionId,
|
||||||
@@ -751,9 +758,9 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
|
|
||||||
public static ulong GetWorkBufferSize(ref AudioRendererConfiguration parameter)
|
public static ulong GetWorkBufferSize(ref AudioRendererConfiguration parameter)
|
||||||
{
|
{
|
||||||
BehaviourContext behaviourContext = new();
|
BehaviourInfo behaviourInfo = new();
|
||||||
|
|
||||||
behaviourContext.SetUserRevision(parameter.Revision);
|
behaviourInfo.SetUserRevision(parameter.Revision);
|
||||||
|
|
||||||
uint mixesCount = parameter.SubMixBufferCount + 1;
|
uint mixesCount = parameter.SubMixBufferCount + 1;
|
||||||
|
|
||||||
@@ -771,28 +778,28 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
size = WorkBufferAllocator.GetTargetSize<float>(size, BitUtils.AlignUp<ulong>(parameter.MixBufferCount, Constants.BufferAlignment), Constants.BufferAlignment);
|
size = WorkBufferAllocator.GetTargetSize<float>(size, BitUtils.AlignUp<ulong>(parameter.MixBufferCount, Constants.BufferAlignment), Constants.BufferAlignment);
|
||||||
|
|
||||||
// Voice
|
// Voice
|
||||||
size = WorkBufferAllocator.GetTargetSize<VoiceState>(size, parameter.VoiceCount, VoiceState.Alignment);
|
size = WorkBufferAllocator.GetTargetSize<VoiceInfo>(size, parameter.VoiceCount, VoiceInfo.Alignment);
|
||||||
size = WorkBufferAllocator.GetTargetSize<int>(size, parameter.VoiceCount, 0x10);
|
size = WorkBufferAllocator.GetTargetSize<int>(size, parameter.VoiceCount, 0x10);
|
||||||
size = WorkBufferAllocator.GetTargetSize<VoiceChannelResource>(size, parameter.VoiceCount, VoiceChannelResource.Alignment);
|
size = WorkBufferAllocator.GetTargetSize<VoiceChannelResource>(size, parameter.VoiceCount, VoiceChannelResource.Alignment);
|
||||||
size = WorkBufferAllocator.GetTargetSize<VoiceUpdateState>(size, parameter.VoiceCount, VoiceUpdateState.Align);
|
size = WorkBufferAllocator.GetTargetSize<VoiceState>(size, parameter.VoiceCount, VoiceState.Align);
|
||||||
|
|
||||||
// Mix
|
// Mix
|
||||||
size = WorkBufferAllocator.GetTargetSize<MixState>(size, mixesCount, MixState.Alignment);
|
size = WorkBufferAllocator.GetTargetSize<MixInfo>(size, mixesCount, MixInfo.Alignment);
|
||||||
size = WorkBufferAllocator.GetTargetSize<int>(size, parameter.EffectCount * mixesCount, 0x10);
|
size = WorkBufferAllocator.GetTargetSize<int>(size, parameter.EffectCount * mixesCount, 0x10);
|
||||||
size = WorkBufferAllocator.GetTargetSize<int>(size, mixesCount, 0x10);
|
size = WorkBufferAllocator.GetTargetSize<int>(size, mixesCount, 0x10);
|
||||||
|
|
||||||
if (behaviourContext.IsSplitterSupported())
|
if (behaviourInfo.IsSplitterSupported())
|
||||||
{
|
{
|
||||||
size += (ulong)BitUtils.AlignUp(NodeStates.GetWorkBufferSize((int)mixesCount) + EdgeMatrix.GetWorkBufferSize((int)mixesCount), 0x10);
|
size += (ulong)BitUtils.AlignUp(NodeStates.GetWorkBufferSize((int)mixesCount) + EdgeMatrix.GetWorkBufferSize((int)mixesCount), 0x10);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Memory Pool
|
// Memory Pool
|
||||||
size = WorkBufferAllocator.GetTargetSize<MemoryPoolState>(size, memoryPoolCount, MemoryPoolState.Alignment);
|
size = WorkBufferAllocator.GetTargetSize<MemoryPoolInfo>(size, memoryPoolCount, MemoryPoolInfo.Alignment);
|
||||||
|
|
||||||
// Splitter
|
// Splitter
|
||||||
size = SplitterContext.GetWorkBufferSize(size, ref behaviourContext, ref parameter);
|
size = SplitterContext.GetWorkBufferSize(size, ref behaviourInfo, ref parameter);
|
||||||
|
|
||||||
if (behaviourContext.IsBiquadFilterParameterForSplitterEnabled() &&
|
if (behaviourInfo.IsBiquadFilterParameterForSplitterEnabled() &&
|
||||||
parameter.SplitterCount > 0 &&
|
parameter.SplitterCount > 0 &&
|
||||||
parameter.SplitterDestinationCount > 0)
|
parameter.SplitterDestinationCount > 0)
|
||||||
{
|
{
|
||||||
@@ -800,12 +807,12 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
}
|
}
|
||||||
|
|
||||||
// DSP Voice
|
// DSP Voice
|
||||||
size = WorkBufferAllocator.GetTargetSize<VoiceUpdateState>(size, parameter.VoiceCount, VoiceUpdateState.Align);
|
size = WorkBufferAllocator.GetTargetSize<VoiceState>(size, parameter.VoiceCount, VoiceState.Align);
|
||||||
|
|
||||||
// Performance
|
// Performance
|
||||||
if (parameter.PerformanceMetricFramesCount > 0)
|
if (parameter.PerformanceMetricFramesCount > 0)
|
||||||
{
|
{
|
||||||
ulong performanceMetricsPerFramesSize = PerformanceManager.GetRequiredBufferSizeForPerformanceMetricsPerFrame(ref parameter, ref behaviourContext) * (parameter.PerformanceMetricFramesCount + 1) + 0xC;
|
ulong performanceMetricsPerFramesSize = PerformanceManager.GetRequiredBufferSizeForPerformanceMetricsPerFrame(ref parameter, ref behaviourInfo) * (parameter.PerformanceMetricFramesCount + 1) + 0xC;
|
||||||
|
|
||||||
size += BitUtils.AlignUp<ulong>(performanceMetricsPerFramesSize, Constants.PerformanceMetricsPerFramesSizeAlignment);
|
size += BitUtils.AlignUp<ulong>(performanceMetricsPerFramesSize, Constants.PerformanceMetricsPerFramesSizeAlignment);
|
||||||
}
|
}
|
||||||
@@ -847,13 +854,13 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
}
|
}
|
||||||
|
|
||||||
PoolMapper mapper = new(_processHandle, false);
|
PoolMapper mapper = new(_processHandle, false);
|
||||||
mapper.Unmap(ref _dspMemoryPoolState);
|
mapper.Unmap(ref _dspMemoryPoolInfo);
|
||||||
|
|
||||||
PoolMapper.ClearUsageState(_memoryPools);
|
PoolMapper.ClearUsageState(_memoryPools);
|
||||||
|
|
||||||
for (int i = 0; i < _memoryPoolCount; i++)
|
for (int i = 0; i < _memoryPoolCount; i++)
|
||||||
{
|
{
|
||||||
ref MemoryPoolState memoryPool = ref _memoryPools.Span[i];
|
ref MemoryPoolInfo memoryPool = ref _memoryPools.Span[i];
|
||||||
|
|
||||||
if (memoryPool.IsMapped())
|
if (memoryPool.IsMapped())
|
||||||
{
|
{
|
||||||
@@ -875,7 +882,7 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
|
|
||||||
public void SetVoiceDropParameter(float voiceDropParameter)
|
public void SetVoiceDropParameter(float voiceDropParameter)
|
||||||
{
|
{
|
||||||
_voiceDropParameter = Math.Clamp(voiceDropParameter, 0.0f, 2.0f);
|
_voiceDropParameter = Math.Clamp(voiceDropParameter, 0.0f, 4.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
public float GetVoiceDropParameter()
|
public float GetVoiceDropParameter()
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
using Ryujinx.Audio.Renderer.Parameter;
|
||||||
|
using Ryujinx.Common.Memory;
|
||||||
using System;
|
using System;
|
||||||
using System.Buffers;
|
using System.Buffers;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
@@ -9,7 +11,7 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
/// Behaviour context.
|
/// Behaviour context.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>This handles features based on the audio renderer revision provided by the user.</remarks>
|
/// <remarks>This handles features based on the audio renderer revision provided by the user.</remarks>
|
||||||
public class BehaviourContext
|
public class BehaviourInfo
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The base magic of the Audio Renderer revision.
|
/// The base magic of the Audio Renderer revision.
|
||||||
@@ -40,7 +42,7 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
public const int Revision4 = 4 << 24;
|
public const int Revision4 = 4 << 24;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// REV5: <see cref="Parameter.VoiceInParameter.DecodingBehaviour"/>, <see cref="Parameter.VoiceInParameter.FlushWaveBufferCount"/> were added to voice.
|
/// REV5: <see cref="VoiceInParameter1.DecodingBehaviour"/>, <see cref="VoiceInParameter1.FlushWaveBufferCount"/> were added to voice.
|
||||||
/// A new performance frame format (version 2) was added with support for more information about DSP timing.
|
/// A new performance frame format (version 2) was added with support for more information about DSP timing.
|
||||||
/// <see cref="Parameter.RendererInfoOutStatus"/> was added to supply the count of update done sent to the DSP.
|
/// <see cref="Parameter.RendererInfoOutStatus"/> was added to supply the count of update done sent to the DSP.
|
||||||
/// A new version of the command estimator was added to address timing changes caused by the voice changes.
|
/// A new version of the command estimator was added to address timing changes caused by the voice changes.
|
||||||
@@ -64,7 +66,7 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// REV8:
|
/// REV8:
|
||||||
/// Wavebuffer was changed to support more control over loop (you can now specify where to start and end a loop, and how many times to loop).
|
/// Wavebuffer was changed to support more control over loop (you can now specify where to start and end a loop, and how many times to loop).
|
||||||
/// <see cref="Parameter.VoiceInParameter.SrcQuality"/> was added (see <see cref="Parameter.VoiceInParameter.SampleRateConversionQuality"/> for more info).
|
/// <see cref="VoiceInParameter1.SrcQuality"/> was added (see <see cref="VoiceInParameter1.SampleRateConversionQuality"/> for more info).
|
||||||
/// Final leftovers of the codec system were removed.
|
/// Final leftovers of the codec system were removed.
|
||||||
/// <see cref="Common.SampleFormat.PcmFloat"/> support was added.
|
/// <see cref="Common.SampleFormat.PcmFloat"/> support was added.
|
||||||
/// A new version of the command estimator was added to address timing changes caused by the voice and command changes.
|
/// A new version of the command estimator was added to address timing changes caused by the voice and command changes.
|
||||||
@@ -115,16 +117,27 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>This was added in system update 18.0.0</remarks>
|
/// <remarks>This was added in system update 18.0.0</remarks>
|
||||||
public const int Revision13 = 13 << 24;
|
public const int Revision13 = 13 << 24;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// REV14:
|
||||||
|
/// Fixes the Depop Bug.
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>This was added in system update 19.0.0 </remarks>
|
||||||
|
public const int Revision14 = 14 << 24;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// REV15:
|
||||||
|
/// Support for float coefficients in biquad filters
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>This was added in system update 19.0.0 </remarks>
|
||||||
|
public const int Revision15 = 15 << 24;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Last revision supported by the implementation.
|
/// Last revision supported by the implementation.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const int LastRevision = Revision13;
|
public const int LastRevision = Revision15;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Target revision magic supported by the implementation.
|
|
||||||
/// </summary>
|
|
||||||
public const int ProcessRevision = BaseRevisionMagic + LastRevision;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the revision number from the revision magic.
|
/// Get the revision number from the revision magic.
|
||||||
@@ -133,15 +146,25 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
/// <returns>The revision number.</returns>
|
/// <returns>The revision number.</returns>
|
||||||
public static int GetRevisionNumber(int revision) => (revision - BaseRevisionMagic) >> 24;
|
public static int GetRevisionNumber(int revision) => (revision - BaseRevisionMagic) >> 24;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Target revision magic supported by the implementation.
|
||||||
|
/// </summary>
|
||||||
|
public const int ProcessRevision = BaseRevisionMagic + LastRevision;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Current active revision.
|
/// Current active revision.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int UserRevision { get; private set; }
|
public int UserRevision { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Current flags of the <see cref="BehaviourInfo"/>.
|
||||||
|
/// </summary>
|
||||||
|
private ulong _flags;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Error storage.
|
/// Error storage.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly ErrorInfo[] _errorInfos;
|
private readonly Array10<ErrorInfo> _errorInfos;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Current position in the <see cref="_errorInfos"/> array.
|
/// Current position in the <see cref="_errorInfos"/> array.
|
||||||
@@ -149,17 +172,12 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
private uint _errorIndex;
|
private uint _errorIndex;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Current flags of the <see cref="BehaviourContext"/>.
|
/// Create a new instance of <see cref="BehaviourInfo"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private ulong _flags;
|
public BehaviourInfo()
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Create a new instance of <see cref="BehaviourContext"/>.
|
|
||||||
/// </summary>
|
|
||||||
public BehaviourContext()
|
|
||||||
{
|
{
|
||||||
UserRevision = 0;
|
UserRevision = 0;
|
||||||
_errorInfos = new ErrorInfo[Constants.MaxErrorInfos];
|
_errorInfos = new Array10<ErrorInfo>();
|
||||||
_errorIndex = 0;
|
_errorIndex = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,7 +191,7 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Update flags of the <see cref="BehaviourContext"/>.
|
/// Update flags of the <see cref="BehaviourInfo"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="flags">The new flags.</param>
|
/// <param name="flags">The new flags.</param>
|
||||||
public void UpdateFlags(ulong flags)
|
public void UpdateFlags(ulong flags)
|
||||||
@@ -321,9 +339,9 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Check if the audio renderer should support <see cref="Parameter.VoiceInParameter.DecodingBehaviour"/>.
|
/// Check if the audio renderer should support <see cref="VoiceInParameter1.DecodingBehaviour"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>True if the audio renderer should support <see cref="Parameter.VoiceInParameter.DecodingBehaviour"/>.</returns>
|
/// <returns>True if the audio renderer should support <see cref="VoiceInParameter1.DecodingBehaviour"/>.</returns>
|
||||||
public bool IsDecodingBehaviourFlagSupported()
|
public bool IsDecodingBehaviourFlagSupported()
|
||||||
{
|
{
|
||||||
return CheckFeatureSupported(UserRevision, BaseRevisionMagic + Revision5);
|
return CheckFeatureSupported(UserRevision, BaseRevisionMagic + Revision5);
|
||||||
@@ -400,6 +418,24 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
{
|
{
|
||||||
return CheckFeatureSupported(UserRevision, BaseRevisionMagic + Revision13);
|
return CheckFeatureSupported(UserRevision, BaseRevisionMagic + Revision13);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Check if the audio renderer should support the depop bug fix.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>True if the audio renderer supports the depop bug fix</returns>
|
||||||
|
public bool IsSplitterDepopBugFixEnabled()
|
||||||
|
{
|
||||||
|
return CheckFeatureSupported(UserRevision, BaseRevisionMagic + Revision14);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Check if the audio renderer should support biquad filter with float coefficients.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>True if the audio renderer support biquad filter with float coefficients</returns>
|
||||||
|
public bool IsBiquadFilterParameterFloatSupported()
|
||||||
|
{
|
||||||
|
return CheckFeatureSupported(UserRevision, BaseRevisionMagic + Revision15);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the version of the <see cref="ICommandProcessingTimeEstimator"/>.
|
/// Get the version of the <see cref="ICommandProcessingTimeEstimator"/>.
|
||||||
@@ -440,7 +476,7 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
|
|
||||||
if (_errorIndex <= Constants.MaxErrorInfos - 1)
|
if (_errorIndex <= Constants.MaxErrorInfos - 1)
|
||||||
{
|
{
|
||||||
_errorInfos[_errorIndex++] = errorInfo;
|
_errorInfos[(int)_errorIndex++] = errorInfo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -457,22 +493,8 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
}
|
}
|
||||||
|
|
||||||
errorCount = Math.Min(_errorIndex, Constants.MaxErrorInfos);
|
errorCount = Math.Min(_errorIndex, Constants.MaxErrorInfos);
|
||||||
|
|
||||||
for (int i = 0; i < Constants.MaxErrorInfos; i++)
|
_errorInfos.AsSpan().CopyTo(errorInfos);
|
||||||
{
|
|
||||||
if (i < errorCount)
|
|
||||||
{
|
|
||||||
errorInfos[i] = _errorInfos[i];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
errorInfos[i] = new ErrorInfo
|
|
||||||
{
|
|
||||||
ErrorCode = 0,
|
|
||||||
ExtraErrorInfo = 0,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -5,9 +5,11 @@ using Ryujinx.Audio.Renderer.Parameter;
|
|||||||
using Ryujinx.Audio.Renderer.Parameter.Effect;
|
using Ryujinx.Audio.Renderer.Parameter.Effect;
|
||||||
using Ryujinx.Audio.Renderer.Server.Performance;
|
using Ryujinx.Audio.Renderer.Server.Performance;
|
||||||
using Ryujinx.Audio.Renderer.Server.Sink;
|
using Ryujinx.Audio.Renderer.Server.Sink;
|
||||||
|
using Ryujinx.Audio.Renderer.Server.Splitter;
|
||||||
using Ryujinx.Audio.Renderer.Server.Upsampler;
|
using Ryujinx.Audio.Renderer.Server.Upsampler;
|
||||||
using Ryujinx.Audio.Renderer.Server.Voice;
|
using Ryujinx.Audio.Renderer.Server.Voice;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
using CpuAddress = System.UInt64;
|
using CpuAddress = System.UInt64;
|
||||||
|
|
||||||
namespace Ryujinx.Audio.Renderer.Server
|
namespace Ryujinx.Audio.Renderer.Server
|
||||||
@@ -77,7 +79,7 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
/// <param name="bufferOffset">The target buffer offset.</param>
|
/// <param name="bufferOffset">The target buffer offset.</param>
|
||||||
/// <param name="nodeId">The node id associated to this command.</param>
|
/// <param name="nodeId">The node id associated to this command.</param>
|
||||||
/// <param name="wasPlaying">Set to true if the voice was playing previously.</param>
|
/// <param name="wasPlaying">Set to true if the voice was playing previously.</param>
|
||||||
public void GenerateDepopPrepare(Memory<VoiceUpdateState> state, Memory<float> depopBuffer, uint bufferCount, uint bufferOffset, int nodeId, bool wasPlaying)
|
public void GenerateDepopPrepare(Memory<VoiceState> state, Memory<float> depopBuffer, uint bufferCount, uint bufferOffset, int nodeId, bool wasPlaying)
|
||||||
{
|
{
|
||||||
DepopPrepareCommand command = new(state, depopBuffer, bufferCount, bufferOffset, nodeId, wasPlaying);
|
DepopPrepareCommand command = new(state, depopBuffer, bufferCount, bufferOffset, nodeId, wasPlaying);
|
||||||
|
|
||||||
@@ -120,14 +122,14 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create a new <see cref="DataSourceVersion2Command"/>.
|
/// Create a new <see cref="DataSourceVersion2Command"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="voiceState">The <see cref="VoiceState"/> to generate the command from.</param>
|
/// <param name="voiceInfo">The <see cref="VoiceInfo"/> to generate the command from.</param>
|
||||||
/// <param name="state">The <see cref="VoiceUpdateState"/> to generate the command from.</param>
|
/// <param name="state">The <see cref="VoiceState"/> to generate the command from.</param>
|
||||||
/// <param name="outputBufferIndex">The output buffer index to use.</param>
|
/// <param name="outputBufferIndex">The output buffer index to use.</param>
|
||||||
/// <param name="channelIndex">The target channel index.</param>
|
/// <param name="channelIndex">The target channel index.</param>
|
||||||
/// <param name="nodeId">The node id associated to this command.</param>
|
/// <param name="nodeId">The node id associated to this command.</param>
|
||||||
public void GenerateDataSourceVersion2(ref VoiceState voiceState, Memory<VoiceUpdateState> state, ushort outputBufferIndex, ushort channelIndex, int nodeId)
|
public void GenerateDataSourceVersion2(ref VoiceInfo voiceInfo, Memory<VoiceState> state, ushort outputBufferIndex, ushort channelIndex, int nodeId)
|
||||||
{
|
{
|
||||||
DataSourceVersion2Command command = new(ref voiceState, state, outputBufferIndex, channelIndex, nodeId);
|
DataSourceVersion2Command command = new(ref voiceInfo, state, outputBufferIndex, channelIndex, nodeId);
|
||||||
|
|
||||||
command.EstimatedProcessingTime = _commandProcessingTimeEstimator.Estimate(command);
|
command.EstimatedProcessingTime = _commandProcessingTimeEstimator.Estimate(command);
|
||||||
|
|
||||||
@@ -137,14 +139,14 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create a new <see cref="PcmInt16DataSourceCommandVersion1"/>.
|
/// Create a new <see cref="PcmInt16DataSourceCommandVersion1"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="voiceState">The <see cref="VoiceState"/> to generate the command from.</param>
|
/// <param name="voiceInfo">The <see cref="VoiceInfo"/> to generate the command from.</param>
|
||||||
/// <param name="state">The <see cref="VoiceUpdateState"/> to generate the command from.</param>
|
/// <param name="state">The <see cref="VoiceState"/> to generate the command from.</param>
|
||||||
/// <param name="outputBufferIndex">The output buffer index to use.</param>
|
/// <param name="outputBufferIndex">The output buffer index to use.</param>
|
||||||
/// <param name="channelIndex">The target channel index.</param>
|
/// <param name="channelIndex">The target channel index.</param>
|
||||||
/// <param name="nodeId">The node id associated to this command.</param>
|
/// <param name="nodeId">The node id associated to this command.</param>
|
||||||
public void GeneratePcmInt16DataSourceVersion1(ref VoiceState voiceState, Memory<VoiceUpdateState> state, ushort outputBufferIndex, ushort channelIndex, int nodeId)
|
public void GeneratePcmInt16DataSourceVersion1(ref VoiceInfo voiceInfo, Memory<VoiceState> state, ushort outputBufferIndex, ushort channelIndex, int nodeId)
|
||||||
{
|
{
|
||||||
PcmInt16DataSourceCommandVersion1 command = new(ref voiceState, state, outputBufferIndex, channelIndex, nodeId);
|
PcmInt16DataSourceCommandVersion1 command = new(ref voiceInfo, state, outputBufferIndex, channelIndex, nodeId);
|
||||||
|
|
||||||
command.EstimatedProcessingTime = _commandProcessingTimeEstimator.Estimate(command);
|
command.EstimatedProcessingTime = _commandProcessingTimeEstimator.Estimate(command);
|
||||||
|
|
||||||
@@ -154,14 +156,14 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create a new <see cref="PcmFloatDataSourceCommandVersion1"/>.
|
/// Create a new <see cref="PcmFloatDataSourceCommandVersion1"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="voiceState">The <see cref="VoiceState"/> to generate the command from.</param>
|
/// <param name="voiceInfo">The <see cref="VoiceInfo"/> to generate the command from.</param>
|
||||||
/// <param name="state">The <see cref="VoiceUpdateState"/> to generate the command from.</param>
|
/// <param name="state">The <see cref="VoiceState"/> to generate the command from.</param>
|
||||||
/// <param name="outputBufferIndex">The output buffer index to use.</param>
|
/// <param name="outputBufferIndex">The output buffer index to use.</param>
|
||||||
/// <param name="channelIndex">The target channel index.</param>
|
/// <param name="channelIndex">The target channel index.</param>
|
||||||
/// <param name="nodeId">The node id associated to this command.</param>
|
/// <param name="nodeId">The node id associated to this command.</param>
|
||||||
public void GeneratePcmFloatDataSourceVersion1(ref VoiceState voiceState, Memory<VoiceUpdateState> state, ushort outputBufferIndex, ushort channelIndex, int nodeId)
|
public void GeneratePcmFloatDataSourceVersion1(ref VoiceInfo voiceInfo, Memory<VoiceState> state, ushort outputBufferIndex, ushort channelIndex, int nodeId)
|
||||||
{
|
{
|
||||||
PcmFloatDataSourceCommandVersion1 command = new(ref voiceState, state, outputBufferIndex, channelIndex, nodeId);
|
PcmFloatDataSourceCommandVersion1 command = new(ref voiceInfo, state, outputBufferIndex, channelIndex, nodeId);
|
||||||
|
|
||||||
command.EstimatedProcessingTime = _commandProcessingTimeEstimator.Estimate(command);
|
command.EstimatedProcessingTime = _commandProcessingTimeEstimator.Estimate(command);
|
||||||
|
|
||||||
@@ -171,13 +173,13 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create a new <see cref="AdpcmDataSourceCommandVersion1"/>.
|
/// Create a new <see cref="AdpcmDataSourceCommandVersion1"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="voiceState">The <see cref="VoiceState"/> to generate the command from.</param>
|
/// <param name="voiceInfo">The <see cref="VoiceInfo"/> to generate the command from.</param>
|
||||||
/// <param name="state">The <see cref="VoiceUpdateState"/> to generate the command from.</param>
|
/// <param name="state">The <see cref="VoiceState"/> to generate the command from.</param>
|
||||||
/// <param name="outputBufferIndex">The output buffer index to use.</param>
|
/// <param name="outputBufferIndex">The output buffer index to use.</param>
|
||||||
/// <param name="nodeId">The node id associated to this command.</param>
|
/// <param name="nodeId">The node id associated to this command.</param>
|
||||||
public void GenerateAdpcmDataSourceVersion1(ref VoiceState voiceState, Memory<VoiceUpdateState> state, ushort outputBufferIndex, int nodeId)
|
public void GenerateAdpcmDataSourceVersion1(ref VoiceInfo voiceInfo, Memory<VoiceState> state, ushort outputBufferIndex, int nodeId)
|
||||||
{
|
{
|
||||||
AdpcmDataSourceCommandVersion1 command = new(ref voiceState, state, outputBufferIndex, nodeId);
|
AdpcmDataSourceCommandVersion1 command = new(ref voiceInfo, state, outputBufferIndex, nodeId);
|
||||||
|
|
||||||
command.EstimatedProcessingTime = _commandProcessingTimeEstimator.Estimate(command);
|
command.EstimatedProcessingTime = _commandProcessingTimeEstimator.Estimate(command);
|
||||||
|
|
||||||
@@ -194,7 +196,7 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
/// <param name="outputBufferOffset">The output buffer offset.</param>
|
/// <param name="outputBufferOffset">The output buffer offset.</param>
|
||||||
/// <param name="needInitialization">Set to true if the biquad filter state needs to be initialized.</param>
|
/// <param name="needInitialization">Set to true if the biquad filter state needs to be initialized.</param>
|
||||||
/// <param name="nodeId">The node id associated to this command.</param>
|
/// <param name="nodeId">The node id associated to this command.</param>
|
||||||
public void GenerateBiquadFilter(int baseIndex, ref BiquadFilterParameter filter, Memory<BiquadFilterState> biquadFilterStateMemory, int inputBufferOffset, int outputBufferOffset, bool needInitialization, int nodeId)
|
public void GenerateBiquadFilter(int baseIndex, ref BiquadFilterParameter2 filter, Memory<BiquadFilterState> biquadFilterStateMemory, int inputBufferOffset, int outputBufferOffset, bool needInitialization, int nodeId)
|
||||||
{
|
{
|
||||||
BiquadFilterCommand command = new(baseIndex, ref filter, biquadFilterStateMemory, inputBufferOffset, outputBufferOffset, needInitialization, nodeId);
|
BiquadFilterCommand command = new(baseIndex, ref filter, biquadFilterStateMemory, inputBufferOffset, outputBufferOffset, needInitialization, nodeId);
|
||||||
|
|
||||||
@@ -213,7 +215,7 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
/// <param name="outputBufferOffset">The output buffer offset.</param>
|
/// <param name="outputBufferOffset">The output buffer offset.</param>
|
||||||
/// <param name="isInitialized">Set to true if the biquad filter state is initialized.</param>
|
/// <param name="isInitialized">Set to true if the biquad filter state is initialized.</param>
|
||||||
/// <param name="nodeId">The node id associated to this command.</param>
|
/// <param name="nodeId">The node id associated to this command.</param>
|
||||||
public void GenerateMultiTapBiquadFilter(int baseIndex, ReadOnlySpan<BiquadFilterParameter> filters, Memory<BiquadFilterState> biquadFilterStatesMemory, int inputBufferOffset, int outputBufferOffset, ReadOnlySpan<bool> isInitialized, int nodeId)
|
public void GenerateMultiTapBiquadFilter(int baseIndex, ReadOnlySpan<BiquadFilterParameter2> filters, Memory<BiquadFilterState> biquadFilterStatesMemory, int inputBufferOffset, int outputBufferOffset, ReadOnlySpan<bool> isInitialized, int nodeId)
|
||||||
{
|
{
|
||||||
MultiTapBiquadFilterCommand command = new(baseIndex, filters, biquadFilterStatesMemory, inputBufferOffset, outputBufferOffset, isInitialized, nodeId);
|
MultiTapBiquadFilterCommand command = new(baseIndex, filters, biquadFilterStatesMemory, inputBufferOffset, outputBufferOffset, isInitialized, nodeId);
|
||||||
|
|
||||||
@@ -230,9 +232,9 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
/// <param name="outputBufferIndex">The base output index.</param>
|
/// <param name="outputBufferIndex">The base output index.</param>
|
||||||
/// <param name="previousVolume">The previous volume.</param>
|
/// <param name="previousVolume">The previous volume.</param>
|
||||||
/// <param name="volume">The new volume.</param>
|
/// <param name="volume">The new volume.</param>
|
||||||
/// <param name="state">The <see cref="VoiceUpdateState"/> to generate the command from.</param>
|
/// <param name="state">The <see cref="VoiceState"/> to generate the command from.</param>
|
||||||
/// <param name="nodeId">The node id associated to this command.</param>
|
/// <param name="nodeId">The node id associated to this command.</param>
|
||||||
public void GenerateMixRampGrouped(uint mixBufferCount, uint inputBufferIndex, uint outputBufferIndex, ReadOnlySpan<float> previousVolume, ReadOnlySpan<float> volume, Memory<VoiceUpdateState> state, int nodeId)
|
public void GenerateMixRampGrouped(uint mixBufferCount, uint inputBufferIndex, uint outputBufferIndex, ReadOnlySpan<float> previousVolume, ReadOnlySpan<float> volume, Memory<VoiceState> state, int nodeId)
|
||||||
{
|
{
|
||||||
MixRampGroupedCommand command = new(mixBufferCount, inputBufferIndex, outputBufferIndex, previousVolume, volume, state, nodeId);
|
MixRampGroupedCommand command = new(mixBufferCount, inputBufferIndex, outputBufferIndex, previousVolume, volume, state, nodeId);
|
||||||
|
|
||||||
@@ -248,10 +250,10 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
/// <param name="volume">The new volume.</param>
|
/// <param name="volume">The new volume.</param>
|
||||||
/// <param name="inputBufferIndex">The input buffer index.</param>
|
/// <param name="inputBufferIndex">The input buffer index.</param>
|
||||||
/// <param name="outputBufferIndex">The output buffer index.</param>
|
/// <param name="outputBufferIndex">The output buffer index.</param>
|
||||||
/// <param name="lastSampleIndex">The index in the <see cref="VoiceUpdateState.LastSamples"/> array to store the ramped sample.</param>
|
/// <param name="lastSampleIndex">The index in the <see cref="VoiceState.LastSamples"/> array to store the ramped sample.</param>
|
||||||
/// <param name="state">The <see cref="VoiceUpdateState"/> to generate the command from.</param>
|
/// <param name="state">The <see cref="VoiceState"/> to generate the command from.</param>
|
||||||
/// <param name="nodeId">The node id associated to this command.</param>
|
/// <param name="nodeId">The node id associated to this command.</param>
|
||||||
public void GenerateMixRamp(float previousVolume, float volume, uint inputBufferIndex, uint outputBufferIndex, int lastSampleIndex, Memory<VoiceUpdateState> state, int nodeId)
|
public void GenerateMixRamp(float previousVolume, float volume, uint inputBufferIndex, uint outputBufferIndex, int lastSampleIndex, Memory<VoiceState> state, int nodeId)
|
||||||
{
|
{
|
||||||
MixRampCommand command = new(previousVolume, volume, inputBufferIndex, outputBufferIndex, lastSampleIndex, state, nodeId);
|
MixRampCommand command = new(previousVolume, volume, inputBufferIndex, outputBufferIndex, lastSampleIndex, state, nodeId);
|
||||||
|
|
||||||
@@ -267,8 +269,8 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
/// <param name="volume">The new volume.</param>
|
/// <param name="volume">The new volume.</param>
|
||||||
/// <param name="inputBufferIndex">The input buffer index.</param>
|
/// <param name="inputBufferIndex">The input buffer index.</param>
|
||||||
/// <param name="outputBufferIndex">The output buffer index.</param>
|
/// <param name="outputBufferIndex">The output buffer index.</param>
|
||||||
/// <param name="lastSampleIndex">The index in the <see cref="VoiceUpdateState.LastSamples"/> array to store the ramped sample.</param>
|
/// <param name="lastSampleIndex">The index in the <see cref="VoiceState.LastSamples"/> array to store the ramped sample.</param>
|
||||||
/// <param name="state">The <see cref="VoiceUpdateState"/> to generate the command from.</param>
|
/// <param name="state">The <see cref="VoiceState"/> to generate the command from.</param>
|
||||||
/// <param name="filter">The biquad filter parameter.</param>
|
/// <param name="filter">The biquad filter parameter.</param>
|
||||||
/// <param name="biquadFilterState">The biquad state.</param>
|
/// <param name="biquadFilterState">The biquad state.</param>
|
||||||
/// <param name="previousBiquadFilterState">The previous biquad state.</param>
|
/// <param name="previousBiquadFilterState">The previous biquad state.</param>
|
||||||
@@ -282,8 +284,8 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
uint inputBufferIndex,
|
uint inputBufferIndex,
|
||||||
uint outputBufferIndex,
|
uint outputBufferIndex,
|
||||||
int lastSampleIndex,
|
int lastSampleIndex,
|
||||||
Memory<VoiceUpdateState> state,
|
Memory<VoiceState> state,
|
||||||
ref BiquadFilterParameter filter,
|
ref BiquadFilterParameter2 filter,
|
||||||
Memory<BiquadFilterState> biquadFilterState,
|
Memory<BiquadFilterState> biquadFilterState,
|
||||||
Memory<BiquadFilterState> previousBiquadFilterState,
|
Memory<BiquadFilterState> previousBiquadFilterState,
|
||||||
bool needInitialization,
|
bool needInitialization,
|
||||||
@@ -318,8 +320,8 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
/// <param name="volume">The new volume.</param>
|
/// <param name="volume">The new volume.</param>
|
||||||
/// <param name="inputBufferIndex">The input buffer index.</param>
|
/// <param name="inputBufferIndex">The input buffer index.</param>
|
||||||
/// <param name="outputBufferIndex">The output buffer index.</param>
|
/// <param name="outputBufferIndex">The output buffer index.</param>
|
||||||
/// <param name="lastSampleIndex">The index in the <see cref="VoiceUpdateState.LastSamples"/> array to store the ramped sample.</param>
|
/// <param name="lastSampleIndex">The index in the <see cref="VoiceState.LastSamples"/> array to store the ramped sample.</param>
|
||||||
/// <param name="state">The <see cref="VoiceUpdateState"/> to generate the command from.</param>
|
/// <param name="state">The <see cref="VoiceState"/> to generate the command from.</param>
|
||||||
/// <param name="filter0">First biquad filter parameter.</param>
|
/// <param name="filter0">First biquad filter parameter.</param>
|
||||||
/// <param name="filter1">Second biquad filter parameter.</param>
|
/// <param name="filter1">Second biquad filter parameter.</param>
|
||||||
/// <param name="biquadFilterState0">First biquad state.</param>
|
/// <param name="biquadFilterState0">First biquad state.</param>
|
||||||
@@ -337,9 +339,9 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
uint inputBufferIndex,
|
uint inputBufferIndex,
|
||||||
uint outputBufferIndex,
|
uint outputBufferIndex,
|
||||||
int lastSampleIndex,
|
int lastSampleIndex,
|
||||||
Memory<VoiceUpdateState> state,
|
Memory<VoiceState> state,
|
||||||
ref BiquadFilterParameter filter0,
|
ref BiquadFilterParameter2 filter0,
|
||||||
ref BiquadFilterParameter filter1,
|
ref BiquadFilterParameter2 filter1,
|
||||||
Memory<BiquadFilterState> biquadFilterState0,
|
Memory<BiquadFilterState> biquadFilterState0,
|
||||||
Memory<BiquadFilterState> biquadFilterState1,
|
Memory<BiquadFilterState> biquadFilterState1,
|
||||||
Memory<BiquadFilterState> previousBiquadFilterState0,
|
Memory<BiquadFilterState> previousBiquadFilterState0,
|
||||||
@@ -654,14 +656,14 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
/// Create a new <see cref="UpsampleCommand"/>.
|
/// Create a new <see cref="UpsampleCommand"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="bufferOffset">The offset of the mix buffer.</param>
|
/// <param name="bufferOffset">The offset of the mix buffer.</param>
|
||||||
/// <param name="upsampler">The <see cref="UpsamplerState"/> associated.</param>
|
/// <param name="upsampler">The <see cref="UpsamplerInfo"/> associated.</param>
|
||||||
/// <param name="inputCount">The total input count.</param>
|
/// <param name="inputCount">The total input count.</param>
|
||||||
/// <param name="inputBufferOffset">The input buffer mix offset.</param>
|
/// <param name="inputBufferOffset">The input buffer mix offset.</param>
|
||||||
/// <param name="bufferCountPerSample">The buffer count per sample.</param>
|
/// <param name="bufferCountPerSample">The buffer count per sample.</param>
|
||||||
/// <param name="sampleCount">The source sample count.</param>
|
/// <param name="sampleCount">The source sample count.</param>
|
||||||
/// <param name="sampleRate">The source sample rate.</param>
|
/// <param name="sampleRate">The source sample rate.</param>
|
||||||
/// <param name="nodeId">The node id associated to this command.</param>
|
/// <param name="nodeId">The node id associated to this command.</param>
|
||||||
public void GenerateUpsample(uint bufferOffset, UpsamplerState upsampler, uint inputCount, Span<byte> inputBufferOffset, uint bufferCountPerSample, uint sampleCount, uint sampleRate, int nodeId)
|
public void GenerateUpsample(uint bufferOffset, UpsamplerInfo upsampler, uint inputCount, Span<byte> inputBufferOffset, uint bufferCountPerSample, uint sampleCount, uint sampleRate, int nodeId)
|
||||||
{
|
{
|
||||||
UpsampleCommand command = new(bufferOffset, upsampler, inputCount, inputBufferOffset, bufferCountPerSample, sampleCount, sampleRate, nodeId);
|
UpsampleCommand command = new(bufferOffset, upsampler, inputCount, inputBufferOffset, bufferCountPerSample, sampleCount, sampleRate, nodeId);
|
||||||
|
|
||||||
@@ -686,5 +688,23 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
|
|
||||||
AddCommand(command);
|
AddCommand(command);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void GenerateFillBuffer(SplitterDestination destination, float value, int length, int nodeId)
|
||||||
|
{
|
||||||
|
FillBufferCommand command;
|
||||||
|
|
||||||
|
if (Unsafe.IsNullRef(ref destination.GetV2RefOrNull()))
|
||||||
|
{
|
||||||
|
command = new(destination.GetV1RefOrNull(), length, value, nodeId);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
command = new(destination.GetV2RefOrNull(), length, value, nodeId);
|
||||||
|
}
|
||||||
|
|
||||||
|
command.EstimatedProcessingTime = _commandProcessingTimeEstimator.Estimate(command);
|
||||||
|
|
||||||
|
AddCommand(command);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using Ryujinx.Audio.Common;
|
using Ryujinx.Audio.Common;
|
||||||
using Ryujinx.Audio.Renderer.Common;
|
using Ryujinx.Audio.Renderer.Common;
|
||||||
|
using Ryujinx.Audio.Renderer.Dsp;
|
||||||
using Ryujinx.Audio.Renderer.Dsp.Command;
|
using Ryujinx.Audio.Renderer.Dsp.Command;
|
||||||
using Ryujinx.Audio.Renderer.Dsp.State;
|
using Ryujinx.Audio.Renderer.Dsp.State;
|
||||||
using Ryujinx.Audio.Renderer.Parameter;
|
using Ryujinx.Audio.Renderer.Parameter;
|
||||||
@@ -41,27 +42,27 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
_commandBuffer.GenerateClearMixBuffer(Constants.InvalidNodeId);
|
_commandBuffer.GenerateClearMixBuffer(Constants.InvalidNodeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void GenerateDataSource(ref VoiceState voiceState, Memory<VoiceUpdateState> dspState, int channelIndex)
|
private void GenerateDataSource(ref VoiceInfo voiceInfo, Memory<VoiceState> dspState, int channelIndex)
|
||||||
{
|
{
|
||||||
if (voiceState.MixId != Constants.UnusedMixId)
|
if (voiceInfo.MixId != Constants.UnusedMixId)
|
||||||
{
|
{
|
||||||
ref MixState mix = ref _mixContext.GetState(voiceState.MixId);
|
ref MixInfo mix = ref _mixContext.GetState(voiceInfo.MixId);
|
||||||
|
|
||||||
_commandBuffer.GenerateDepopPrepare(
|
_commandBuffer.GenerateDepopPrepare(
|
||||||
dspState,
|
dspState,
|
||||||
_rendererContext.DepopBuffer,
|
_rendererContext.DepopBuffer,
|
||||||
mix.BufferCount,
|
mix.BufferCount,
|
||||||
mix.BufferOffset,
|
mix.BufferOffset,
|
||||||
voiceState.NodeId,
|
voiceInfo.NodeId,
|
||||||
voiceState.WasPlaying);
|
voiceInfo.WasPlaying);
|
||||||
}
|
}
|
||||||
else if (voiceState.SplitterId != Constants.UnusedSplitterId)
|
else if (voiceInfo.SplitterId != Constants.UnusedSplitterId)
|
||||||
{
|
{
|
||||||
int destinationId = 0;
|
int destinationId = 0;
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
SplitterDestination destination = _splitterContext.GetDestination((int)voiceState.SplitterId, destinationId++);
|
SplitterDestination destination = _splitterContext.GetDestination((int)voiceInfo.SplitterId, destinationId++);
|
||||||
|
|
||||||
if (destination.IsNull)
|
if (destination.IsNull)
|
||||||
{
|
{
|
||||||
@@ -74,15 +75,17 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
|
|
||||||
if (mixId < _mixContext.GetCount() && mixId != Constants.UnusedSplitterIdInt)
|
if (mixId < _mixContext.GetCount() && mixId != Constants.UnusedSplitterIdInt)
|
||||||
{
|
{
|
||||||
ref MixState mix = ref _mixContext.GetState(mixId);
|
ref MixInfo mix = ref _mixContext.GetState(mixId);
|
||||||
|
|
||||||
|
// _commandBuffer.GenerateFillBuffer();
|
||||||
|
|
||||||
_commandBuffer.GenerateDepopPrepare(
|
_commandBuffer.GenerateDepopPrepare(
|
||||||
dspState,
|
dspState,
|
||||||
_rendererContext.DepopBuffer,
|
_rendererContext.DepopBuffer,
|
||||||
mix.BufferCount,
|
mix.BufferCount,
|
||||||
mix.BufferOffset,
|
mix.BufferOffset,
|
||||||
voiceState.NodeId,
|
voiceInfo.NodeId,
|
||||||
voiceState.WasPlaying);
|
voiceInfo.WasPlaying);
|
||||||
|
|
||||||
destination.MarkAsNeedToUpdateInternalState();
|
destination.MarkAsNeedToUpdateInternalState();
|
||||||
}
|
}
|
||||||
@@ -90,71 +93,71 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!voiceState.WasPlaying)
|
if (!voiceInfo.WasPlaying)
|
||||||
{
|
{
|
||||||
Debug.Assert(voiceState.SampleFormat != SampleFormat.Adpcm || channelIndex == 0);
|
Debug.Assert(voiceInfo.SampleFormat != SampleFormat.Adpcm || channelIndex == 0);
|
||||||
|
|
||||||
if (_rendererContext.BehaviourContext.IsWaveBufferVersion2Supported())
|
if (_rendererContext.BehaviourInfo.IsWaveBufferVersion2Supported())
|
||||||
{
|
{
|
||||||
_commandBuffer.GenerateDataSourceVersion2(
|
_commandBuffer.GenerateDataSourceVersion2(
|
||||||
ref voiceState,
|
ref voiceInfo,
|
||||||
dspState,
|
dspState,
|
||||||
(ushort)_rendererContext.MixBufferCount,
|
(ushort)_rendererContext.MixBufferCount,
|
||||||
(ushort)channelIndex,
|
(ushort)channelIndex,
|
||||||
voiceState.NodeId);
|
voiceInfo.NodeId);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
switch (voiceState.SampleFormat)
|
switch (voiceInfo.SampleFormat)
|
||||||
{
|
{
|
||||||
case SampleFormat.PcmInt16:
|
case SampleFormat.PcmInt16:
|
||||||
_commandBuffer.GeneratePcmInt16DataSourceVersion1(
|
_commandBuffer.GeneratePcmInt16DataSourceVersion1(
|
||||||
ref voiceState,
|
ref voiceInfo,
|
||||||
dspState,
|
dspState,
|
||||||
(ushort)_rendererContext.MixBufferCount,
|
(ushort)_rendererContext.MixBufferCount,
|
||||||
(ushort)channelIndex,
|
(ushort)channelIndex,
|
||||||
voiceState.NodeId);
|
voiceInfo.NodeId);
|
||||||
break;
|
break;
|
||||||
case SampleFormat.PcmFloat:
|
case SampleFormat.PcmFloat:
|
||||||
_commandBuffer.GeneratePcmFloatDataSourceVersion1(
|
_commandBuffer.GeneratePcmFloatDataSourceVersion1(
|
||||||
ref voiceState,
|
ref voiceInfo,
|
||||||
dspState,
|
dspState,
|
||||||
(ushort)_rendererContext.MixBufferCount,
|
(ushort)_rendererContext.MixBufferCount,
|
||||||
(ushort)channelIndex,
|
(ushort)channelIndex,
|
||||||
voiceState.NodeId);
|
voiceInfo.NodeId);
|
||||||
break;
|
break;
|
||||||
case SampleFormat.Adpcm:
|
case SampleFormat.Adpcm:
|
||||||
_commandBuffer.GenerateAdpcmDataSourceVersion1(
|
_commandBuffer.GenerateAdpcmDataSourceVersion1(
|
||||||
ref voiceState,
|
ref voiceInfo,
|
||||||
dspState,
|
dspState,
|
||||||
(ushort)_rendererContext.MixBufferCount,
|
(ushort)_rendererContext.MixBufferCount,
|
||||||
voiceState.NodeId);
|
voiceInfo.NodeId);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new NotImplementedException($"Unsupported data source {voiceState.SampleFormat}");
|
throw new NotImplementedException($"Unsupported data source {voiceInfo.SampleFormat}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void GenerateBiquadFilterForVoice(ref VoiceState voiceState, Memory<VoiceUpdateState> state, int baseIndex, int bufferOffset, int nodeId)
|
private void GenerateBiquadFilterForVoice(ref VoiceInfo voiceInfo, Memory<VoiceState> state, int baseIndex, int bufferOffset, int nodeId)
|
||||||
{
|
{
|
||||||
bool supportsOptimizedPath = _rendererContext.BehaviourContext.UseMultiTapBiquadFilterProcessing();
|
bool supportsOptimizedPath = _rendererContext.BehaviourInfo.UseMultiTapBiquadFilterProcessing();
|
||||||
|
|
||||||
Span<BiquadFilterParameter> biquadFiltersSpan = voiceState.BiquadFilters.AsSpan();
|
Span<BiquadFilterParameter2> biquadFiltersSpan = voiceInfo.BiquadFilters.AsSpan();
|
||||||
|
|
||||||
if (supportsOptimizedPath && biquadFiltersSpan[0].Enable && biquadFiltersSpan[1].Enable)
|
if (supportsOptimizedPath && biquadFiltersSpan[0].Enable && biquadFiltersSpan[1].Enable)
|
||||||
{
|
{
|
||||||
Memory<byte> biquadStateRawMemory = SpanMemoryManager<byte>.Cast(state)[..(Unsafe.SizeOf<BiquadFilterState>() * Constants.VoiceBiquadFilterCount)];
|
Memory<byte> biquadStateRawMemory = SpanMemoryManager<byte>.Cast(state)[..(Unsafe.SizeOf<BiquadFilterState>() * Constants.VoiceBiquadFilterCount)];
|
||||||
Memory<BiquadFilterState> stateMemory = SpanMemoryManager<BiquadFilterState>.Cast(biquadStateRawMemory);
|
Memory<BiquadFilterState> stateMemory = SpanMemoryManager<BiquadFilterState>.Cast(biquadStateRawMemory);
|
||||||
|
|
||||||
_commandBuffer.GenerateMultiTapBiquadFilter(baseIndex, biquadFiltersSpan, stateMemory, bufferOffset, bufferOffset, voiceState.BiquadFilterNeedInitialization, nodeId);
|
_commandBuffer.GenerateMultiTapBiquadFilter(baseIndex, biquadFiltersSpan, stateMemory, bufferOffset, bufferOffset, voiceInfo.BiquadFilterNeedInitialization, nodeId);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (int i = 0; i < biquadFiltersSpan.Length; i++)
|
for (int i = 0; i < biquadFiltersSpan.Length; i++)
|
||||||
{
|
{
|
||||||
ref BiquadFilterParameter filter = ref biquadFiltersSpan[i];
|
ref BiquadFilterParameter2 filter = ref biquadFiltersSpan[i];
|
||||||
|
|
||||||
if (filter.Enable)
|
if (filter.Enable)
|
||||||
{
|
{
|
||||||
@@ -167,7 +170,7 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
stateMemory.Slice(i, 1),
|
stateMemory.Slice(i, 1),
|
||||||
bufferOffset,
|
bufferOffset,
|
||||||
bufferOffset,
|
bufferOffset,
|
||||||
!voiceState.BiquadFilterNeedInitialization[i],
|
!voiceInfo.BiquadFilterNeedInitialization[i],
|
||||||
nodeId);
|
nodeId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -176,7 +179,7 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
|
|
||||||
private void GenerateVoiceMixWithSplitter(
|
private void GenerateVoiceMixWithSplitter(
|
||||||
SplitterDestination destination,
|
SplitterDestination destination,
|
||||||
Memory<VoiceUpdateState> state,
|
Memory<VoiceState> state,
|
||||||
uint bufferOffset,
|
uint bufferOffset,
|
||||||
uint bufferCount,
|
uint bufferCount,
|
||||||
uint bufferIndex,
|
uint bufferIndex,
|
||||||
@@ -185,8 +188,8 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
ReadOnlySpan<float> mixVolumes = destination.MixBufferVolume;
|
ReadOnlySpan<float> mixVolumes = destination.MixBufferVolume;
|
||||||
ReadOnlySpan<float> previousMixVolumes = destination.PreviousMixBufferVolume;
|
ReadOnlySpan<float> previousMixVolumes = destination.PreviousMixBufferVolume;
|
||||||
|
|
||||||
ref BiquadFilterParameter bqf0 = ref destination.GetBiquadFilterParameter(0);
|
ref BiquadFilterParameter2 bqf0 = ref destination.GetBiquadFilterParameter(0);
|
||||||
ref BiquadFilterParameter bqf1 = ref destination.GetBiquadFilterParameter(1);
|
ref BiquadFilterParameter2 bqf1 = ref destination.GetBiquadFilterParameter(1);
|
||||||
|
|
||||||
Memory<BiquadFilterState> bqfState = _splitterContext.GetBiquadFilterState(destination);
|
Memory<BiquadFilterState> bqfState = _splitterContext.GetBiquadFilterState(destination);
|
||||||
|
|
||||||
@@ -270,7 +273,7 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
private void GenerateVoiceMix(
|
private void GenerateVoiceMix(
|
||||||
ReadOnlySpan<float> mixVolumes,
|
ReadOnlySpan<float> mixVolumes,
|
||||||
ReadOnlySpan<float> previousMixVolumes,
|
ReadOnlySpan<float> previousMixVolumes,
|
||||||
Memory<VoiceUpdateState> state,
|
Memory<VoiceState> state,
|
||||||
uint bufferOffset,
|
uint bufferOffset,
|
||||||
uint bufferCount,
|
uint bufferCount,
|
||||||
uint bufferIndex,
|
uint bufferIndex,
|
||||||
@@ -309,27 +312,27 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void GenerateVoice(ref VoiceState voiceState)
|
private void GenerateVoice(ref VoiceInfo voiceInfo)
|
||||||
{
|
{
|
||||||
int nodeId = voiceState.NodeId;
|
int nodeId = voiceInfo.NodeId;
|
||||||
uint channelsCount = voiceState.ChannelsCount;
|
uint channelsCount = voiceInfo.ChannelsCount;
|
||||||
|
|
||||||
Span<int> channelResourceIdsSpan = voiceState.ChannelResourceIds.AsSpan();
|
Span<int> channelResourceIdsSpan = voiceInfo.ChannelResourceIds.AsSpan();
|
||||||
Span<BiquadFilterParameter> biquadFiltersSpan = voiceState.BiquadFilters.AsSpan();
|
Span<BiquadFilterParameter2> biquadFiltersSpan = voiceInfo.BiquadFilters.AsSpan();
|
||||||
|
|
||||||
for (int channelIndex = 0; channelIndex < channelsCount; channelIndex++)
|
for (int channelIndex = 0; channelIndex < channelsCount; channelIndex++)
|
||||||
{
|
{
|
||||||
Memory<VoiceUpdateState> dspStateMemory = _voiceContext.GetUpdateStateForDsp(channelResourceIdsSpan[channelIndex]);
|
Memory<VoiceState> dspStateMemory = _voiceContext.GetUpdateStateForDsp(channelResourceIdsSpan[channelIndex]);
|
||||||
|
|
||||||
ref VoiceChannelResource channelResource = ref _voiceContext.GetChannelResource(channelResourceIdsSpan[channelIndex]);
|
ref VoiceChannelResource channelResource = ref _voiceContext.GetChannelResource(channelResourceIdsSpan[channelIndex]);
|
||||||
|
|
||||||
PerformanceDetailType dataSourceDetailType = PerformanceDetailType.Adpcm;
|
PerformanceDetailType dataSourceDetailType = PerformanceDetailType.Adpcm;
|
||||||
|
|
||||||
if (voiceState.SampleFormat == SampleFormat.PcmInt16)
|
if (voiceInfo.SampleFormat == SampleFormat.PcmInt16)
|
||||||
{
|
{
|
||||||
dataSourceDetailType = PerformanceDetailType.PcmInt16;
|
dataSourceDetailType = PerformanceDetailType.PcmInt16;
|
||||||
}
|
}
|
||||||
else if (voiceState.SampleFormat == SampleFormat.PcmFloat)
|
else if (voiceInfo.SampleFormat == SampleFormat.PcmFloat)
|
||||||
{
|
{
|
||||||
dataSourceDetailType = PerformanceDetailType.PcmFloat;
|
dataSourceDetailType = PerformanceDetailType.PcmFloat;
|
||||||
}
|
}
|
||||||
@@ -345,18 +348,18 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
GeneratePerformance(ref performanceEntry, PerformanceCommand.Type.Start, nodeId);
|
GeneratePerformance(ref performanceEntry, PerformanceCommand.Type.Start, nodeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
GenerateDataSource(ref voiceState, dspStateMemory, channelIndex);
|
GenerateDataSource(ref voiceInfo, dspStateMemory, channelIndex);
|
||||||
|
|
||||||
if (performanceInitialized)
|
if (performanceInitialized)
|
||||||
{
|
{
|
||||||
GeneratePerformance(ref performanceEntry, PerformanceCommand.Type.End, nodeId);
|
GeneratePerformance(ref performanceEntry, PerformanceCommand.Type.End, nodeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (voiceState.WasPlaying)
|
if (voiceInfo.WasPlaying)
|
||||||
{
|
{
|
||||||
voiceState.PreviousVolume = 0.0f;
|
voiceInfo.PreviousVolume = 0.0f;
|
||||||
}
|
}
|
||||||
else if (voiceState.HasAnyDestination())
|
else if (voiceInfo.HasAnyDestination())
|
||||||
{
|
{
|
||||||
performanceInitialized = false;
|
performanceInitialized = false;
|
||||||
|
|
||||||
@@ -367,7 +370,7 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
GeneratePerformance(ref performanceEntry, PerformanceCommand.Type.Start, nodeId);
|
GeneratePerformance(ref performanceEntry, PerformanceCommand.Type.Start, nodeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
GenerateBiquadFilterForVoice(ref voiceState, dspStateMemory, (int)_rendererContext.MixBufferCount, channelIndex, nodeId);
|
GenerateBiquadFilterForVoice(ref voiceInfo, dspStateMemory, (int)_rendererContext.MixBufferCount, channelIndex, nodeId);
|
||||||
|
|
||||||
if (performanceInitialized)
|
if (performanceInitialized)
|
||||||
{
|
{
|
||||||
@@ -384,8 +387,8 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
}
|
}
|
||||||
|
|
||||||
_commandBuffer.GenerateVolumeRamp(
|
_commandBuffer.GenerateVolumeRamp(
|
||||||
voiceState.PreviousVolume,
|
voiceInfo.PreviousVolume,
|
||||||
voiceState.Volume,
|
voiceInfo.Volume,
|
||||||
_rendererContext.MixBufferCount + (uint)channelIndex,
|
_rendererContext.MixBufferCount + (uint)channelIndex,
|
||||||
nodeId);
|
nodeId);
|
||||||
|
|
||||||
@@ -394,17 +397,17 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
GeneratePerformance(ref performanceEntry, PerformanceCommand.Type.End, nodeId);
|
GeneratePerformance(ref performanceEntry, PerformanceCommand.Type.End, nodeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
voiceState.PreviousVolume = voiceState.Volume;
|
voiceInfo.PreviousVolume = voiceInfo.Volume;
|
||||||
|
|
||||||
if (voiceState.MixId == Constants.UnusedMixId)
|
if (voiceInfo.MixId == Constants.UnusedMixId)
|
||||||
{
|
{
|
||||||
if (voiceState.SplitterId != Constants.UnusedSplitterId)
|
if (voiceInfo.SplitterId != Constants.UnusedSplitterId)
|
||||||
{
|
{
|
||||||
int destinationId = channelIndex;
|
int destinationId = channelIndex;
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
SplitterDestination destination = _splitterContext.GetDestination((int)voiceState.SplitterId, destinationId);
|
SplitterDestination destination = _splitterContext.GetDestination((int)voiceInfo.SplitterId, destinationId);
|
||||||
|
|
||||||
if (destination.IsNull)
|
if (destination.IsNull)
|
||||||
{
|
{
|
||||||
@@ -419,7 +422,7 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
|
|
||||||
if (mixId < _mixContext.GetCount() && mixId != Constants.UnusedSplitterIdInt)
|
if (mixId < _mixContext.GetCount() && mixId != Constants.UnusedSplitterIdInt)
|
||||||
{
|
{
|
||||||
ref MixState mix = ref _mixContext.GetState(mixId);
|
ref MixInfo mix = ref _mixContext.GetState(mixId);
|
||||||
|
|
||||||
if (destination.IsBiquadFilterEnabled())
|
if (destination.IsBiquadFilterEnabled())
|
||||||
{
|
{
|
||||||
@@ -451,7 +454,7 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ref MixState mix = ref _mixContext.GetState(voiceState.MixId);
|
ref MixInfo mix = ref _mixContext.GetState(voiceInfo.MixId);
|
||||||
|
|
||||||
performanceInitialized = false;
|
performanceInitialized = false;
|
||||||
|
|
||||||
@@ -479,9 +482,9 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
channelResource.UpdateState();
|
channelResource.UpdateState();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < voiceState.BiquadFilterNeedInitialization.Length; i++)
|
for (int i = 0; i < voiceInfo.BiquadFilterNeedInitialization.Length; i++)
|
||||||
{
|
{
|
||||||
voiceState.BiquadFilterNeedInitialization[i] = biquadFiltersSpan[i].Enable;
|
voiceInfo.BiquadFilterNeedInitialization[i] = biquadFiltersSpan[i].Enable;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -491,11 +494,11 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
{
|
{
|
||||||
for (int i = 0; i < _voiceContext.GetCount(); i++)
|
for (int i = 0; i < _voiceContext.GetCount(); i++)
|
||||||
{
|
{
|
||||||
ref VoiceState sortedState = ref _voiceContext.GetSortedState(i);
|
ref VoiceInfo sortedInfo = ref _voiceContext.GetSortedState(i);
|
||||||
|
|
||||||
if (!sortedState.ShouldSkip() && sortedState.UpdateForCommandGeneration(_voiceContext))
|
if (!sortedInfo.ShouldSkip() && sortedInfo.UpdateForCommandGeneration(_voiceContext))
|
||||||
{
|
{
|
||||||
int nodeId = sortedState.NodeId;
|
int nodeId = sortedInfo.NodeId;
|
||||||
|
|
||||||
PerformanceEntryAddresses performanceEntry = new();
|
PerformanceEntryAddresses performanceEntry = new();
|
||||||
|
|
||||||
@@ -508,7 +511,7 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
GeneratePerformance(ref performanceEntry, PerformanceCommand.Type.Start, nodeId);
|
GeneratePerformance(ref performanceEntry, PerformanceCommand.Type.Start, nodeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
GenerateVoice(ref sortedState);
|
GenerateVoice(ref sortedInfo);
|
||||||
|
|
||||||
if (performanceInitialized)
|
if (performanceInitialized)
|
||||||
{
|
{
|
||||||
@@ -639,9 +642,9 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
if (effect.IsEnabled)
|
if (effect.IsEnabled)
|
||||||
{
|
{
|
||||||
bool needInitialization = effect.Parameter.Status == UsageState.Invalid ||
|
bool needInitialization = effect.Parameter.Status == UsageState.Invalid ||
|
||||||
(effect.Parameter.Status == UsageState.New && !_rendererContext.BehaviourContext.IsBiquadFilterEffectStateClearBugFixed());
|
(effect.Parameter.Status == UsageState.New && !_rendererContext.BehaviourInfo.IsBiquadFilterEffectStateClearBugFixed());
|
||||||
|
|
||||||
BiquadFilterParameter parameter = new()
|
BiquadFilterParameter2 parameter = new()
|
||||||
{
|
{
|
||||||
Enable = true,
|
Enable = true,
|
||||||
};
|
};
|
||||||
@@ -683,7 +686,7 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
|
|
||||||
ulong workBuffer = effect.GetWorkBuffer(-1);
|
ulong workBuffer = effect.GetWorkBuffer(-1);
|
||||||
|
|
||||||
if (_rendererContext.BehaviourContext.IsEffectInfoVersion2Supported())
|
if (_rendererContext.BehaviourInfo.IsEffectInfoVersion2Supported())
|
||||||
{
|
{
|
||||||
Memory<EffectResultState> dspResultState;
|
Memory<EffectResultState> dspResultState;
|
||||||
|
|
||||||
@@ -777,7 +780,7 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
nodeId);
|
nodeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void GenerateEffect(ref MixState mix, int effectId, BaseEffect effect)
|
private void GenerateEffect(ref MixInfo mix, int effectId, BaseEffect effect)
|
||||||
{
|
{
|
||||||
int nodeId = mix.NodeId;
|
int nodeId = mix.NodeId;
|
||||||
|
|
||||||
@@ -807,13 +810,13 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
GenerateAuxEffect(mix.BufferOffset, (AuxiliaryBufferEffect)effect, nodeId);
|
GenerateAuxEffect(mix.BufferOffset, (AuxiliaryBufferEffect)effect, nodeId);
|
||||||
break;
|
break;
|
||||||
case EffectType.Delay:
|
case EffectType.Delay:
|
||||||
GenerateDelayEffect(mix.BufferOffset, (DelayEffect)effect, nodeId, _rendererContext.BehaviourContext.IsNewEffectChannelMappingSupported());
|
GenerateDelayEffect(mix.BufferOffset, (DelayEffect)effect, nodeId, _rendererContext.BehaviourInfo.IsNewEffectChannelMappingSupported());
|
||||||
break;
|
break;
|
||||||
case EffectType.Reverb:
|
case EffectType.Reverb:
|
||||||
GenerateReverbEffect(mix.BufferOffset, (ReverbEffect)effect, nodeId, mix.IsLongSizePreDelaySupported, _rendererContext.BehaviourContext.IsNewEffectChannelMappingSupported());
|
GenerateReverbEffect(mix.BufferOffset, (ReverbEffect)effect, nodeId, mix.IsLongSizePreDelaySupported, _rendererContext.BehaviourInfo.IsNewEffectChannelMappingSupported());
|
||||||
break;
|
break;
|
||||||
case EffectType.Reverb3d:
|
case EffectType.Reverb3d:
|
||||||
GenerateReverb3dEffect(mix.BufferOffset, (Reverb3dEffect)effect, nodeId, _rendererContext.BehaviourContext.IsNewEffectChannelMappingSupported());
|
GenerateReverb3dEffect(mix.BufferOffset, (Reverb3dEffect)effect, nodeId, _rendererContext.BehaviourInfo.IsNewEffectChannelMappingSupported());
|
||||||
break;
|
break;
|
||||||
case EffectType.BiquadFilter:
|
case EffectType.BiquadFilter:
|
||||||
GenerateBiquadFilterEffect(mix.BufferOffset, (BiquadFilterEffect)effect, nodeId);
|
GenerateBiquadFilterEffect(mix.BufferOffset, (BiquadFilterEffect)effect, nodeId);
|
||||||
@@ -839,7 +842,7 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
effect.UpdateForCommandGeneration();
|
effect.UpdateForCommandGeneration();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void GenerateEffects(ref MixState mix)
|
private void GenerateEffects(ref MixInfo mix)
|
||||||
{
|
{
|
||||||
ReadOnlySpan<int> effectProcessingOrderArray = mix.EffectProcessingOrderArray;
|
ReadOnlySpan<int> effectProcessingOrderArray = mix.EffectProcessingOrderArray;
|
||||||
|
|
||||||
@@ -875,8 +878,8 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
ref bool isFirstMixBuffer,
|
ref bool isFirstMixBuffer,
|
||||||
int nodeId)
|
int nodeId)
|
||||||
{
|
{
|
||||||
ref BiquadFilterParameter bqf0 = ref destination.GetBiquadFilterParameter(0);
|
ref BiquadFilterParameter2 bqf0 = ref destination.GetBiquadFilterParameter(0);
|
||||||
ref BiquadFilterParameter bqf1 = ref destination.GetBiquadFilterParameter(1);
|
ref BiquadFilterParameter2 bqf1 = ref destination.GetBiquadFilterParameter(1);
|
||||||
|
|
||||||
Memory<BiquadFilterState> bqfState = _splitterContext.GetBiquadFilterState(destination);
|
Memory<BiquadFilterState> bqfState = _splitterContext.GetBiquadFilterState(destination);
|
||||||
|
|
||||||
@@ -888,7 +891,7 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
inputBufferIndex,
|
inputBufferIndex,
|
||||||
outputBufferIndex,
|
outputBufferIndex,
|
||||||
0,
|
0,
|
||||||
Memory<VoiceUpdateState>.Empty,
|
Memory<VoiceState>.Empty,
|
||||||
ref bqf0,
|
ref bqf0,
|
||||||
ref bqf1,
|
ref bqf1,
|
||||||
bqfState[..1],
|
bqfState[..1],
|
||||||
@@ -912,7 +915,7 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
inputBufferIndex,
|
inputBufferIndex,
|
||||||
outputBufferIndex,
|
outputBufferIndex,
|
||||||
0,
|
0,
|
||||||
Memory<VoiceUpdateState>.Empty,
|
Memory<VoiceState>.Empty,
|
||||||
ref bqf0,
|
ref bqf0,
|
||||||
bqfState[..1],
|
bqfState[..1],
|
||||||
bqfState.Slice(1, 1),
|
bqfState.Slice(1, 1),
|
||||||
@@ -931,7 +934,7 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
inputBufferIndex,
|
inputBufferIndex,
|
||||||
outputBufferIndex,
|
outputBufferIndex,
|
||||||
0,
|
0,
|
||||||
Memory<VoiceUpdateState>.Empty,
|
Memory<VoiceState>.Empty,
|
||||||
ref bqf1,
|
ref bqf1,
|
||||||
bqfState[..1],
|
bqfState[..1],
|
||||||
bqfState.Slice(1, 1),
|
bqfState.Slice(1, 1),
|
||||||
@@ -946,7 +949,7 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
isFirstMixBuffer = false;
|
isFirstMixBuffer = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void GenerateMix(ref MixState mix)
|
private void GenerateMix(ref MixInfo mix)
|
||||||
{
|
{
|
||||||
if (mix.HasAnyDestination())
|
if (mix.HasAnyDestination())
|
||||||
{
|
{
|
||||||
@@ -975,7 +978,7 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
|
|
||||||
if (mixId < _mixContext.GetCount() && mixId != Constants.UnusedSplitterIdInt)
|
if (mixId < _mixContext.GetCount() && mixId != Constants.UnusedSplitterIdInt)
|
||||||
{
|
{
|
||||||
ref MixState destinationMix = ref _mixContext.GetState(mixId);
|
ref MixInfo destinationMix = ref _mixContext.GetState(mixId);
|
||||||
|
|
||||||
uint inputBufferIndex = mix.BufferOffset + ((uint)destinationIndex % mix.BufferCount);
|
uint inputBufferIndex = mix.BufferOffset + ((uint)destinationIndex % mix.BufferCount);
|
||||||
|
|
||||||
@@ -1014,7 +1017,7 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ref MixState destinationMix = ref _mixContext.GetState(mix.DestinationMixId);
|
ref MixInfo destinationMix = ref _mixContext.GetState(mix.DestinationMixId);
|
||||||
|
|
||||||
for (uint bufferIndex = 0; bufferIndex < mix.BufferCount; bufferIndex++)
|
for (uint bufferIndex = 0; bufferIndex < mix.BufferCount; bufferIndex++)
|
||||||
{
|
{
|
||||||
@@ -1036,7 +1039,7 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void GenerateSubMix(ref MixState subMix)
|
private void GenerateSubMix(ref MixInfo subMix)
|
||||||
{
|
{
|
||||||
_commandBuffer.GenerateDepopForMixBuffers(
|
_commandBuffer.GenerateDepopForMixBuffers(
|
||||||
_rendererContext.DepopBuffer,
|
_rendererContext.DepopBuffer,
|
||||||
@@ -1072,11 +1075,11 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
{
|
{
|
||||||
for (int id = 0; id < _mixContext.GetCount(); id++)
|
for (int id = 0; id < _mixContext.GetCount(); id++)
|
||||||
{
|
{
|
||||||
ref MixState sortedState = ref _mixContext.GetSortedState(id);
|
ref MixInfo sortedInfo = ref _mixContext.GetSortedState(id);
|
||||||
|
|
||||||
if (sortedState.IsUsed && sortedState.MixId != Constants.FinalMixId)
|
if (sortedInfo.IsUsed && sortedInfo.MixId != Constants.FinalMixId)
|
||||||
{
|
{
|
||||||
int nodeId = sortedState.NodeId;
|
int nodeId = sortedInfo.NodeId;
|
||||||
|
|
||||||
PerformanceEntryAddresses performanceEntry = new();
|
PerformanceEntryAddresses performanceEntry = new();
|
||||||
|
|
||||||
@@ -1089,7 +1092,7 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
GeneratePerformance(ref performanceEntry, PerformanceCommand.Type.Start, nodeId);
|
GeneratePerformance(ref performanceEntry, PerformanceCommand.Type.Start, nodeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
GenerateSubMix(ref sortedState);
|
GenerateSubMix(ref sortedInfo);
|
||||||
|
|
||||||
if (performanceInitialized)
|
if (performanceInitialized)
|
||||||
{
|
{
|
||||||
@@ -1101,7 +1104,7 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
|
|
||||||
private void GenerateFinalMix()
|
private void GenerateFinalMix()
|
||||||
{
|
{
|
||||||
ref MixState finalMix = ref _mixContext.GetFinalState();
|
ref MixInfo finalMix = ref _mixContext.GetFinalState();
|
||||||
|
|
||||||
_commandBuffer.GenerateDepopForMixBuffers(
|
_commandBuffer.GenerateDepopForMixBuffers(
|
||||||
_rendererContext.DepopBuffer,
|
_rendererContext.DepopBuffer,
|
||||||
@@ -1180,16 +1183,16 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void GenerateCircularBuffer(CircularBufferSink sink, ref MixState finalMix)
|
private void GenerateCircularBuffer(CircularBufferSink sink, ref MixInfo finalMix)
|
||||||
{
|
{
|
||||||
_commandBuffer.GenerateCircularBuffer(finalMix.BufferOffset, sink, Constants.InvalidNodeId);
|
_commandBuffer.GenerateCircularBuffer(finalMix.BufferOffset, sink, Constants.InvalidNodeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void GenerateDevice(DeviceSink sink, ref MixState finalMix)
|
private void GenerateDevice(DeviceSink sink, ref MixInfo finalMix)
|
||||||
{
|
{
|
||||||
if (_commandBuffer.CommandList.SampleRate != 48000 && sink.UpsamplerState == null)
|
if (_commandBuffer.CommandList.SampleRate != 48000 && sink.UpsamplerInfo == null)
|
||||||
{
|
{
|
||||||
sink.UpsamplerState = _rendererContext.UpsamplerManager.Allocate();
|
sink.UpsamplerInfo = _rendererContext.UpsamplerManager.Allocate();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool useCustomDownMixingCommand = _rendererContext.ChannelCount == 2 && sink.Parameter.DownMixParameterEnabled;
|
bool useCustomDownMixingCommand = _rendererContext.ChannelCount == 2 && sink.Parameter.DownMixParameterEnabled;
|
||||||
@@ -1216,11 +1219,11 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
|
|
||||||
CommandList commandList = _commandBuffer.CommandList;
|
CommandList commandList = _commandBuffer.CommandList;
|
||||||
|
|
||||||
if (sink.UpsamplerState != null)
|
if (sink.UpsamplerInfo != null)
|
||||||
{
|
{
|
||||||
_commandBuffer.GenerateUpsample(
|
_commandBuffer.GenerateUpsample(
|
||||||
finalMix.BufferOffset,
|
finalMix.BufferOffset,
|
||||||
sink.UpsamplerState,
|
sink.UpsamplerInfo,
|
||||||
sink.Parameter.InputCount,
|
sink.Parameter.InputCount,
|
||||||
sink.Parameter.Input.AsSpan(),
|
sink.Parameter.Input.AsSpan(),
|
||||||
commandList.BufferCount,
|
commandList.BufferCount,
|
||||||
@@ -1237,7 +1240,7 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
Constants.InvalidNodeId);
|
Constants.InvalidNodeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void GenerateSink(BaseSink sink, ref MixState finalMix)
|
private void GenerateSink(BaseSink sink, ref MixInfo finalMix)
|
||||||
{
|
{
|
||||||
bool performanceInitialized = false;
|
bool performanceInitialized = false;
|
||||||
|
|
||||||
@@ -1275,7 +1278,7 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
|
|
||||||
public void GenerateSinks()
|
public void GenerateSinks()
|
||||||
{
|
{
|
||||||
ref MixState finalMix = ref _mixContext.GetFinalState();
|
ref MixInfo finalMix = ref _mixContext.GetFinalState();
|
||||||
|
|
||||||
for (int i = 0; i < _sinkContext.GetCount(); i++)
|
for (int i = 0; i < _sinkContext.GetCount(); i++)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -194,5 +194,10 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public uint Estimate(FillBufferCommand command)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -486,5 +486,10 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public uint Estimate(FillBufferCommand command)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ using Ryujinx.Audio.Renderer.Dsp.Command;
|
|||||||
using Ryujinx.Audio.Renderer.Parameter.Effect;
|
using Ryujinx.Audio.Renderer.Parameter.Effect;
|
||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using static Ryujinx.Audio.Renderer.Parameter.VoiceInParameter;
|
using Ryujinx.Audio.Renderer.Parameter;
|
||||||
|
|
||||||
namespace Ryujinx.Audio.Renderer.Server
|
namespace Ryujinx.Audio.Renderer.Server
|
||||||
{
|
{
|
||||||
@@ -656,5 +656,10 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual uint Estimate(FillBufferCommand command)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -286,5 +286,10 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
return 8683;
|
return 8683;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override uint Estimate(FillBufferCommand command)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -174,6 +174,19 @@ namespace Ryujinx.Audio.Renderer.Server.Effect
|
|||||||
|
|
||||||
updateErrorInfo = new ErrorInfo();
|
updateErrorInfo = new ErrorInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Update the internal state from a user version 3 parameter.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="updateErrorInfo">The possible <see cref="ErrorInfo"/> that was generated.</param>
|
||||||
|
/// <param name="parameter">The user parameter.</param>
|
||||||
|
/// <param name="mapper">The mapper to use.</param>
|
||||||
|
public virtual void Update(out ErrorInfo updateErrorInfo, in EffectInParameterVersion3 parameter, PoolMapper mapper)
|
||||||
|
{
|
||||||
|
Debug.Assert(IsTypeValid(in parameter));
|
||||||
|
|
||||||
|
updateErrorInfo = new ErrorInfo();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the work buffer DSP address at the given index.
|
/// Get the work buffer DSP address at the given index.
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using Ryujinx.Audio.Renderer.Common;
|
using Ryujinx.Audio.Renderer.Common;
|
||||||
|
using Ryujinx.Audio.Renderer.Dsp;
|
||||||
using Ryujinx.Audio.Renderer.Dsp.State;
|
using Ryujinx.Audio.Renderer.Dsp.State;
|
||||||
using Ryujinx.Audio.Renderer.Parameter;
|
using Ryujinx.Audio.Renderer.Parameter;
|
||||||
using Ryujinx.Audio.Renderer.Parameter.Effect;
|
using Ryujinx.Audio.Renderer.Parameter.Effect;
|
||||||
@@ -17,7 +18,7 @@ namespace Ryujinx.Audio.Renderer.Server.Effect
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The biquad filter parameter.
|
/// The biquad filter parameter.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public BiquadFilterEffectParameter Parameter;
|
public BiquadFilterEffectParameter2 Parameter;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The biquad filter state.
|
/// The biquad filter state.
|
||||||
@@ -29,7 +30,7 @@ namespace Ryujinx.Audio.Renderer.Server.Effect
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public BiquadFilterEffect()
|
public BiquadFilterEffect()
|
||||||
{
|
{
|
||||||
Parameter = new BiquadFilterEffectParameter();
|
Parameter = new BiquadFilterEffectParameter2();
|
||||||
State = new BiquadFilterState[Constants.ChannelCountMax];
|
State = new BiquadFilterState[Constants.ChannelCountMax];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,6 +45,11 @@ namespace Ryujinx.Audio.Renderer.Server.Effect
|
|||||||
{
|
{
|
||||||
Update(out updateErrorInfo, in parameter, mapper);
|
Update(out updateErrorInfo, in parameter, mapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void Update(out BehaviourParameter.ErrorInfo updateErrorInfo, in EffectInParameterVersion3 parameter, PoolMapper mapper)
|
||||||
|
{
|
||||||
|
Update(out updateErrorInfo, in parameter, mapper);
|
||||||
|
}
|
||||||
|
|
||||||
public void Update<T>(out BehaviourParameter.ErrorInfo updateErrorInfo, in T parameter, PoolMapper mapper) where T : unmanaged, IEffectInParameter
|
public void Update<T>(out BehaviourParameter.ErrorInfo updateErrorInfo, in T parameter, PoolMapper mapper) where T : unmanaged, IEffectInParameter
|
||||||
{
|
{
|
||||||
@@ -51,7 +57,17 @@ namespace Ryujinx.Audio.Renderer.Server.Effect
|
|||||||
|
|
||||||
UpdateParameterBase(in parameter);
|
UpdateParameterBase(in parameter);
|
||||||
|
|
||||||
Parameter = MemoryMarshal.Cast<byte, BiquadFilterEffectParameter>(parameter.SpecificData)[0];
|
if (typeof(T) == typeof(EffectInParameterVersion3))
|
||||||
|
{
|
||||||
|
Parameter = MemoryMarshal.Cast<byte, BiquadFilterEffectParameter2>(parameter.SpecificData)[0];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BiquadFilterEffectParameter1 oldParameter =
|
||||||
|
MemoryMarshal.Cast<byte, BiquadFilterEffectParameter1>(parameter.SpecificData)[0];
|
||||||
|
Parameter = BiquadFilterHelper.ToBiquadFilterEffectParameter2(oldParameter);
|
||||||
|
}
|
||||||
|
|
||||||
IsEnabled = parameter.IsEnabled;
|
IsEnabled = parameter.IsEnabled;
|
||||||
|
|
||||||
updateErrorInfo = new BehaviourParameter.ErrorInfo();
|
updateErrorInfo = new BehaviourParameter.ErrorInfo();
|
||||||
|
|||||||
@@ -38,5 +38,6 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
uint Estimate(CompressorCommand command);
|
uint Estimate(CompressorCommand command);
|
||||||
uint Estimate(BiquadFilterAndMixCommand command);
|
uint Estimate(BiquadFilterAndMixCommand command);
|
||||||
uint Estimate(MultiTapBiquadFilterAndMixCommand command);
|
uint Estimate(MultiTapBiquadFilterAndMixCommand command);
|
||||||
|
uint Estimate(FillBufferCommand command);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,14 +20,14 @@ namespace Ryujinx.Audio.Renderer.Server.MemoryPool
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public ulong Size;
|
public ulong Size;
|
||||||
|
|
||||||
private unsafe MemoryPoolState* _memoryPools;
|
private unsafe MemoryPoolInfo* _memoryPools;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The forced DSP address of the region.
|
/// The forced DSP address of the region.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DspAddress ForceMappedDspAddress;
|
public DspAddress ForceMappedDspAddress;
|
||||||
|
|
||||||
private readonly unsafe ref MemoryPoolState MemoryPoolState => ref *_memoryPools;
|
private readonly unsafe ref MemoryPoolInfo MemoryPoolInfo => ref *_memoryPools;
|
||||||
|
|
||||||
public readonly unsafe bool HasMemoryPoolState => (nint)_memoryPools != nint.Zero;
|
public readonly unsafe bool HasMemoryPoolState => (nint)_memoryPools != nint.Zero;
|
||||||
|
|
||||||
@@ -53,7 +53,7 @@ namespace Ryujinx.Audio.Renderer.Server.MemoryPool
|
|||||||
return new AddressInfo
|
return new AddressInfo
|
||||||
{
|
{
|
||||||
CpuAddress = cpuAddress,
|
CpuAddress = cpuAddress,
|
||||||
_memoryPools = MemoryPoolState.Null,
|
_memoryPools = MemoryPoolInfo.Null,
|
||||||
Size = size,
|
Size = size,
|
||||||
ForceMappedDspAddress = 0,
|
ForceMappedDspAddress = 0,
|
||||||
};
|
};
|
||||||
@@ -73,19 +73,19 @@ namespace Ryujinx.Audio.Renderer.Server.MemoryPool
|
|||||||
|
|
||||||
unsafe
|
unsafe
|
||||||
{
|
{
|
||||||
_memoryPools = MemoryPoolState.Null;
|
_memoryPools = MemoryPoolInfo.Null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Set the <see cref="MemoryPoolState"/> associated.
|
/// Set the <see cref="MemoryPoolInfo"/> associated.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="memoryPoolState">The <see cref="MemoryPoolState"/> associated.</param>
|
/// <param name="memoryPoolState">The <see cref="MemoryPoolInfo"/> associated.</param>
|
||||||
public void SetupMemoryPool(Span<MemoryPoolState> memoryPoolState)
|
public void SetupMemoryPool(Span<MemoryPoolInfo> memoryPoolState)
|
||||||
{
|
{
|
||||||
unsafe
|
unsafe
|
||||||
{
|
{
|
||||||
fixed (MemoryPoolState* ptr = &MemoryMarshal.GetReference(memoryPoolState))
|
fixed (MemoryPoolInfo* ptr = &MemoryMarshal.GetReference(memoryPoolState))
|
||||||
{
|
{
|
||||||
SetupMemoryPool(ptr);
|
SetupMemoryPool(ptr);
|
||||||
}
|
}
|
||||||
@@ -93,27 +93,27 @@ namespace Ryujinx.Audio.Renderer.Server.MemoryPool
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Set the <see cref="MemoryPoolState"/> associated.
|
/// Set the <see cref="MemoryPoolInfo"/> associated.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="memoryPoolState">The <see cref="MemoryPoolState"/> associated.</param>
|
/// <param name="memoryPoolState">The <see cref="MemoryPoolInfo"/> associated.</param>
|
||||||
public unsafe void SetupMemoryPool(MemoryPoolState* memoryPoolState)
|
public unsafe void SetupMemoryPool(MemoryPoolInfo* memoryPoolState)
|
||||||
{
|
{
|
||||||
_memoryPools = memoryPoolState;
|
_memoryPools = memoryPoolState;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Check if the <see cref="MemoryPoolState"/> is mapped.
|
/// Check if the <see cref="MemoryPoolInfo"/> is mapped.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>Returns true if the <see cref="MemoryPoolState"/> is mapped.</returns>
|
/// <returns>Returns true if the <see cref="MemoryPoolInfo"/> is mapped.</returns>
|
||||||
public readonly bool HasMappedMemoryPool()
|
public readonly bool HasMappedMemoryPool()
|
||||||
{
|
{
|
||||||
return HasMemoryPoolState && MemoryPoolState.IsMapped();
|
return HasMemoryPoolState && MemoryPoolInfo.IsMapped();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the DSP address associated to the <see cref="AddressInfo"/>.
|
/// Get the DSP address associated to the <see cref="AddressInfo"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="markUsed">If true, mark the <see cref="MemoryPoolState"/> as used.</param>
|
/// <param name="markUsed">If true, mark the <see cref="MemoryPoolInfo"/> as used.</param>
|
||||||
/// <returns>Returns the DSP address associated to the <see cref="AddressInfo"/>.</returns>
|
/// <returns>Returns the DSP address associated to the <see cref="AddressInfo"/>.</returns>
|
||||||
public readonly DspAddress GetReference(bool markUsed)
|
public readonly DspAddress GetReference(bool markUsed)
|
||||||
{
|
{
|
||||||
@@ -124,10 +124,10 @@ namespace Ryujinx.Audio.Renderer.Server.MemoryPool
|
|||||||
|
|
||||||
if (markUsed)
|
if (markUsed)
|
||||||
{
|
{
|
||||||
MemoryPoolState.IsUsed = true;
|
MemoryPoolInfo.IsUsed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return MemoryPoolState.Translate(CpuAddress, Size);
|
return MemoryPoolInfo.Translate(CpuAddress, Size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,62 +8,62 @@ namespace Ryujinx.Audio.Renderer.Server.MemoryPool
|
|||||||
/// Server state for a memory pool.
|
/// Server state for a memory pool.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[StructLayout(LayoutKind.Sequential, Size = 0x20, Pack = Alignment)]
|
[StructLayout(LayoutKind.Sequential, Size = 0x20, Pack = Alignment)]
|
||||||
public struct MemoryPoolState
|
public struct MemoryPoolInfo
|
||||||
{
|
{
|
||||||
public const int Alignment = 0x10;
|
public const int Alignment = 0x10;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The location of the <see cref="MemoryPoolState"/>.
|
/// The location of the <see cref="MemoryPoolInfo"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public enum LocationType : uint
|
public enum LocationType : uint
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <see cref="MemoryPoolState"/> located on the CPU side for user use.
|
/// <see cref="MemoryPoolInfo"/> located on the CPU side for user use.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Cpu,
|
Cpu,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <see cref="MemoryPoolState"/> located on the DSP side for system use.
|
/// <see cref="MemoryPoolInfo"/> located on the DSP side for system use.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Dsp,
|
Dsp,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The CPU address associated to the <see cref="MemoryPoolState"/>.
|
/// The CPU address associated to the <see cref="MemoryPoolInfo"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public CpuAddress CpuAddress;
|
public CpuAddress CpuAddress;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The DSP address associated to the <see cref="MemoryPoolState"/>.
|
/// The DSP address associated to the <see cref="MemoryPoolInfo"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DspAddress DspAddress;
|
public DspAddress DspAddress;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The size associated to the <see cref="MemoryPoolState"/>.
|
/// The size associated to the <see cref="MemoryPoolInfo"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ulong Size;
|
public ulong Size;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The <see cref="LocationType"/> associated to the <see cref="MemoryPoolState"/>.
|
/// The <see cref="LocationType"/> associated to the <see cref="MemoryPoolInfo"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public LocationType Location;
|
public LocationType Location;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Set to true if the <see cref="MemoryPoolState"/> is used.
|
/// Set to true if the <see cref="MemoryPoolInfo"/> is used.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[MarshalAs(UnmanagedType.I1)]
|
[MarshalAs(UnmanagedType.I1)]
|
||||||
public bool IsUsed;
|
public bool IsUsed;
|
||||||
|
|
||||||
public static unsafe MemoryPoolState* Null => (MemoryPoolState*)nint.Zero.ToPointer();
|
public static unsafe MemoryPoolInfo* Null => (MemoryPoolInfo*)nint.Zero.ToPointer();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create a new <see cref="MemoryPoolState"/> with the given <see cref="LocationType"/>.
|
/// Create a new <see cref="MemoryPoolInfo"/> with the given <see cref="LocationType"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="location">The location type to use.</param>
|
/// <param name="location">The location type to use.</param>
|
||||||
/// <returns>A new <see cref="MemoryPoolState"/> with the given <see cref="LocationType"/>.</returns>
|
/// <returns>A new <see cref="MemoryPoolInfo"/> with the given <see cref="LocationType"/>.</returns>
|
||||||
public static MemoryPoolState Create(LocationType location)
|
public static MemoryPoolInfo Create(LocationType location)
|
||||||
{
|
{
|
||||||
return new MemoryPoolState
|
return new MemoryPoolInfo
|
||||||
{
|
{
|
||||||
CpuAddress = 0,
|
CpuAddress = 0,
|
||||||
DspAddress = 0,
|
DspAddress = 0,
|
||||||
@@ -73,7 +73,7 @@ namespace Ryujinx.Audio.Renderer.Server.MemoryPool
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Set the <see cref="CpuAddress"/> and size of the <see cref="MemoryPoolState"/>.
|
/// Set the <see cref="CpuAddress"/> and size of the <see cref="MemoryPoolInfo"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="cpuAddress">The <see cref="CpuAddress"/>.</param>
|
/// <param name="cpuAddress">The <see cref="CpuAddress"/>.</param>
|
||||||
/// <param name="size">The size.</param>
|
/// <param name="size">The size.</param>
|
||||||
@@ -84,11 +84,11 @@ namespace Ryujinx.Audio.Renderer.Server.MemoryPool
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Check if the given <see cref="CpuAddress"/> and size is contains in the <see cref="MemoryPoolState"/>.
|
/// Check if the given <see cref="CpuAddress"/> and size is contains in the <see cref="MemoryPoolInfo"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="targetCpuAddress">The <see cref="CpuAddress"/>.</param>
|
/// <param name="targetCpuAddress">The <see cref="CpuAddress"/>.</param>
|
||||||
/// <param name="size">The size.</param>
|
/// <param name="size">The size.</param>
|
||||||
/// <returns>True if the <see cref="CpuAddress"/> is contained inside the <see cref="MemoryPoolState"/>.</returns>
|
/// <returns>True if the <see cref="CpuAddress"/> is contained inside the <see cref="MemoryPoolInfo"/>.</returns>
|
||||||
public readonly bool Contains(CpuAddress targetCpuAddress, ulong size)
|
public readonly bool Contains(CpuAddress targetCpuAddress, ulong size)
|
||||||
{
|
{
|
||||||
if (CpuAddress <= targetCpuAddress && size + targetCpuAddress <= Size + CpuAddress)
|
if (CpuAddress <= targetCpuAddress && size + targetCpuAddress <= Size + CpuAddress)
|
||||||
@@ -118,9 +118,9 @@ namespace Ryujinx.Audio.Renderer.Server.MemoryPool
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Is the <see cref="MemoryPoolState"/> mapped on the DSP?
|
/// Is the <see cref="MemoryPoolInfo"/> mapped on the DSP?
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>Returns true if the <see cref="MemoryPoolState"/> is mapped on the DSP.</returns>
|
/// <returns>Returns true if the <see cref="MemoryPoolInfo"/> is mapped on the DSP.</returns>
|
||||||
public readonly bool IsMapped()
|
public readonly bool IsMapped()
|
||||||
{
|
{
|
||||||
return DspAddress != 0;
|
return DspAddress != 0;
|
||||||
@@ -18,7 +18,7 @@ namespace Ryujinx.Audio.Renderer.Server.MemoryPool
|
|||||||
const uint CurrentProcessPseudoHandle = 0xFFFF8001;
|
const uint CurrentProcessPseudoHandle = 0xFFFF8001;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The result of <see cref="Update(ref MemoryPoolState, ref MemoryPoolInParameter, ref MemoryPoolOutStatus)"/>.
|
/// The result of <see cref="Update(ref MemoryPoolInfo, ref MemoryPoolInParameter, ref MemoryPoolOutStatus)"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public enum UpdateResult : uint
|
public enum UpdateResult : uint
|
||||||
{
|
{
|
||||||
@@ -49,9 +49,9 @@ namespace Ryujinx.Audio.Renderer.Server.MemoryPool
|
|||||||
private readonly uint _processHandle;
|
private readonly uint _processHandle;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The <see cref="Memory{MemoryPoolState}"/> that will be manipulated.
|
/// The <see cref="Memory{MemoryPoolInfo}"/> that will be manipulated.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly Memory<MemoryPoolState> _memoryPools;
|
private readonly Memory<MemoryPoolInfo> _memoryPools;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// If set to true, this will try to force map memory pool even if their state are considered invalid.
|
/// If set to true, this will try to force map memory pool even if their state are considered invalid.
|
||||||
@@ -67,7 +67,7 @@ namespace Ryujinx.Audio.Renderer.Server.MemoryPool
|
|||||||
{
|
{
|
||||||
_processHandle = processHandle;
|
_processHandle = processHandle;
|
||||||
_isForceMapEnabled = isForceMapEnabled;
|
_isForceMapEnabled = isForceMapEnabled;
|
||||||
_memoryPools = Memory<MemoryPoolState>.Empty;
|
_memoryPools = Memory<MemoryPoolInfo>.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -76,7 +76,7 @@ namespace Ryujinx.Audio.Renderer.Server.MemoryPool
|
|||||||
/// <param name="processHandle">The handle of the process owning the CPU memory manipulated.</param>
|
/// <param name="processHandle">The handle of the process owning the CPU memory manipulated.</param>
|
||||||
/// <param name="memoryPool">The user memory pools.</param>
|
/// <param name="memoryPool">The user memory pools.</param>
|
||||||
/// <param name="isForceMapEnabled">If set to true, this will try to force map memory pool even if their state are considered invalid.</param>
|
/// <param name="isForceMapEnabled">If set to true, this will try to force map memory pool even if their state are considered invalid.</param>
|
||||||
public PoolMapper(uint processHandle, Memory<MemoryPoolState> memoryPool, bool isForceMapEnabled)
|
public PoolMapper(uint processHandle, Memory<MemoryPoolInfo> memoryPool, bool isForceMapEnabled)
|
||||||
{
|
{
|
||||||
_processHandle = processHandle;
|
_processHandle = processHandle;
|
||||||
_memoryPools = memoryPool;
|
_memoryPools = memoryPool;
|
||||||
@@ -84,15 +84,15 @@ namespace Ryujinx.Audio.Renderer.Server.MemoryPool
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initialize the <see cref="MemoryPoolState"/> for system use.
|
/// Initialize the <see cref="MemoryPoolInfo"/> for system use.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="memoryPool">The <see cref="MemoryPoolState"/> for system use.</param>
|
/// <param name="memoryPool">The <see cref="MemoryPoolInfo"/> for system use.</param>
|
||||||
/// <param name="cpuAddress">The <see cref="CpuAddress"/> to assign.</param>
|
/// <param name="cpuAddress">The <see cref="CpuAddress"/> to assign.</param>
|
||||||
/// <param name="size">The size to assign.</param>
|
/// <param name="size">The size to assign.</param>
|
||||||
/// <returns>Returns true if mapping on the <see cref="Dsp.AudioProcessor"/> succeeded.</returns>
|
/// <returns>Returns true if mapping on the <see cref="Dsp.AudioProcessor"/> succeeded.</returns>
|
||||||
public bool InitializeSystemPool(ref MemoryPoolState memoryPool, CpuAddress cpuAddress, ulong size)
|
public bool InitializeSystemPool(ref MemoryPoolInfo memoryPool, CpuAddress cpuAddress, ulong size)
|
||||||
{
|
{
|
||||||
if (memoryPool.Location != MemoryPoolState.LocationType.Dsp)
|
if (memoryPool.Location != MemoryPoolInfo.LocationType.Dsp)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -101,13 +101,13 @@ namespace Ryujinx.Audio.Renderer.Server.MemoryPool
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initialize the <see cref="MemoryPoolState"/>.
|
/// Initialize the <see cref="MemoryPoolInfo"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="memoryPool">The <see cref="MemoryPoolState"/>.</param>
|
/// <param name="memoryPool">The <see cref="MemoryPoolInfo"/>.</param>
|
||||||
/// <param name="cpuAddress">The <see cref="CpuAddress"/> to assign.</param>
|
/// <param name="cpuAddress">The <see cref="CpuAddress"/> to assign.</param>
|
||||||
/// <param name="size">The size to assign.</param>
|
/// <param name="size">The size to assign.</param>
|
||||||
/// <returns>Returns true if mapping on the <see cref="Dsp.AudioProcessor"/> succeeded.</returns>
|
/// <returns>Returns true if mapping on the <see cref="Dsp.AudioProcessor"/> succeeded.</returns>
|
||||||
public bool InitializePool(ref MemoryPoolState memoryPool, CpuAddress cpuAddress, ulong size)
|
public bool InitializePool(ref MemoryPoolInfo memoryPool, CpuAddress cpuAddress, ulong size)
|
||||||
{
|
{
|
||||||
memoryPool.SetCpuAddress(cpuAddress, size);
|
memoryPool.SetCpuAddress(cpuAddress, size);
|
||||||
|
|
||||||
@@ -115,18 +115,18 @@ namespace Ryujinx.Audio.Renderer.Server.MemoryPool
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the process handle associated to the <see cref="MemoryPoolState"/>.
|
/// Get the process handle associated to the <see cref="MemoryPoolInfo"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="memoryPool">The <see cref="MemoryPoolState"/>.</param>
|
/// <param name="memoryPool">The <see cref="MemoryPoolInfo"/>.</param>
|
||||||
/// <returns>Returns the process handle associated to the <see cref="MemoryPoolState"/>.</returns>
|
/// <returns>Returns the process handle associated to the <see cref="MemoryPoolInfo"/>.</returns>
|
||||||
public uint GetProcessHandle(ref MemoryPoolState memoryPool)
|
public uint GetProcessHandle(ref MemoryPoolInfo memoryPool)
|
||||||
{
|
{
|
||||||
if (memoryPool.Location == MemoryPoolState.LocationType.Cpu)
|
if (memoryPool.Location == MemoryPoolInfo.LocationType.Cpu)
|
||||||
{
|
{
|
||||||
return CurrentProcessPseudoHandle;
|
return CurrentProcessPseudoHandle;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (memoryPool.Location == MemoryPoolState.LocationType.Dsp)
|
if (memoryPool.Location == MemoryPoolInfo.LocationType.Dsp)
|
||||||
{
|
{
|
||||||
return _processHandle;
|
return _processHandle;
|
||||||
}
|
}
|
||||||
@@ -135,11 +135,11 @@ namespace Ryujinx.Audio.Renderer.Server.MemoryPool
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Map the <see cref="MemoryPoolState"/> on the <see cref="Dsp.AudioProcessor"/>.
|
/// Map the <see cref="MemoryPoolInfo"/> on the <see cref="Dsp.AudioProcessor"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="memoryPool">The <see cref="MemoryPoolState"/> to map.</param>
|
/// <param name="memoryPool">The <see cref="MemoryPoolInfo"/> to map.</param>
|
||||||
/// <returns>Returns the DSP address mapped.</returns>
|
/// <returns>Returns the DSP address mapped.</returns>
|
||||||
public DspAddress Map(ref MemoryPoolState memoryPool)
|
public DspAddress Map(ref MemoryPoolInfo memoryPool)
|
||||||
{
|
{
|
||||||
DspAddress result = AudioProcessorMemoryManager.Map(GetProcessHandle(ref memoryPool), memoryPool.CpuAddress, memoryPool.Size);
|
DspAddress result = AudioProcessorMemoryManager.Map(GetProcessHandle(ref memoryPool), memoryPool.CpuAddress, memoryPool.Size);
|
||||||
|
|
||||||
@@ -152,11 +152,11 @@ namespace Ryujinx.Audio.Renderer.Server.MemoryPool
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Unmap the <see cref="MemoryPoolState"/> from the <see cref="Dsp.AudioProcessor"/>.
|
/// Unmap the <see cref="MemoryPoolInfo"/> from the <see cref="Dsp.AudioProcessor"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="memoryPool">The <see cref="MemoryPoolState"/> to unmap.</param>
|
/// <param name="memoryPool">The <see cref="MemoryPoolInfo"/> to unmap.</param>
|
||||||
/// <returns>Returns true if unmapped.</returns>
|
/// <returns>Returns true if unmapped.</returns>
|
||||||
public bool Unmap(ref MemoryPoolState memoryPool)
|
public bool Unmap(ref MemoryPoolInfo memoryPool)
|
||||||
{
|
{
|
||||||
if (memoryPool.IsUsed)
|
if (memoryPool.IsUsed)
|
||||||
{
|
{
|
||||||
@@ -172,12 +172,12 @@ namespace Ryujinx.Audio.Renderer.Server.MemoryPool
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Find a <see cref="MemoryPoolState"/> associated to the region given.
|
/// Find a <see cref="MemoryPoolInfo"/> associated to the region given.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="cpuAddress">The region <see cref="CpuAddress"/>.</param>
|
/// <param name="cpuAddress">The region <see cref="CpuAddress"/>.</param>
|
||||||
/// <param name="size">The region size.</param>
|
/// <param name="size">The region size.</param>
|
||||||
/// <returns>Returns the <see cref="MemoryPoolState"/> found or <see cref="Memory{MemoryPoolState}.Empty"/> if not found.</returns>
|
/// <returns>Returns the <see cref="MemoryPoolInfo"/> found or <see cref="Memory{MemoryPoolInfo}.Empty"/> if not found.</returns>
|
||||||
private Span<MemoryPoolState> FindMemoryPool(CpuAddress cpuAddress, ulong size)
|
private Span<MemoryPoolInfo> FindMemoryPool(CpuAddress cpuAddress, ulong size)
|
||||||
{
|
{
|
||||||
if (!_memoryPools.IsEmpty && _memoryPools.Length > 0)
|
if (!_memoryPools.IsEmpty && _memoryPools.Length > 0)
|
||||||
{
|
{
|
||||||
@@ -190,7 +190,7 @@ namespace Ryujinx.Audio.Renderer.Server.MemoryPool
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Span<MemoryPoolState>.Empty;
|
return Span<MemoryPoolInfo>.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -201,7 +201,7 @@ namespace Ryujinx.Audio.Renderer.Server.MemoryPool
|
|||||||
{
|
{
|
||||||
if (_isForceMapEnabled)
|
if (_isForceMapEnabled)
|
||||||
{
|
{
|
||||||
Span<MemoryPoolState> memoryPool = FindMemoryPool(addressInfo.CpuAddress, addressInfo.Size);
|
Span<MemoryPoolInfo> memoryPool = FindMemoryPool(addressInfo.CpuAddress, addressInfo.Size);
|
||||||
|
|
||||||
if (!memoryPool.IsEmpty)
|
if (!memoryPool.IsEmpty)
|
||||||
{
|
{
|
||||||
@@ -243,13 +243,13 @@ namespace Ryujinx.Audio.Renderer.Server.MemoryPool
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Update a <see cref="MemoryPoolState"/> using user parameters.
|
/// Update a <see cref="MemoryPoolInfo"/> using user parameters.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="memoryPool">The <see cref="MemoryPoolState"/> to update.</param>
|
/// <param name="memoryPool">The <see cref="MemoryPoolInfo"/> to update.</param>
|
||||||
/// <param name="inParameter">Input user parameter.</param>
|
/// <param name="inParameter">Input user parameter.</param>
|
||||||
/// <param name="outStatus">Output user parameter.</param>
|
/// <param name="outStatus">Output user parameter.</param>
|
||||||
/// <returns>Returns the <see cref="UpdateResult"/> of the operations performed.</returns>
|
/// <returns>Returns the <see cref="UpdateResult"/> of the operations performed.</returns>
|
||||||
public UpdateResult Update(ref MemoryPoolState memoryPool, in MemoryPoolInParameter inParameter, ref MemoryPoolOutStatus outStatus)
|
public UpdateResult Update(ref MemoryPoolInfo memoryPool, in MemoryPoolInParameter inParameter, ref MemoryPoolOutStatus outStatus)
|
||||||
{
|
{
|
||||||
MemoryPoolUserState inputState = inParameter.State;
|
MemoryPoolUserState inputState = inParameter.State;
|
||||||
|
|
||||||
@@ -321,7 +321,7 @@ namespace Ryujinx.Audio.Renderer.Server.MemoryPool
|
|||||||
|
|
||||||
if (_memoryPools.Length > 0)
|
if (_memoryPools.Length > 0)
|
||||||
{
|
{
|
||||||
Span<MemoryPoolState> memoryPool = FindMemoryPool(addressInfo.CpuAddress, addressInfo.Size);
|
Span<MemoryPoolInfo> memoryPool = FindMemoryPool(addressInfo.CpuAddress, addressInfo.Size);
|
||||||
|
|
||||||
if (!memoryPool.IsEmpty)
|
if (!memoryPool.IsEmpty)
|
||||||
{
|
{
|
||||||
@@ -343,7 +343,7 @@ namespace Ryujinx.Audio.Renderer.Server.MemoryPool
|
|||||||
{
|
{
|
||||||
unsafe
|
unsafe
|
||||||
{
|
{
|
||||||
addressInfo.SetupMemoryPool(MemoryPoolState.Null);
|
addressInfo.SetupMemoryPool(MemoryPoolInfo.Null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -351,12 +351,12 @@ namespace Ryujinx.Audio.Renderer.Server.MemoryPool
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Remove the usage flag from all the <see cref="MemoryPoolState"/>.
|
/// Remove the usage flag from all the <see cref="MemoryPoolInfo"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="memoryPool">The <see cref="Memory{MemoryPoolState}"/> to reset.</param>
|
/// <param name="memoryPool">The <see cref="Memory{MemoryPoolInfo}"/> to reset.</param>
|
||||||
public static void ClearUsageState(Memory<MemoryPoolState> memoryPool)
|
public static void ClearUsageState(Memory<MemoryPoolInfo> memoryPool)
|
||||||
{
|
{
|
||||||
foreach (ref MemoryPoolState info in memoryPool.Span)
|
foreach (ref MemoryPoolInfo info in memoryPool.Span)
|
||||||
{
|
{
|
||||||
info.IsUsed = false;
|
info.IsUsed = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,12 +17,12 @@ namespace Ryujinx.Audio.Renderer.Server.Mix
|
|||||||
private uint _mixesCount;
|
private uint _mixesCount;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Storage for <see cref="MixState"/>.
|
/// Storage for <see cref="MixInfo"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private Memory<MixState> _mixes;
|
private Memory<MixInfo> _mixes;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Storage of the sorted indices to <see cref="MixState"/>.
|
/// Storage of the sorted indices to <see cref="MixInfo"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private Memory<int> _sortedMixes;
|
private Memory<int> _sortedMixes;
|
||||||
|
|
||||||
@@ -49,10 +49,10 @@ namespace Ryujinx.Audio.Renderer.Server.Mix
|
|||||||
/// Initialize the <see cref="MixContext"/>.
|
/// Initialize the <see cref="MixContext"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="sortedMixes">The storage for sorted indices.</param>
|
/// <param name="sortedMixes">The storage for sorted indices.</param>
|
||||||
/// <param name="mixes">The storage of <see cref="MixState"/>.</param>
|
/// <param name="mixes">The storage of <see cref="MixInfo"/>.</param>
|
||||||
/// <param name="nodeStatesWorkBuffer">The storage used for the <see cref="NodeStates"/>.</param>
|
/// <param name="nodeStatesWorkBuffer">The storage used for the <see cref="NodeStates"/>.</param>
|
||||||
/// <param name="edgeMatrixWorkBuffer">The storage used for the <see cref="EdgeMatrix"/>.</param>
|
/// <param name="edgeMatrixWorkBuffer">The storage used for the <see cref="EdgeMatrix"/>.</param>
|
||||||
public void Initialize(Memory<int> sortedMixes, Memory<MixState> mixes, Memory<byte> nodeStatesWorkBuffer, Memory<byte> edgeMatrixWorkBuffer)
|
public void Initialize(Memory<int> sortedMixes, Memory<MixInfo> mixes, Memory<byte> nodeStatesWorkBuffer, Memory<byte> edgeMatrixWorkBuffer)
|
||||||
{
|
{
|
||||||
_mixesCount = (uint)mixes.Length;
|
_mixesCount = (uint)mixes.Length;
|
||||||
_mixes = mixes;
|
_mixes = mixes;
|
||||||
@@ -82,30 +82,30 @@ namespace Ryujinx.Audio.Renderer.Server.Mix
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get a reference to the final <see cref="MixState"/>.
|
/// Get a reference to the final <see cref="MixInfo"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>A reference to the final <see cref="MixState"/>.</returns>
|
/// <returns>A reference to the final <see cref="MixInfo"/>.</returns>
|
||||||
public ref MixState GetFinalState()
|
public ref MixInfo GetFinalState()
|
||||||
{
|
{
|
||||||
return ref GetState(Constants.FinalMixId);
|
return ref GetState(Constants.FinalMixId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get a reference to a <see cref="MixState"/> at the given <paramref name="id"/>.
|
/// Get a reference to a <see cref="MixInfo"/> at the given <paramref name="id"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id">The index to use.</param>
|
/// <param name="id">The index to use.</param>
|
||||||
/// <returns>A reference to a <see cref="MixState"/> at the given <paramref name="id"/>.</returns>
|
/// <returns>A reference to a <see cref="MixInfo"/> at the given <paramref name="id"/>.</returns>
|
||||||
public ref MixState GetState(int id)
|
public ref MixInfo GetState(int id)
|
||||||
{
|
{
|
||||||
return ref SpanIOHelper.GetFromMemory(_mixes, id, _mixesCount);
|
return ref SpanIOHelper.GetFromMemory(_mixes, id, _mixesCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get a reference to a <see cref="MixState"/> at the given <paramref name="id"/> of the sorted mix info.
|
/// Get a reference to a <see cref="MixInfo"/> at the given <paramref name="id"/> of the sorted mix info.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id">The index to use.</param>
|
/// <param name="id">The index to use.</param>
|
||||||
/// <returns>A reference to a <see cref="MixState"/> at the given <paramref name="id"/>.</returns>
|
/// <returns>A reference to a <see cref="MixInfo"/> at the given <paramref name="id"/>.</returns>
|
||||||
public ref MixState GetSortedState(int id)
|
public ref MixInfo GetSortedState(int id)
|
||||||
{
|
{
|
||||||
Debug.Assert(id >= 0 && id < _mixesCount);
|
Debug.Assert(id >= 0 && id < _mixesCount);
|
||||||
|
|
||||||
@@ -122,18 +122,18 @@ namespace Ryujinx.Audio.Renderer.Server.Mix
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Update the internal distance from the final mix value of every <see cref="MixState"/>.
|
/// Update the internal distance from the final mix value of every <see cref="MixInfo"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void UpdateDistancesFromFinalMix()
|
private void UpdateDistancesFromFinalMix()
|
||||||
{
|
{
|
||||||
foreach (ref MixState mix in _mixes.Span)
|
foreach (ref MixInfo mix in _mixes.Span)
|
||||||
{
|
{
|
||||||
mix.ClearDistanceFromFinalMix();
|
mix.ClearDistanceFromFinalMix();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < GetCount(); i++)
|
for (int i = 0; i < GetCount(); i++)
|
||||||
{
|
{
|
||||||
ref MixState mix = ref GetState(i);
|
ref MixInfo mix = ref GetState(i);
|
||||||
|
|
||||||
SetSortedState(i, i);
|
SetSortedState(i, i);
|
||||||
|
|
||||||
@@ -149,13 +149,13 @@ namespace Ryujinx.Audio.Renderer.Server.Mix
|
|||||||
{
|
{
|
||||||
if (mixId == Constants.UnusedMixId)
|
if (mixId == Constants.UnusedMixId)
|
||||||
{
|
{
|
||||||
distance = MixState.InvalidDistanceFromFinalMix;
|
distance = MixInfo.InvalidDistanceFromFinalMix;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ref MixState distanceMix = ref GetState(mixId);
|
ref MixInfo distanceMix = ref GetState(mixId);
|
||||||
|
|
||||||
if (distanceMix.DistanceFromFinalMix != MixState.InvalidDistanceFromFinalMix)
|
if (distanceMix.DistanceFromFinalMix != MixInfo.InvalidDistanceFromFinalMix)
|
||||||
{
|
{
|
||||||
distance = distanceMix.DistanceFromFinalMix + 1;
|
distance = distanceMix.DistanceFromFinalMix + 1;
|
||||||
break;
|
break;
|
||||||
@@ -171,12 +171,12 @@ namespace Ryujinx.Audio.Renderer.Server.Mix
|
|||||||
|
|
||||||
if (distance > GetCount())
|
if (distance > GetCount())
|
||||||
{
|
{
|
||||||
distance = MixState.InvalidDistanceFromFinalMix;
|
distance = MixInfo.InvalidDistanceFromFinalMix;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
distance = MixState.InvalidDistanceFromFinalMix;
|
distance = MixInfo.InvalidDistanceFromFinalMix;
|
||||||
}
|
}
|
||||||
|
|
||||||
mix.DistanceFromFinalMix = distance;
|
mix.DistanceFromFinalMix = distance;
|
||||||
@@ -185,13 +185,13 @@ namespace Ryujinx.Audio.Renderer.Server.Mix
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Update the internal mix buffer offset of all <see cref="MixState"/>.
|
/// Update the internal mix buffer offset of all <see cref="MixInfo"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void UpdateMixBufferOffset()
|
private void UpdateMixBufferOffset()
|
||||||
{
|
{
|
||||||
uint offset = 0;
|
uint offset = 0;
|
||||||
|
|
||||||
foreach (ref MixState mix in _mixes.Span)
|
foreach (ref MixInfo mix in _mixes.Span)
|
||||||
{
|
{
|
||||||
mix.BufferOffset = offset;
|
mix.BufferOffset = offset;
|
||||||
|
|
||||||
@@ -210,10 +210,10 @@ namespace Ryujinx.Audio.Renderer.Server.Mix
|
|||||||
|
|
||||||
Array.Sort(sortedMixesTemp, (a, b) =>
|
Array.Sort(sortedMixesTemp, (a, b) =>
|
||||||
{
|
{
|
||||||
ref MixState stateA = ref GetState(a);
|
ref MixInfo infoA = ref GetState(a);
|
||||||
ref MixState stateB = ref GetState(b);
|
ref MixInfo infoB = ref GetState(b);
|
||||||
|
|
||||||
return stateB.DistanceFromFinalMix.CompareTo(stateA.DistanceFromFinalMix);
|
return infoB.DistanceFromFinalMix.CompareTo(infoA.DistanceFromFinalMix);
|
||||||
});
|
});
|
||||||
|
|
||||||
sortedMixesTemp.AsSpan().CopyTo(_sortedMixes.Span);
|
sortedMixesTemp.AsSpan().CopyTo(_sortedMixes.Span);
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ namespace Ryujinx.Audio.Renderer.Server.Mix
|
|||||||
/// Server state for a mix.
|
/// Server state for a mix.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[StructLayout(LayoutKind.Sequential, Size = 0x940, Pack = Alignment)]
|
[StructLayout(LayoutKind.Sequential, Size = 0x940, Pack = Alignment)]
|
||||||
public struct MixState
|
public struct MixInfo
|
||||||
{
|
{
|
||||||
public const uint InvalidDistanceFromFinalMix = 0x80000000;
|
public const uint InvalidDistanceFromFinalMix = 0x80000000;
|
||||||
|
|
||||||
@@ -136,11 +136,11 @@ namespace Ryujinx.Audio.Renderer.Server.Mix
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create a new <see cref="MixState"/>
|
/// Create a new <see cref="MixInfo"/>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="effectProcessingOrderArray"></param>
|
/// <param name="effectProcessingOrderArray"></param>
|
||||||
/// <param name="behaviourContext"></param>
|
/// <param name="behaviourInfo"></param>
|
||||||
public MixState(Memory<int> effectProcessingOrderArray, ref BehaviourContext behaviourContext) : this()
|
public MixInfo(Memory<int> effectProcessingOrderArray, ref BehaviourInfo behaviourInfo) : this()
|
||||||
{
|
{
|
||||||
MixId = UnusedMixId;
|
MixId = UnusedMixId;
|
||||||
|
|
||||||
@@ -158,7 +158,7 @@ namespace Ryujinx.Audio.Renderer.Server.Mix
|
|||||||
|
|
||||||
EffectProcessingOrderArrayMaxCount = (uint)effectProcessingOrderArray.Length;
|
EffectProcessingOrderArrayMaxCount = (uint)effectProcessingOrderArray.Length;
|
||||||
|
|
||||||
IsLongSizePreDelaySupported = behaviourContext.IsLongSizePreDelaySupported();
|
IsLongSizePreDelaySupported = behaviourInfo.IsLongSizePreDelaySupported();
|
||||||
|
|
||||||
ClearEffectProcessingOrder();
|
ClearEffectProcessingOrder();
|
||||||
}
|
}
|
||||||
@@ -257,9 +257,9 @@ namespace Ryujinx.Audio.Renderer.Server.Mix
|
|||||||
/// <param name="parameter">The input parameter of the mix.</param>
|
/// <param name="parameter">The input parameter of the mix.</param>
|
||||||
/// <param name="effectContext">The effect context.</param>
|
/// <param name="effectContext">The effect context.</param>
|
||||||
/// <param name="splitterContext">The splitter context.</param>
|
/// <param name="splitterContext">The splitter context.</param>
|
||||||
/// <param name="behaviourContext">The behaviour context.</param>
|
/// <param name="behaviourInfo">The behaviour context.</param>
|
||||||
/// <returns>Return true if the mix was changed.</returns>
|
/// <returns>Return true if the mix was changed.</returns>
|
||||||
public bool Update(EdgeMatrix edgeMatrix, in MixParameter parameter, EffectContext effectContext, SplitterContext splitterContext, BehaviourContext behaviourContext)
|
public bool Update(EdgeMatrix edgeMatrix, in MixParameter parameter, EffectContext effectContext, SplitterContext splitterContext, BehaviourInfo behaviourInfo)
|
||||||
{
|
{
|
||||||
bool isDirty;
|
bool isDirty;
|
||||||
|
|
||||||
@@ -271,7 +271,7 @@ namespace Ryujinx.Audio.Renderer.Server.Mix
|
|||||||
NodeId = parameter.NodeId;
|
NodeId = parameter.NodeId;
|
||||||
parameter.MixBufferVolume.CopyTo(MixBufferVolume);
|
parameter.MixBufferVolume.CopyTo(MixBufferVolume);
|
||||||
|
|
||||||
if (behaviourContext.IsSplitterSupported())
|
if (behaviourInfo.IsSplitterSupported())
|
||||||
{
|
{
|
||||||
isDirty = UpdateConnection(edgeMatrix, in parameter, ref splitterContext);
|
isDirty = UpdateConnection(edgeMatrix, in parameter, ref splitterContext);
|
||||||
}
|
}
|
||||||
@@ -279,10 +279,7 @@ namespace Ryujinx.Audio.Renderer.Server.Mix
|
|||||||
{
|
{
|
||||||
isDirty = DestinationMixId != parameter.DestinationMixId;
|
isDirty = DestinationMixId != parameter.DestinationMixId;
|
||||||
|
|
||||||
if (DestinationMixId != parameter.DestinationMixId)
|
DestinationMixId = parameter.DestinationMixId;
|
||||||
{
|
|
||||||
DestinationMixId = parameter.DestinationMixId;
|
|
||||||
}
|
|
||||||
|
|
||||||
DestinationSplitterId = UnusedSplitterId;
|
DestinationSplitterId = UnusedSplitterId;
|
||||||
}
|
}
|
||||||
@@ -10,11 +10,11 @@ namespace Ryujinx.Audio.Renderer.Server.Performance
|
|||||||
/// Get the required size for a single performance frame.
|
/// Get the required size for a single performance frame.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="parameter">The audio renderer configuration.</param>
|
/// <param name="parameter">The audio renderer configuration.</param>
|
||||||
/// <param name="behaviourContext">The behaviour context.</param>
|
/// <param name="behaviourInfo">The behaviour context.</param>
|
||||||
/// <returns>The required size for a single performance frame.</returns>
|
/// <returns>The required size for a single performance frame.</returns>
|
||||||
public static ulong GetRequiredBufferSizeForPerformanceMetricsPerFrame(ref AudioRendererConfiguration parameter, ref BehaviourContext behaviourContext)
|
public static ulong GetRequiredBufferSizeForPerformanceMetricsPerFrame(ref AudioRendererConfiguration parameter, ref BehaviourInfo behaviourInfo)
|
||||||
{
|
{
|
||||||
uint version = behaviourContext.GetPerformanceMetricsDataFormat();
|
uint version = behaviourInfo.GetPerformanceMetricsDataFormat();
|
||||||
|
|
||||||
if (version == 2)
|
if (version == 2)
|
||||||
{
|
{
|
||||||
@@ -81,11 +81,11 @@ namespace Ryujinx.Audio.Renderer.Server.Performance
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="performanceBuffer">The backing memory available for use by the manager.</param>
|
/// <param name="performanceBuffer">The backing memory available for use by the manager.</param>
|
||||||
/// <param name="parameter">The audio renderer configuration.</param>
|
/// <param name="parameter">The audio renderer configuration.</param>
|
||||||
/// <param name="behaviourContext">The behaviour context;</param>
|
/// <param name="behaviourInfo">The behaviour context;</param>
|
||||||
/// <returns>A new <see cref="PerformanceManager"/>.</returns>
|
/// <returns>A new <see cref="PerformanceManager"/>.</returns>
|
||||||
public static PerformanceManager Create(Memory<byte> performanceBuffer, ref AudioRendererConfiguration parameter, BehaviourContext behaviourContext)
|
public static PerformanceManager Create(Memory<byte> performanceBuffer, ref AudioRendererConfiguration parameter, BehaviourInfo behaviourInfo)
|
||||||
{
|
{
|
||||||
uint version = behaviourContext.GetPerformanceMetricsDataFormat();
|
uint version = behaviourInfo.GetPerformanceMetricsDataFormat();
|
||||||
|
|
||||||
return version switch
|
return version switch
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using Ryujinx.Audio.Renderer.Server.Mix;
|
||||||
using Ryujinx.Audio.Renderer.Server.Upsampler;
|
using Ryujinx.Audio.Renderer.Server.Upsampler;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
@@ -19,7 +20,7 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The target channel count for sink.
|
/// The target channel count for sink.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>See <see cref="CommandGenerator.GenerateDevice(Sink.DeviceSink, ref Mix.MixState)"/> for usage.</remarks>
|
/// <remarks>See <see cref="CommandGenerator.GenerateDevice(Sink.DeviceSink, ref MixInfo)"/> for usage.</remarks>
|
||||||
public uint ChannelCount;
|
public uint ChannelCount;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -28,12 +29,12 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
public uint MixBufferCount;
|
public uint MixBufferCount;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Instance of the <see cref="BehaviourContext"/> used to derive bug fixes and features of the current audio renderer revision.
|
/// Instance of the <see cref="BehaviourInfo"/> used to derive bug fixes and features of the current audio renderer revision.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public BehaviourContext BehaviourContext;
|
public BehaviourInfo BehaviourInfo;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Instance of the <see cref="UpsamplerManager"/> used for upsampling (see <see cref="UpsamplerState"/>)
|
/// Instance of the <see cref="UpsamplerManager"/> used for upsampling (see <see cref="UpsamplerInfo"/>)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public UpsamplerManager UpsamplerManager;
|
public UpsamplerManager UpsamplerManager;
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ namespace Ryujinx.Audio.Renderer.Server.Sink
|
|||||||
/// The upsampler instance used by this sink.
|
/// The upsampler instance used by this sink.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>Null if no upsampling is needed.</remarks>
|
/// <remarks>Null if no upsampling is needed.</remarks>
|
||||||
public UpsamplerState UpsamplerState;
|
public UpsamplerInfo UpsamplerInfo;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create a new <see cref="DeviceSink"/>.
|
/// Create a new <see cref="DeviceSink"/>.
|
||||||
@@ -40,9 +40,9 @@ namespace Ryujinx.Audio.Renderer.Server.Sink
|
|||||||
|
|
||||||
public override void CleanUp()
|
public override void CleanUp()
|
||||||
{
|
{
|
||||||
UpsamplerState?.Release();
|
UpsamplerInfo?.Release();
|
||||||
|
|
||||||
UpsamplerState = null;
|
UpsamplerInfo = null;
|
||||||
|
|
||||||
base.CleanUp();
|
base.CleanUp();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,22 +55,27 @@ namespace Ryujinx.Audio.Renderer.Server.Splitter
|
|||||||
/// If set to true, the previous mix volume is explicitly resetted using the input parameter, instead of implicitly on first use.
|
/// If set to true, the previous mix volume is explicitly resetted using the input parameter, instead of implicitly on first use.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsSplitterPrevVolumeResetSupported { get; private set; }
|
public bool IsSplitterPrevVolumeResetSupported { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// If set to true, the previous mix volume is explicitly resetted using the input parameter, instead of implicitly on first use.
|
||||||
|
/// </summary>
|
||||||
|
public bool IsBiquadFilterParameterFloatSupported { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initialize <see cref="SplitterContext"/>.
|
/// Initialize <see cref="SplitterContext"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="behaviourContext">The behaviour context.</param>
|
/// <param name="behaviourInfo">The behaviour context.</param>
|
||||||
/// <param name="parameter">The audio renderer configuration.</param>
|
/// <param name="parameter">The audio renderer configuration.</param>
|
||||||
/// <param name="workBufferAllocator">The <see cref="WorkBufferAllocator"/>.</param>
|
/// <param name="workBufferAllocator">The <see cref="WorkBufferAllocator"/>.</param>
|
||||||
/// <param name="splitterBqfStates">Memory to store the biquad filtering state for splitters during processing.</param>
|
/// <param name="splitterBqfStates">Memory to store the biquad filtering state for splitters during processing.</param>
|
||||||
/// <returns>Return true if the initialization was successful.</returns>
|
/// <returns>Return true if the initialization was successful.</returns>
|
||||||
public bool Initialize(
|
public bool Initialize(
|
||||||
ref BehaviourContext behaviourContext,
|
ref BehaviourInfo behaviourInfo,
|
||||||
ref AudioRendererConfiguration parameter,
|
ref AudioRendererConfiguration parameter,
|
||||||
WorkBufferAllocator workBufferAllocator,
|
WorkBufferAllocator workBufferAllocator,
|
||||||
Memory<BiquadFilterState> splitterBqfStates)
|
Memory<BiquadFilterState> splitterBqfStates)
|
||||||
{
|
{
|
||||||
if (!behaviourContext.IsSplitterSupported() || parameter.SplitterCount <= 0 || parameter.SplitterDestinationCount <= 0)
|
if (!behaviourInfo.IsSplitterSupported() || parameter.SplitterCount <= 0 || parameter.SplitterDestinationCount <= 0)
|
||||||
{
|
{
|
||||||
Setup(Memory<SplitterState>.Empty, Memory<SplitterDestinationVersion1>.Empty, Memory<SplitterDestinationVersion2>.Empty, false);
|
Setup(Memory<SplitterState>.Empty, Memory<SplitterDestinationVersion1>.Empty, Memory<SplitterDestinationVersion2>.Empty, false);
|
||||||
|
|
||||||
@@ -94,7 +99,7 @@ namespace Ryujinx.Audio.Renderer.Server.Splitter
|
|||||||
Memory<SplitterDestinationVersion1> splitterDestinationsV1 = Memory<SplitterDestinationVersion1>.Empty;
|
Memory<SplitterDestinationVersion1> splitterDestinationsV1 = Memory<SplitterDestinationVersion1>.Empty;
|
||||||
Memory<SplitterDestinationVersion2> splitterDestinationsV2 = Memory<SplitterDestinationVersion2>.Empty;
|
Memory<SplitterDestinationVersion2> splitterDestinationsV2 = Memory<SplitterDestinationVersion2>.Empty;
|
||||||
|
|
||||||
if (!behaviourContext.IsBiquadFilterParameterForSplitterEnabled())
|
if (!behaviourInfo.IsBiquadFilterParameterForSplitterEnabled())
|
||||||
{
|
{
|
||||||
Version = 1;
|
Version = 1;
|
||||||
|
|
||||||
@@ -144,11 +149,12 @@ namespace Ryujinx.Audio.Renderer.Server.Splitter
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IsSplitterPrevVolumeResetSupported = behaviourContext.IsSplitterPrevVolumeResetSupported();
|
IsSplitterPrevVolumeResetSupported = behaviourInfo.IsSplitterPrevVolumeResetSupported();
|
||||||
|
IsBiquadFilterParameterFloatSupported = behaviourInfo.IsBiquadFilterParameterFloatSupported();
|
||||||
|
|
||||||
SplitterState.InitializeSplitters(splitters.Span);
|
SplitterState.InitializeSplitters(splitters.Span);
|
||||||
|
|
||||||
Setup(splitters, splitterDestinationsV1, splitterDestinationsV2, behaviourContext.IsSplitterBugFixed());
|
Setup(splitters, splitterDestinationsV1, splitterDestinationsV2, behaviourInfo.IsSplitterBugFixed());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -157,16 +163,16 @@ namespace Ryujinx.Audio.Renderer.Server.Splitter
|
|||||||
/// Get the work buffer size while adding the size needed for splitter to operate.
|
/// Get the work buffer size while adding the size needed for splitter to operate.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="size">The current size.</param>
|
/// <param name="size">The current size.</param>
|
||||||
/// <param name="behaviourContext">The behaviour context.</param>
|
/// <param name="behaviourInfo">The behaviour context.</param>
|
||||||
/// <param name="parameter">The renderer configuration.</param>
|
/// <param name="parameter">The renderer configuration.</param>
|
||||||
/// <returns>Return the new size taking splitter into account.</returns>
|
/// <returns>Return the new size taking splitter into account.</returns>
|
||||||
public static ulong GetWorkBufferSize(ulong size, ref BehaviourContext behaviourContext, ref AudioRendererConfiguration parameter)
|
public static ulong GetWorkBufferSize(ulong size, ref BehaviourInfo behaviourInfo, ref AudioRendererConfiguration parameter)
|
||||||
{
|
{
|
||||||
if (behaviourContext.IsSplitterSupported())
|
if (behaviourInfo.IsSplitterSupported())
|
||||||
{
|
{
|
||||||
size = WorkBufferAllocator.GetTargetSize<SplitterState>(size, parameter.SplitterCount, SplitterState.Alignment);
|
size = WorkBufferAllocator.GetTargetSize<SplitterState>(size, parameter.SplitterCount, SplitterState.Alignment);
|
||||||
|
|
||||||
if (behaviourContext.IsBiquadFilterParameterForSplitterEnabled())
|
if (behaviourInfo.IsBiquadFilterParameterForSplitterEnabled())
|
||||||
{
|
{
|
||||||
size = WorkBufferAllocator.GetTargetSize<SplitterDestinationVersion2>(size, parameter.SplitterDestinationCount, SplitterDestinationVersion2.Alignment);
|
size = WorkBufferAllocator.GetTargetSize<SplitterDestinationVersion2>(size, parameter.SplitterDestinationCount, SplitterDestinationVersion2.Alignment);
|
||||||
}
|
}
|
||||||
@@ -175,12 +181,10 @@ namespace Ryujinx.Audio.Renderer.Server.Splitter
|
|||||||
size = WorkBufferAllocator.GetTargetSize<SplitterDestinationVersion1>(size, parameter.SplitterDestinationCount, SplitterDestinationVersion1.Alignment);
|
size = WorkBufferAllocator.GetTargetSize<SplitterDestinationVersion1>(size, parameter.SplitterDestinationCount, SplitterDestinationVersion1.Alignment);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (behaviourContext.IsSplitterBugFixed())
|
if (behaviourInfo.IsSplitterBugFixed())
|
||||||
{
|
{
|
||||||
size = WorkBufferAllocator.GetTargetSize<int>(size, parameter.SplitterDestinationCount, 0x10);
|
size = WorkBufferAllocator.GetTargetSize<int>(size, parameter.SplitterDestinationCount, 0x10);
|
||||||
}
|
}
|
||||||
|
|
||||||
return size;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return size;
|
return size;
|
||||||
@@ -227,7 +231,16 @@ namespace Ryujinx.Audio.Renderer.Server.Splitter
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int length = _splitterDestinationsV2.IsEmpty ? _splitterDestinationsV1.Length : _splitterDestinationsV2.Length;
|
int length;
|
||||||
|
|
||||||
|
if (_splitterDestinationsV2.IsEmpty)
|
||||||
|
{
|
||||||
|
length = _splitterDestinationsV1.Length;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
length = _splitterDestinationsV2.Length;
|
||||||
|
}
|
||||||
|
|
||||||
return length / _splitters.Length;
|
return length / _splitters.Length;
|
||||||
}
|
}
|
||||||
@@ -278,8 +291,17 @@ namespace Ryujinx.Audio.Renderer.Server.Splitter
|
|||||||
|
|
||||||
if (parameter.IsMagicValid())
|
if (parameter.IsMagicValid())
|
||||||
{
|
{
|
||||||
int length = _splitterDestinationsV2.IsEmpty ? _splitterDestinationsV1.Length : _splitterDestinationsV2.Length;
|
int length;
|
||||||
|
|
||||||
|
if (_splitterDestinationsV2.IsEmpty)
|
||||||
|
{
|
||||||
|
length = _splitterDestinationsV1.Length;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
length = _splitterDestinationsV2.Length;
|
||||||
|
}
|
||||||
|
|
||||||
if (parameter.Id >= 0 && parameter.Id < length)
|
if (parameter.Id >= 0 && parameter.Id < length)
|
||||||
{
|
{
|
||||||
SplitterDestination destination = GetDestination(parameter.Id);
|
SplitterDestination destination = GetDestination(parameter.Id);
|
||||||
@@ -315,9 +337,19 @@ namespace Ryujinx.Audio.Renderer.Server.Splitter
|
|||||||
}
|
}
|
||||||
else if (Version == 2)
|
else if (Version == 2)
|
||||||
{
|
{
|
||||||
if (!UpdateData<SplitterDestinationInParameterVersion2>(ref input))
|
if (IsBiquadFilterParameterFloatSupported)
|
||||||
{
|
{
|
||||||
break;
|
if (!UpdateData<SplitterDestinationInParameterVersion2b>(ref input))
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!UpdateData<SplitterDestinationInParameterVersion2a>(ref input))
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -381,10 +413,8 @@ namespace Ryujinx.Audio.Renderer.Server.Splitter
|
|||||||
{
|
{
|
||||||
return new SplitterDestination(ref SpanIOHelper.GetFromMemory(_splitterDestinationsV1, id, (uint)_splitterDestinationsV1.Length));
|
return new SplitterDestination(ref SpanIOHelper.GetFromMemory(_splitterDestinationsV1, id, (uint)_splitterDestinationsV1.Length));
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
return new SplitterDestination(ref SpanIOHelper.GetFromMemory(_splitterDestinationsV2, id, (uint)_splitterDestinationsV2.Length));
|
||||||
return new SplitterDestination(ref SpanIOHelper.GetFromMemory(_splitterDestinationsV2, id, (uint)_splitterDestinationsV2.Length));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -31,15 +31,11 @@ namespace Ryujinx.Audio.Renderer.Server.Splitter
|
|||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
return _v1.Id;
|
||||||
return _v1.Id;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return _v2.Id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return _v2.Id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,15 +52,11 @@ namespace Ryujinx.Audio.Renderer.Server.Splitter
|
|||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
return _v1.DestinationId;
|
||||||
return _v1.DestinationId;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return _v2.DestinationId;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return _v2.DestinationId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,15 +74,11 @@ namespace Ryujinx.Audio.Renderer.Server.Splitter
|
|||||||
{
|
{
|
||||||
return Span<float>.Empty;
|
return Span<float>.Empty;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
return _v1.MixBufferVolume;
|
||||||
return _v1.MixBufferVolume;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return _v2.MixBufferVolume;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return _v2.MixBufferVolume;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,15 +96,11 @@ namespace Ryujinx.Audio.Renderer.Server.Splitter
|
|||||||
{
|
{
|
||||||
return Span<float>.Empty;
|
return Span<float>.Empty;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
return _v1.PreviousMixBufferVolume;
|
||||||
return _v1.PreviousMixBufferVolume;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return _v2.PreviousMixBufferVolume;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return _v2.PreviousMixBufferVolume;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -135,15 +119,11 @@ namespace Ryujinx.Audio.Renderer.Server.Splitter
|
|||||||
{
|
{
|
||||||
return new SplitterDestination();
|
return new SplitterDestination();
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
return new SplitterDestination(ref _v1.Next);
|
||||||
return new SplitterDestination(ref _v1.Next);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return new SplitterDestination(ref _v2.Next);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return new SplitterDestination(ref _v2.Next);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -169,6 +149,7 @@ namespace Ryujinx.Audio.Renderer.Server.Splitter
|
|||||||
_v2 = ref v2;
|
_v2 = ref v2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a new splitter destination wrapper for the splitter destination data.
|
/// Creates a new splitter destination wrapper for the splitter destination data.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -233,7 +214,12 @@ namespace Ryujinx.Audio.Renderer.Server.Splitter
|
|||||||
/// <returns>True if the splitter destination is used and has a destination.</returns>
|
/// <returns>True if the splitter destination is used and has a destination.</returns>
|
||||||
public readonly bool IsConfigured()
|
public readonly bool IsConfigured()
|
||||||
{
|
{
|
||||||
return Unsafe.IsNullRef(ref _v2) ? _v1.IsConfigured() : _v2.IsConfigured();
|
if (Unsafe.IsNullRef(ref _v2))
|
||||||
|
{
|
||||||
|
return _v1.IsConfigured();
|
||||||
|
}
|
||||||
|
|
||||||
|
return _v2.IsConfigured();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -243,7 +229,12 @@ namespace Ryujinx.Audio.Renderer.Server.Splitter
|
|||||||
/// <returns>The volume for the given destination.</returns>
|
/// <returns>The volume for the given destination.</returns>
|
||||||
public float GetMixVolume(int destinationIndex)
|
public float GetMixVolume(int destinationIndex)
|
||||||
{
|
{
|
||||||
return Unsafe.IsNullRef(ref _v2) ? _v1.GetMixVolume(destinationIndex) : _v2.GetMixVolume(destinationIndex);
|
if (Unsafe.IsNullRef(ref _v2))
|
||||||
|
{
|
||||||
|
return _v1.GetMixVolume(destinationIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
return _v2.GetMixVolume(destinationIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -253,7 +244,12 @@ namespace Ryujinx.Audio.Renderer.Server.Splitter
|
|||||||
/// <returns>The volume for the given destination.</returns>
|
/// <returns>The volume for the given destination.</returns>
|
||||||
public float GetMixVolumePrev(int destinationIndex)
|
public float GetMixVolumePrev(int destinationIndex)
|
||||||
{
|
{
|
||||||
return Unsafe.IsNullRef(ref _v2) ? _v1.GetMixVolumePrev(destinationIndex) : _v2.GetMixVolumePrev(destinationIndex);
|
if (Unsafe.IsNullRef(ref _v2))
|
||||||
|
{
|
||||||
|
return _v1.GetMixVolumePrev(destinationIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
return _v2.GetMixVolumePrev(destinationIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -280,13 +276,13 @@ namespace Ryujinx.Audio.Renderer.Server.Splitter
|
|||||||
if (Unsafe.IsNullRef(ref _v2))
|
if (Unsafe.IsNullRef(ref _v2))
|
||||||
{
|
{
|
||||||
Debug.Assert(!Unsafe.IsNullRef(ref next._v1));
|
Debug.Assert(!Unsafe.IsNullRef(ref next._v1));
|
||||||
|
|
||||||
_v1.Link(ref next._v1);
|
_v1.Link(ref next._v1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Debug.Assert(!Unsafe.IsNullRef(ref next._v2));
|
Debug.Assert(!Unsafe.IsNullRef(ref next._v2));
|
||||||
|
|
||||||
_v2.Link(ref next._v2);
|
_v2.Link(ref next._v2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -308,6 +304,7 @@ namespace Ryujinx.Audio.Renderer.Server.Splitter
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Checks if any biquad filter is enabled.
|
/// Checks if any biquad filter is enabled.
|
||||||
|
/// Virtual function at function table + 0x8.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>True if any biquad filter is enabled.</returns>
|
/// <returns>True if any biquad filter is enabled.</returns>
|
||||||
public bool IsBiquadFilterEnabled()
|
public bool IsBiquadFilterEnabled()
|
||||||
@@ -326,13 +323,14 @@ namespace Ryujinx.Audio.Renderer.Server.Splitter
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the biquad filter parameters.
|
/// Gets the biquad filter parameters.
|
||||||
|
/// /// Virtual function at function table + 0x10.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="index">Biquad filter index (0 or 1).</param>
|
/// <param name="index">Biquad filter index (0 or 1).</param>
|
||||||
/// <returns>Biquad filter parameters.</returns>
|
/// <returns>Biquad filter parameters.</returns>
|
||||||
public ref BiquadFilterParameter GetBiquadFilterParameter(int index)
|
public ref BiquadFilterParameter2 GetBiquadFilterParameter(int index)
|
||||||
{
|
{
|
||||||
Debug.Assert(!Unsafe.IsNullRef(ref _v2));
|
Debug.Assert(!Unsafe.IsNullRef(ref _v2));
|
||||||
|
|
||||||
return ref _v2.GetBiquadFilterParameter(index);
|
return ref _v2.GetBiquadFilterParameter(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using Ryujinx.Audio.Renderer.Dsp;
|
||||||
using Ryujinx.Audio.Renderer.Parameter;
|
using Ryujinx.Audio.Renderer.Parameter;
|
||||||
using Ryujinx.Common.Memory;
|
using Ryujinx.Common.Memory;
|
||||||
using Ryujinx.Common.Utilities;
|
using Ryujinx.Common.Utilities;
|
||||||
@@ -11,7 +12,7 @@ namespace Ryujinx.Audio.Renderer.Server.Splitter
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Server state for a splitter destination (version 2).
|
/// Server state for a splitter destination (version 2).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[StructLayout(LayoutKind.Sequential, Size = 0x110, Pack = Alignment)]
|
[StructLayout(LayoutKind.Sequential, Size = 0x128, Pack = Alignment)]
|
||||||
public struct SplitterDestinationVersion2
|
public struct SplitterDestinationVersion2
|
||||||
{
|
{
|
||||||
public const int Alignment = 0x10;
|
public const int Alignment = 0x10;
|
||||||
@@ -78,7 +79,7 @@ namespace Ryujinx.Audio.Renderer.Server.Splitter
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Array2<BiquadFilterParameter> _biquadFilters;
|
private Array2<BiquadFilterParameter2> _biquadFilters;
|
||||||
|
|
||||||
private Array2<bool> _isPreviousBiquadFilterEnabled;
|
private Array2<bool> _isPreviousBiquadFilterEnabled;
|
||||||
|
|
||||||
@@ -109,7 +110,7 @@ namespace Ryujinx.Audio.Renderer.Server.Splitter
|
|||||||
|
|
||||||
parameter.MixBufferVolume.CopyTo(MixBufferVolume);
|
parameter.MixBufferVolume.CopyTo(MixBufferVolume);
|
||||||
|
|
||||||
_biquadFilters = parameter.BiquadFilters;
|
_biquadFilters = parameter.BiquadFilters2;
|
||||||
|
|
||||||
bool resetPrevVolume = isPrevVolumeResetSupported ? parameter.ResetPrevVolume : !IsUsed && parameter.IsUsed;
|
bool resetPrevVolume = isPrevVolumeResetSupported ? parameter.ResetPrevVolume : !IsUsed && parameter.IsUsed;
|
||||||
if (resetPrevVolume)
|
if (resetPrevVolume)
|
||||||
@@ -218,7 +219,7 @@ namespace Ryujinx.Audio.Renderer.Server.Splitter
|
|||||||
/// <returns>True if any biquad filter is enabled.</returns>
|
/// <returns>True if any biquad filter is enabled.</returns>
|
||||||
public bool IsBiquadFilterEnabled()
|
public bool IsBiquadFilterEnabled()
|
||||||
{
|
{
|
||||||
Span<BiquadFilterParameter> biquadFiltersSpan = _biquadFilters.AsSpan();
|
Span<BiquadFilterParameter2> biquadFiltersSpan = _biquadFilters.AsSpan();
|
||||||
return biquadFiltersSpan[0].Enable || biquadFiltersSpan[1].Enable;
|
return biquadFiltersSpan[0].Enable || biquadFiltersSpan[1].Enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -236,7 +237,7 @@ namespace Ryujinx.Audio.Renderer.Server.Splitter
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="index">Biquad filter index (0 or 1).</param>
|
/// <param name="index">Biquad filter index (0 or 1).</param>
|
||||||
/// <returns>Biquad filter parameters.</returns>
|
/// <returns>Biquad filter parameters.</returns>
|
||||||
public ref BiquadFilterParameter GetBiquadFilterParameter(int index)
|
public ref BiquadFilterParameter2 GetBiquadFilterParameter(int index)
|
||||||
{
|
{
|
||||||
return ref _biquadFilters[index];
|
return ref _biquadFilters[index];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,39 +27,39 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
|
|
||||||
private Memory<byte> _output;
|
private Memory<byte> _output;
|
||||||
private readonly uint _processHandle;
|
private readonly uint _processHandle;
|
||||||
private BehaviourContext _behaviourContext;
|
private BehaviourInfo _behaviourInfo;
|
||||||
|
|
||||||
private readonly ref readonly UpdateDataHeader _inputHeader;
|
private readonly ref readonly UpdateDataHeader _inputHeader;
|
||||||
private readonly Memory<UpdateDataHeader> _outputHeader;
|
private readonly Memory<UpdateDataHeader> _outputHeader;
|
||||||
|
|
||||||
private readonly ref UpdateDataHeader OutputHeader => ref _outputHeader.Span[0];
|
private readonly ref UpdateDataHeader OutputHeader => ref _outputHeader.Span[0];
|
||||||
|
|
||||||
public StateUpdater(ReadOnlySequence<byte> input, Memory<byte> output, uint processHandle, BehaviourContext behaviourContext)
|
public StateUpdater(ReadOnlySequence<byte> input, Memory<byte> output, uint processHandle, BehaviourInfo behaviourInfo)
|
||||||
{
|
{
|
||||||
_inputReader = new SequenceReader<byte>(input);
|
_inputReader = new SequenceReader<byte>(input);
|
||||||
_output = output;
|
_output = output;
|
||||||
_outputOrigin = _output;
|
_outputOrigin = _output;
|
||||||
_processHandle = processHandle;
|
_processHandle = processHandle;
|
||||||
_behaviourContext = behaviourContext;
|
_behaviourInfo = behaviourInfo;
|
||||||
|
|
||||||
_inputHeader = ref _inputReader.GetRefOrRefToCopy<UpdateDataHeader>(out _);
|
_inputHeader = ref _inputReader.GetRefOrRefToCopy<UpdateDataHeader>(out _);
|
||||||
|
|
||||||
_outputHeader = SpanMemoryManager<UpdateDataHeader>.Cast(_output[..Unsafe.SizeOf<UpdateDataHeader>()]);
|
_outputHeader = SpanMemoryManager<UpdateDataHeader>.Cast(_output[..Unsafe.SizeOf<UpdateDataHeader>()]);
|
||||||
OutputHeader.Initialize(_behaviourContext.UserRevision);
|
OutputHeader.Initialize(_behaviourInfo.UserRevision);
|
||||||
_output = _output[Unsafe.SizeOf<UpdateDataHeader>()..];
|
_output = _output[Unsafe.SizeOf<UpdateDataHeader>()..];
|
||||||
}
|
}
|
||||||
|
|
||||||
public ResultCode UpdateBehaviourContext()
|
public ResultCode UpdateBehaviourInfo()
|
||||||
{
|
{
|
||||||
ref readonly BehaviourParameter parameter = ref _inputReader.GetRefOrRefToCopy<BehaviourParameter>(out _);
|
ref readonly BehaviourParameter parameter = ref _inputReader.GetRefOrRefToCopy<BehaviourParameter>(out _);
|
||||||
|
|
||||||
if (!BehaviourContext.CheckValidRevision(parameter.UserRevision) || parameter.UserRevision != _behaviourContext.UserRevision)
|
if (!BehaviourInfo.CheckValidRevision(parameter.UserRevision) || parameter.UserRevision != _behaviourInfo.UserRevision)
|
||||||
{
|
{
|
||||||
return ResultCode.InvalidUpdateInfo;
|
return ResultCode.InvalidUpdateInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
_behaviourContext.ClearError();
|
_behaviourInfo.ClearError();
|
||||||
_behaviourContext.UpdateFlags(parameter.Flags);
|
_behaviourInfo.UpdateFlags(parameter.Flags);
|
||||||
|
|
||||||
if (_inputHeader.BehaviourSize != Unsafe.SizeOf<BehaviourParameter>())
|
if (_inputHeader.BehaviourSize != Unsafe.SizeOf<BehaviourParameter>())
|
||||||
{
|
{
|
||||||
@@ -69,16 +69,16 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
return ResultCode.Success;
|
return ResultCode.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ResultCode UpdateMemoryPools(Span<MemoryPoolState> memoryPools)
|
public ResultCode UpdateMemoryPools(Span<MemoryPoolInfo> memoryPools)
|
||||||
{
|
{
|
||||||
PoolMapper mapper = new(_processHandle, _behaviourContext.IsMemoryPoolForceMappingEnabled());
|
PoolMapper mapper = new(_processHandle, _behaviourInfo.IsMemoryPoolForceMappingEnabled());
|
||||||
|
|
||||||
if (memoryPools.Length * Unsafe.SizeOf<MemoryPoolInParameter>() != _inputHeader.MemoryPoolsSize)
|
if (memoryPools.Length * Unsafe.SizeOf<MemoryPoolInParameter>() != _inputHeader.MemoryPoolsSize)
|
||||||
{
|
{
|
||||||
return ResultCode.InvalidUpdateInfo;
|
return ResultCode.InvalidUpdateInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (ref MemoryPoolState memoryPool in memoryPools)
|
foreach (ref MemoryPoolInfo memoryPool in memoryPools)
|
||||||
{
|
{
|
||||||
ref readonly MemoryPoolInParameter parameter = ref _inputReader.GetRefOrRefToCopy<MemoryPoolInParameter>(out _);
|
ref readonly MemoryPoolInParameter parameter = ref _inputReader.GetRefOrRefToCopy<MemoryPoolInParameter>(out _);
|
||||||
|
|
||||||
@@ -125,10 +125,10 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
|
|
||||||
return ResultCode.Success;
|
return ResultCode.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ResultCode UpdateVoices(VoiceContext context, PoolMapper mapper)
|
public ResultCode UpdateVoices2(VoiceContext context, PoolMapper mapper)
|
||||||
{
|
{
|
||||||
if (context.GetCount() * Unsafe.SizeOf<VoiceInParameter>() != _inputHeader.VoicesSize)
|
if (context.GetCount() * Unsafe.SizeOf<VoiceInParameter2>() != _inputHeader.VoicesSize)
|
||||||
{
|
{
|
||||||
return ResultCode.InvalidUpdateInfo;
|
return ResultCode.InvalidUpdateInfo;
|
||||||
}
|
}
|
||||||
@@ -140,27 +140,27 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
// First make everything not in use.
|
// First make everything not in use.
|
||||||
for (int i = 0; i < context.GetCount(); i++)
|
for (int i = 0; i < context.GetCount(); i++)
|
||||||
{
|
{
|
||||||
ref VoiceState state = ref context.GetState(i);
|
ref VoiceInfo info = ref context.GetState(i);
|
||||||
|
|
||||||
state.InUse = false;
|
info.InUse = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Memory<VoiceUpdateState>[] voiceUpdateStatesArray = ArrayPool<Memory<VoiceUpdateState>>.Shared.Rent(Constants.VoiceChannelCountMax);
|
Memory<VoiceState>[] voiceStatesArray = ArrayPool<Memory<VoiceState>>.Shared.Rent(Constants.VoiceChannelCountMax);
|
||||||
|
|
||||||
Span<Memory<VoiceUpdateState>> voiceUpdateStates = voiceUpdateStatesArray.AsSpan(0, Constants.VoiceChannelCountMax);
|
Span<Memory<VoiceState>> voiceStates = voiceStatesArray.AsSpan(0, Constants.VoiceChannelCountMax);
|
||||||
|
|
||||||
// Start processing
|
// Start processing
|
||||||
for (int i = 0; i < context.GetCount(); i++)
|
for (int i = 0; i < context.GetCount(); i++)
|
||||||
{
|
{
|
||||||
ref readonly VoiceInParameter parameter = ref _inputReader.GetRefOrRefToCopy<VoiceInParameter>(out _);
|
ref readonly VoiceInParameter2 parameter = ref _inputReader.GetRefOrRefToCopy<VoiceInParameter2>(out _);
|
||||||
|
|
||||||
voiceUpdateStates.Fill(Memory<VoiceUpdateState>.Empty);
|
voiceStates.Fill(Memory<VoiceState>.Empty);
|
||||||
|
|
||||||
ref VoiceOutStatus outStatus = ref SpanIOHelper.GetWriteRef<VoiceOutStatus>(ref _output)[0];
|
ref VoiceOutStatus outStatus = ref SpanIOHelper.GetWriteRef<VoiceOutStatus>(ref _output)[0];
|
||||||
|
|
||||||
if (parameter.InUse)
|
if (parameter.InUse)
|
||||||
{
|
{
|
||||||
ref VoiceState currentVoiceState = ref context.GetState(i);
|
ref VoiceInfo currentVoiceInfo = ref context.GetState(i);
|
||||||
|
|
||||||
Span<int> channelResourceIdsSpan = parameter.ChannelResourceIds.AsSpan();
|
Span<int> channelResourceIdsSpan = parameter.ChannelResourceIds.AsSpan();
|
||||||
|
|
||||||
@@ -170,36 +170,123 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
|
|
||||||
Debug.Assert(channelId >= 0 && channelId < context.GetCount());
|
Debug.Assert(channelId >= 0 && channelId < context.GetCount());
|
||||||
|
|
||||||
voiceUpdateStates[channelResourceIndex] = context.GetUpdateStateForCpu(channelId);
|
voiceStates[channelResourceIndex] = context.GetUpdateStateForCpu(channelId);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parameter.IsNew)
|
if (parameter.IsNew)
|
||||||
{
|
{
|
||||||
currentVoiceState.Initialize();
|
currentVoiceInfo.Initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
currentVoiceState.UpdateParameters(out ErrorInfo updateParameterError, in parameter, mapper, ref _behaviourContext);
|
currentVoiceInfo.UpdateParameters2(out ErrorInfo updateParameterError, in parameter, mapper, ref _behaviourInfo);
|
||||||
|
|
||||||
if (updateParameterError.ErrorCode != ResultCode.Success)
|
if (updateParameterError.ErrorCode != ResultCode.Success)
|
||||||
{
|
{
|
||||||
_behaviourContext.AppendError(ref updateParameterError);
|
_behaviourInfo.AppendError(ref updateParameterError);
|
||||||
}
|
}
|
||||||
|
|
||||||
currentVoiceState.UpdateWaveBuffers(out ErrorInfo[] waveBufferUpdateErrorInfos, in parameter, voiceUpdateStates, mapper, ref _behaviourContext);
|
currentVoiceInfo.UpdateWaveBuffers2(out ErrorInfo[] waveBufferUpdateErrorInfos, in parameter, voiceStates, mapper, ref _behaviourInfo);
|
||||||
|
|
||||||
foreach (ref ErrorInfo errorInfo in waveBufferUpdateErrorInfos.AsSpan())
|
foreach (ref ErrorInfo errorInfo in waveBufferUpdateErrorInfos.AsSpan())
|
||||||
{
|
{
|
||||||
if (errorInfo.ErrorCode != ResultCode.Success)
|
if (errorInfo.ErrorCode != ResultCode.Success)
|
||||||
{
|
{
|
||||||
_behaviourContext.AppendError(ref errorInfo);
|
_behaviourInfo.AppendError(ref errorInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
currentVoiceState.WriteOutStatus(ref outStatus, in parameter, voiceUpdateStates);
|
currentVoiceInfo.WriteOutStatus2(ref outStatus, in parameter, voiceStates);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayPool<Memory<VoiceUpdateState>>.Shared.Return(voiceUpdateStatesArray);
|
ArrayPool<Memory<VoiceState>>.Shared.Return(voiceStatesArray);
|
||||||
|
|
||||||
|
int currentOutputSize = _output.Length;
|
||||||
|
|
||||||
|
OutputHeader.VoicesSize = (uint)(Unsafe.SizeOf<VoiceOutStatus>() * context.GetCount());
|
||||||
|
OutputHeader.TotalSize += OutputHeader.VoicesSize;
|
||||||
|
|
||||||
|
Debug.Assert((initialOutputSize - currentOutputSize) == OutputHeader.VoicesSize);
|
||||||
|
|
||||||
|
_inputReader.SetConsumed(initialInputConsumed + _inputHeader.VoicesSize);
|
||||||
|
|
||||||
|
return ResultCode.Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResultCode UpdateVoices1(VoiceContext context, PoolMapper mapper)
|
||||||
|
{
|
||||||
|
if (context.GetCount() * Unsafe.SizeOf<VoiceInParameter1>() != _inputHeader.VoicesSize)
|
||||||
|
{
|
||||||
|
return ResultCode.InvalidUpdateInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
int initialOutputSize = _output.Length;
|
||||||
|
|
||||||
|
long initialInputConsumed = _inputReader.Consumed;
|
||||||
|
|
||||||
|
// First make everything not in use.
|
||||||
|
for (int i = 0; i < context.GetCount(); i++)
|
||||||
|
{
|
||||||
|
ref VoiceInfo info = ref context.GetState(i);
|
||||||
|
|
||||||
|
info.InUse = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Memory<VoiceState>[] voiceStatesArray = ArrayPool<Memory<VoiceState>>.Shared.Rent(Constants.VoiceChannelCountMax);
|
||||||
|
|
||||||
|
Span<Memory<VoiceState>> voiceStates = voiceStatesArray.AsSpan(0, Constants.VoiceChannelCountMax);
|
||||||
|
|
||||||
|
// Start processing
|
||||||
|
for (int i = 0; i < context.GetCount(); i++)
|
||||||
|
{
|
||||||
|
ref readonly VoiceInParameter1 parameter = ref _inputReader.GetRefOrRefToCopy<VoiceInParameter1>(out _);
|
||||||
|
|
||||||
|
voiceStates.Fill(Memory<VoiceState>.Empty);
|
||||||
|
|
||||||
|
ref VoiceOutStatus outStatus = ref SpanIOHelper.GetWriteRef<VoiceOutStatus>(ref _output)[0];
|
||||||
|
|
||||||
|
if (parameter.InUse)
|
||||||
|
{
|
||||||
|
ref VoiceInfo currentVoiceInfo = ref context.GetState(i);
|
||||||
|
|
||||||
|
Span<int> channelResourceIdsSpan = parameter.ChannelResourceIds.AsSpan();
|
||||||
|
|
||||||
|
for (int channelResourceIndex = 0; channelResourceIndex < parameter.ChannelCount; channelResourceIndex++)
|
||||||
|
{
|
||||||
|
int channelId = channelResourceIdsSpan[channelResourceIndex];
|
||||||
|
|
||||||
|
Debug.Assert(channelId >= 0 && channelId < context.GetCount());
|
||||||
|
|
||||||
|
voiceStates[channelResourceIndex] = context.GetUpdateStateForCpu(channelId);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (parameter.IsNew)
|
||||||
|
{
|
||||||
|
currentVoiceInfo.Initialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
currentVoiceInfo.UpdateParameters1(out ErrorInfo updateParameterError, in parameter, mapper, ref _behaviourInfo);
|
||||||
|
|
||||||
|
if (updateParameterError.ErrorCode != ResultCode.Success)
|
||||||
|
{
|
||||||
|
_behaviourInfo.AppendError(ref updateParameterError);
|
||||||
|
}
|
||||||
|
|
||||||
|
currentVoiceInfo.UpdateWaveBuffers1(out ErrorInfo[] waveBufferUpdateErrorInfos, in parameter, voiceStates, mapper, ref _behaviourInfo);
|
||||||
|
|
||||||
|
foreach (ref ErrorInfo errorInfo in waveBufferUpdateErrorInfos.AsSpan())
|
||||||
|
{
|
||||||
|
if (errorInfo.ErrorCode != ResultCode.Success)
|
||||||
|
{
|
||||||
|
_behaviourInfo.AppendError(ref errorInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
currentVoiceInfo.WriteOutStatus1(ref outStatus, in parameter, voiceStates);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ArrayPool<Memory<VoiceState>>.Shared.Return(voiceStatesArray);
|
||||||
|
|
||||||
int currentOutputSize = _output.Length;
|
int currentOutputSize = _output.Length;
|
||||||
|
|
||||||
@@ -235,7 +322,12 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
|
|
||||||
public ResultCode UpdateEffects(EffectContext context, bool isAudioRendererActive, PoolMapper mapper)
|
public ResultCode UpdateEffects(EffectContext context, bool isAudioRendererActive, PoolMapper mapper)
|
||||||
{
|
{
|
||||||
if (_behaviourContext.IsEffectInfoVersion2Supported())
|
if (_behaviourInfo.IsBiquadFilterParameterFloatSupported())
|
||||||
|
{
|
||||||
|
return UpdateEffectsVersion3(context, isAudioRendererActive, mapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_behaviourInfo.IsEffectInfoVersion2Supported())
|
||||||
{
|
{
|
||||||
return UpdateEffectsVersion2(context, isAudioRendererActive, mapper);
|
return UpdateEffectsVersion2(context, isAudioRendererActive, mapper);
|
||||||
}
|
}
|
||||||
@@ -243,6 +335,60 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
return UpdateEffectsVersion1(context, isAudioRendererActive, mapper);
|
return UpdateEffectsVersion1(context, isAudioRendererActive, mapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ResultCode UpdateEffectsVersion3(EffectContext context, bool isAudioRendererActive, PoolMapper mapper)
|
||||||
|
{
|
||||||
|
if (context.GetCount() * Unsafe.SizeOf<EffectInParameterVersion2>() != _inputHeader.EffectsSize)
|
||||||
|
{
|
||||||
|
return ResultCode.InvalidUpdateInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
int initialOutputSize = _output.Length;
|
||||||
|
|
||||||
|
long initialInputConsumed = _inputReader.Consumed;
|
||||||
|
|
||||||
|
for (int i = 0; i < context.GetCount(); i++)
|
||||||
|
{
|
||||||
|
ref readonly EffectInParameterVersion3 parameter = ref _inputReader.GetRefOrRefToCopy<EffectInParameterVersion3>(out _);
|
||||||
|
|
||||||
|
ref EffectOutStatusVersion2 outStatus = ref SpanIOHelper.GetWriteRef<EffectOutStatusVersion2>(ref _output)[0];
|
||||||
|
|
||||||
|
ref BaseEffect effect = ref context.GetEffect(i);
|
||||||
|
|
||||||
|
if (!effect.IsTypeValid(in parameter))
|
||||||
|
{
|
||||||
|
ResetEffect(ref effect, in parameter, mapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
effect.Update(out ErrorInfo updateErrorInfo, in parameter, mapper);
|
||||||
|
|
||||||
|
if (updateErrorInfo.ErrorCode != ResultCode.Success)
|
||||||
|
{
|
||||||
|
_behaviourInfo.AppendError(ref updateErrorInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
effect.StoreStatus(ref outStatus, isAudioRendererActive);
|
||||||
|
|
||||||
|
if (parameter.IsNew)
|
||||||
|
{
|
||||||
|
effect.InitializeResultState(ref context.GetDspState(i));
|
||||||
|
effect.InitializeResultState(ref context.GetState(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
effect.UpdateResultState(ref outStatus.ResultState, ref context.GetState(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
int currentOutputSize = _output.Length;
|
||||||
|
|
||||||
|
OutputHeader.EffectsSize = (uint)(Unsafe.SizeOf<EffectOutStatusVersion2>() * context.GetCount());
|
||||||
|
OutputHeader.TotalSize += OutputHeader.EffectsSize;
|
||||||
|
|
||||||
|
Debug.Assert((initialOutputSize - currentOutputSize) == OutputHeader.EffectsSize);
|
||||||
|
|
||||||
|
_inputReader.SetConsumed(initialInputConsumed + _inputHeader.EffectsSize);
|
||||||
|
|
||||||
|
return ResultCode.Success;
|
||||||
|
}
|
||||||
|
|
||||||
public ResultCode UpdateEffectsVersion2(EffectContext context, bool isAudioRendererActive, PoolMapper mapper)
|
public ResultCode UpdateEffectsVersion2(EffectContext context, bool isAudioRendererActive, PoolMapper mapper)
|
||||||
{
|
{
|
||||||
if (context.GetCount() * Unsafe.SizeOf<EffectInParameterVersion2>() != _inputHeader.EffectsSize)
|
if (context.GetCount() * Unsafe.SizeOf<EffectInParameterVersion2>() != _inputHeader.EffectsSize)
|
||||||
@@ -271,7 +417,7 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
|
|
||||||
if (updateErrorInfo.ErrorCode != ResultCode.Success)
|
if (updateErrorInfo.ErrorCode != ResultCode.Success)
|
||||||
{
|
{
|
||||||
_behaviourContext.AppendError(ref updateErrorInfo);
|
_behaviourInfo.AppendError(ref updateErrorInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
effect.StoreStatus(ref outStatus, isAudioRendererActive);
|
effect.StoreStatus(ref outStatus, isAudioRendererActive);
|
||||||
@@ -325,7 +471,7 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
|
|
||||||
if (updateErrorInfo.ErrorCode != ResultCode.Success)
|
if (updateErrorInfo.ErrorCode != ResultCode.Success)
|
||||||
{
|
{
|
||||||
_behaviourContext.AppendError(ref updateErrorInfo);
|
_behaviourInfo.AppendError(ref updateErrorInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
effect.StoreStatus(ref outStatus, isAudioRendererActive);
|
effect.StoreStatus(ref outStatus, isAudioRendererActive);
|
||||||
@@ -384,7 +530,7 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
uint inputMixSize;
|
uint inputMixSize;
|
||||||
uint inputSize = 0;
|
uint inputSize = 0;
|
||||||
|
|
||||||
if (_behaviourContext.IsMixInParameterDirtyOnlyUpdateSupported())
|
if (_behaviourInfo.IsMixInParameterDirtyOnlyUpdateSupported())
|
||||||
{
|
{
|
||||||
ref readonly MixInParameterDirtyOnlyUpdate parameter = ref _inputReader.GetRefOrRefToCopy<MixInParameterDirtyOnlyUpdate>(out _);
|
ref readonly MixInParameterDirtyOnlyUpdate parameter = ref _inputReader.GetRefOrRefToCopy<MixInParameterDirtyOnlyUpdate>(out _);
|
||||||
|
|
||||||
@@ -423,12 +569,12 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
|
|
||||||
int mixId = i;
|
int mixId = i;
|
||||||
|
|
||||||
if (_behaviourContext.IsMixInParameterDirtyOnlyUpdateSupported())
|
if (_behaviourInfo.IsMixInParameterDirtyOnlyUpdateSupported())
|
||||||
{
|
{
|
||||||
mixId = parameter.MixId;
|
mixId = parameter.MixId;
|
||||||
}
|
}
|
||||||
|
|
||||||
ref MixState mix = ref mixContext.GetState(mixId);
|
ref MixInfo mix = ref mixContext.GetState(mixId);
|
||||||
|
|
||||||
if (parameter.IsUsed != mix.IsUsed)
|
if (parameter.IsUsed != mix.IsUsed)
|
||||||
{
|
{
|
||||||
@@ -444,13 +590,13 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
|
|
||||||
if (mix.IsUsed)
|
if (mix.IsUsed)
|
||||||
{
|
{
|
||||||
isMixContextDirty |= mix.Update(mixContext.EdgeMatrix, in parameter, effectContext, splitterContext, _behaviourContext);
|
isMixContextDirty |= mix.Update(mixContext.EdgeMatrix, in parameter, effectContext, splitterContext, _behaviourInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isMixContextDirty)
|
if (isMixContextDirty)
|
||||||
{
|
{
|
||||||
if (_behaviourContext.IsSplitterSupported() && splitterContext.UsingSplitter())
|
if (_behaviourInfo.IsSplitterSupported() && splitterContext.UsingSplitter())
|
||||||
{
|
{
|
||||||
if (!mixContext.Sort(splitterContext))
|
if (!mixContext.Sort(splitterContext))
|
||||||
{
|
{
|
||||||
@@ -507,7 +653,7 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
|
|
||||||
if (updateErrorInfo.ErrorCode != ResultCode.Success)
|
if (updateErrorInfo.ErrorCode != ResultCode.Success)
|
||||||
{
|
{
|
||||||
_behaviourContext.AppendError(ref updateErrorInfo);
|
_behaviourInfo.AppendError(ref updateErrorInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -555,7 +701,7 @@ namespace Ryujinx.Audio.Renderer.Server
|
|||||||
{
|
{
|
||||||
ref BehaviourErrorInfoOutStatus outStatus = ref SpanIOHelper.GetWriteRef<BehaviourErrorInfoOutStatus>(ref _output)[0];
|
ref BehaviourErrorInfoOutStatus outStatus = ref SpanIOHelper.GetWriteRef<BehaviourErrorInfoOutStatus>(ref _output)[0];
|
||||||
|
|
||||||
_behaviourContext.CopyErrorInfo(outStatus.ErrorInfos.AsSpan(), out outStatus.ErrorInfosCount);
|
_behaviourInfo.CopyErrorInfo(outStatus.ErrorInfos.AsSpan(), out outStatus.ErrorInfosCount);
|
||||||
|
|
||||||
OutputHeader.BehaviourSize = (uint)Unsafe.SizeOf<BehaviourErrorInfoOutStatus>();
|
OutputHeader.BehaviourSize = (uint)Unsafe.SizeOf<BehaviourErrorInfoOutStatus>();
|
||||||
OutputHeader.TotalSize += OutputHeader.BehaviourSize;
|
OutputHeader.TotalSize += OutputHeader.BehaviourSize;
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
|
using Ryujinx.Audio.Renderer.Server.Voice;
|
||||||
|
|
||||||
namespace Ryujinx.Audio.Renderer.Server.Types
|
namespace Ryujinx.Audio.Renderer.Server.Types
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The internal play state of a <see cref="Voice.VoiceState"/>
|
/// The internal play state of a <see cref="VoiceInfo"/>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public enum PlayState
|
public enum PlayState
|
||||||
{
|
{
|
||||||
@@ -24,7 +26,7 @@ namespace Ryujinx.Audio.Renderer.Server.Types
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// This is changed to the <see cref="Stopped"/> state after command generation.
|
/// This is changed to the <see cref="Stopped"/> state after command generation.
|
||||||
/// <seealso cref="Voice.VoiceState.UpdateForCommandGeneration(Voice.VoiceContext)"/>
|
/// <seealso cref="VoiceInfo.UpdateForCommandGeneration(Voice.VoiceContext)"/>
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
Stopping,
|
Stopping,
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ namespace Ryujinx.Audio.Renderer.Server.Upsampler
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Server state for a upsampling.
|
/// Server state for a upsampling.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class UpsamplerState
|
public class UpsamplerInfo
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The output buffer containing the target samples.
|
/// The output buffer containing the target samples.
|
||||||
@@ -18,7 +18,7 @@ namespace Ryujinx.Audio.Renderer.Server.Upsampler
|
|||||||
public uint SampleCount { get; }
|
public uint SampleCount { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The index of the <see cref="UpsamplerState"/>. (used to free it)
|
/// The index of the <see cref="UpsamplerInfo"/>. (used to free it)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly int _index;
|
private readonly int _index;
|
||||||
|
|
||||||
@@ -43,13 +43,13 @@ namespace Ryujinx.Audio.Renderer.Server.Upsampler
|
|||||||
public UpsamplerBufferState[] BufferStates;
|
public UpsamplerBufferState[] BufferStates;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create a new <see cref="UpsamplerState"/>.
|
/// Create a new <see cref="UpsamplerInfo"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="manager">The upsampler manager.</param>
|
/// <param name="manager">The upsampler manager.</param>
|
||||||
/// <param name="index">The index of the <see cref="UpsamplerState"/>. (used to free it)</param>
|
/// <param name="index">The index of the <see cref="UpsamplerInfo"/>. (used to free it)</param>
|
||||||
/// <param name="outputBuffer">The output buffer used to contain the target samples.</param>
|
/// <param name="outputBuffer">The output buffer used to contain the target samples.</param>
|
||||||
/// <param name="sampleCount">The target sample count.</param>
|
/// <param name="sampleCount">The target sample count.</param>
|
||||||
public UpsamplerState(UpsamplerManager manager, int index, Memory<float> outputBuffer, uint sampleCount)
|
public UpsamplerInfo(UpsamplerManager manager, int index, Memory<float> outputBuffer, uint sampleCount)
|
||||||
{
|
{
|
||||||
_manager = manager;
|
_manager = manager;
|
||||||
_index = index;
|
_index = index;
|
||||||
@@ -58,7 +58,7 @@ namespace Ryujinx.Audio.Renderer.Server.Upsampler
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Release the <see cref="UpsamplerState"/>.
|
/// Release the <see cref="UpsamplerInfo"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Release()
|
public void Release()
|
||||||
{
|
{
|
||||||
@@ -22,7 +22,7 @@ namespace Ryujinx.Audio.Renderer.Server.Upsampler
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The upsamplers instances.
|
/// The upsamplers instances.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly UpsamplerState[] _upsamplers;
|
private readonly UpsamplerInfo[] _upsamplers;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The count of upsamplers.
|
/// The count of upsamplers.
|
||||||
@@ -39,14 +39,14 @@ namespace Ryujinx.Audio.Renderer.Server.Upsampler
|
|||||||
_upSamplerWorkBuffer = upSamplerWorkBuffer;
|
_upSamplerWorkBuffer = upSamplerWorkBuffer;
|
||||||
_count = count;
|
_count = count;
|
||||||
|
|
||||||
_upsamplers = new UpsamplerState[_count];
|
_upsamplers = new UpsamplerInfo[_count];
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Allocate a new <see cref="UpsamplerState"/>.
|
/// Allocate a new <see cref="UpsamplerInfo"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>A new <see cref="UpsamplerState"/> or null if out of memory.</returns>
|
/// <returns>A new <see cref="UpsamplerInfo"/> or null if out of memory.</returns>
|
||||||
public UpsamplerState Allocate()
|
public UpsamplerInfo Allocate()
|
||||||
{
|
{
|
||||||
int workBufferOffset = 0;
|
int workBufferOffset = 0;
|
||||||
|
|
||||||
@@ -56,7 +56,7 @@ namespace Ryujinx.Audio.Renderer.Server.Upsampler
|
|||||||
{
|
{
|
||||||
if (_upsamplers[i] == null)
|
if (_upsamplers[i] == null)
|
||||||
{
|
{
|
||||||
_upsamplers[i] = new UpsamplerState(this, i, _upSamplerWorkBuffer.Slice(workBufferOffset, Constants.UpSampleEntrySize), Constants.TargetSampleCount);
|
_upsamplers[i] = new UpsamplerInfo(this, i, _upSamplerWorkBuffer.Slice(workBufferOffset, Constants.UpSampleEntrySize), Constants.TargetSampleCount);
|
||||||
|
|
||||||
return _upsamplers[i];
|
return _upsamplers[i];
|
||||||
}
|
}
|
||||||
@@ -69,9 +69,9 @@ namespace Ryujinx.Audio.Renderer.Server.Upsampler
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Free a <see cref="UpsamplerState"/> at the given index.
|
/// Free a <see cref="UpsamplerInfo"/> at the given index.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="index">The index of the <see cref="UpsamplerState"/> to free.</param>
|
/// <param name="index">The index of the <see cref="UpsamplerInfo"/> to free.</param>
|
||||||
public void Free(int index)
|
public void Free(int index)
|
||||||
{
|
{
|
||||||
lock (_lock)
|
lock (_lock)
|
||||||
|
|||||||
@@ -11,14 +11,14 @@ namespace Ryujinx.Audio.Renderer.Server.Voice
|
|||||||
public class VoiceContext
|
public class VoiceContext
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Storage of the sorted indices to <see cref="VoiceState"/>.
|
/// Storage of the sorted indices to <see cref="VoiceInfo"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private Memory<int> _sortedVoices;
|
private Memory<int> _sortedVoices;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Storage for <see cref="VoiceState"/>.
|
/// Storage for <see cref="VoiceInfo"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private Memory<VoiceState> _voices;
|
private Memory<VoiceInfo> _voices;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Storage for <see cref="VoiceChannelResource"/>.
|
/// Storage for <see cref="VoiceChannelResource"/>.
|
||||||
@@ -26,27 +26,27 @@ namespace Ryujinx.Audio.Renderer.Server.Voice
|
|||||||
private Memory<VoiceChannelResource> _voiceChannelResources;
|
private Memory<VoiceChannelResource> _voiceChannelResources;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Storage for <see cref="VoiceUpdateState"/> that are used during audio renderer server updates.
|
/// Storage for <see cref="VoiceState"/> that are used during audio renderer server updates.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private Memory<VoiceUpdateState> _voiceUpdateStatesCpu;
|
private Memory<VoiceState> _voiceStatesCpu;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Storage for <see cref="VoiceUpdateState"/> for the <see cref="Dsp.AudioProcessor"/>.
|
/// Storage for <see cref="VoiceState"/> for the <see cref="Dsp.AudioProcessor"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private Memory<VoiceUpdateState> _voiceUpdateStatesDsp;
|
private Memory<VoiceState> _voiceStatesDsp;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The total voice count.
|
/// The total voice count.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private uint _voiceCount;
|
private uint _voiceCount;
|
||||||
|
|
||||||
public void Initialize(Memory<int> sortedVoices, Memory<VoiceState> voices, Memory<VoiceChannelResource> voiceChannelResources, Memory<VoiceUpdateState> voiceUpdateStatesCpu, Memory<VoiceUpdateState> voiceUpdateStatesDsp, uint voiceCount)
|
public void Initialize(Memory<int> sortedVoices, Memory<VoiceInfo> voices, Memory<VoiceChannelResource> voiceChannelResources, Memory<VoiceState> voiceStatesCpu, Memory<VoiceState> voiceStatesDsp, uint voiceCount)
|
||||||
{
|
{
|
||||||
_sortedVoices = sortedVoices;
|
_sortedVoices = sortedVoices;
|
||||||
_voices = voices;
|
_voices = voices;
|
||||||
_voiceChannelResources = voiceChannelResources;
|
_voiceChannelResources = voiceChannelResources;
|
||||||
_voiceUpdateStatesCpu = voiceUpdateStatesCpu;
|
_voiceStatesCpu = voiceStatesCpu;
|
||||||
_voiceUpdateStatesDsp = voiceUpdateStatesDsp;
|
_voiceStatesDsp = voiceStatesDsp;
|
||||||
_voiceCount = voiceCount;
|
_voiceCount = voiceCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,38 +70,38 @@ namespace Ryujinx.Audio.Renderer.Server.Voice
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get a <see cref="Memory{VoiceUpdateState}"/> at the given <paramref name="id"/>.
|
/// Get a <see cref="Memory{VoiceState}"/> at the given <paramref name="id"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id">The index to use.</param>
|
/// <param name="id">The index to use.</param>
|
||||||
/// <returns>A <see cref="Memory{VoiceUpdateState}"/> at the given <paramref name="id"/>.</returns>
|
/// <returns>A <see cref="Memory{VoiceState}"/> at the given <paramref name="id"/>.</returns>
|
||||||
/// <remarks>The returned <see cref="Memory{VoiceUpdateState}"/> should only be used when updating the server state.</remarks>
|
/// <remarks>The returned <see cref="Memory{VoiceState}"/> should only be used when updating the server state.</remarks>
|
||||||
public Memory<VoiceUpdateState> GetUpdateStateForCpu(int id)
|
public Memory<VoiceState> GetUpdateStateForCpu(int id)
|
||||||
{
|
{
|
||||||
return SpanIOHelper.GetMemory(_voiceUpdateStatesCpu, id, _voiceCount);
|
return SpanIOHelper.GetMemory(_voiceStatesCpu, id, _voiceCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get a <see cref="Memory{VoiceUpdateState}"/> at the given <paramref name="id"/>.
|
/// Get a <see cref="Memory{VoiceState}"/> at the given <paramref name="id"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id">The index to use.</param>
|
/// <param name="id">The index to use.</param>
|
||||||
/// <returns>A <see cref="Memory{VoiceUpdateState}"/> at the given <paramref name="id"/>.</returns>
|
/// <returns>A <see cref="Memory{VoiceState}"/> at the given <paramref name="id"/>.</returns>
|
||||||
/// <remarks>The returned <see cref="Memory{VoiceUpdateState}"/> should only be used in the context of processing on the <see cref="Dsp.AudioProcessor"/>.</remarks>
|
/// <remarks>The returned <see cref="Memory{VoiceState}"/> should only be used in the context of processing on the <see cref="Dsp.AudioProcessor"/>.</remarks>
|
||||||
public Memory<VoiceUpdateState> GetUpdateStateForDsp(int id)
|
public Memory<VoiceState> GetUpdateStateForDsp(int id)
|
||||||
{
|
{
|
||||||
return SpanIOHelper.GetMemory(_voiceUpdateStatesDsp, id, _voiceCount);
|
return SpanIOHelper.GetMemory(_voiceStatesDsp, id, _voiceCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get a reference to a <see cref="VoiceState"/> at the given <paramref name="id"/>.
|
/// Get a reference to a <see cref="VoiceInfo"/> at the given <paramref name="id"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id">The index to use.</param>
|
/// <param name="id">The index to use.</param>
|
||||||
/// <returns>A reference to a <see cref="VoiceState"/> at the given <paramref name="id"/>.</returns>
|
/// <returns>A reference to a <see cref="VoiceInfo"/> at the given <paramref name="id"/>.</returns>
|
||||||
public ref VoiceState GetState(int id)
|
public ref VoiceInfo GetState(int id)
|
||||||
{
|
{
|
||||||
return ref SpanIOHelper.GetFromMemory(_voices, id, _voiceCount);
|
return ref SpanIOHelper.GetFromMemory(_voices, id, _voiceCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ref VoiceState GetSortedState(int id)
|
public ref VoiceInfo GetSortedState(int id)
|
||||||
{
|
{
|
||||||
Debug.Assert(id >= 0 && id < _voiceCount);
|
Debug.Assert(id >= 0 && id < _voiceCount);
|
||||||
|
|
||||||
@@ -113,7 +113,7 @@ namespace Ryujinx.Audio.Renderer.Server.Voice
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void UpdateForCommandGeneration()
|
public void UpdateForCommandGeneration()
|
||||||
{
|
{
|
||||||
_voiceUpdateStatesDsp.CopyTo(_voiceUpdateStatesCpu);
|
_voiceStatesDsp.CopyTo(_voiceStatesCpu);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -130,14 +130,14 @@ namespace Ryujinx.Audio.Renderer.Server.Voice
|
|||||||
|
|
||||||
sortedVoicesTemp.Sort((a, b) =>
|
sortedVoicesTemp.Sort((a, b) =>
|
||||||
{
|
{
|
||||||
ref VoiceState aState = ref GetState(a);
|
ref VoiceInfo aInfo = ref GetState(a);
|
||||||
ref VoiceState bState = ref GetState(b);
|
ref VoiceInfo bInfo = ref GetState(b);
|
||||||
|
|
||||||
int result = aState.Priority.CompareTo(bState.Priority);
|
int result = aInfo.Priority.CompareTo(bInfo.Priority);
|
||||||
|
|
||||||
if (result == 0)
|
if (result == 0)
|
||||||
{
|
{
|
||||||
return aState.SortingOrder.CompareTo(bState.SortingOrder);
|
return aInfo.SortingOrder.CompareTo(bInfo.SortingOrder);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using Ryujinx.Audio.Common;
|
using Ryujinx.Audio.Common;
|
||||||
using Ryujinx.Audio.Renderer.Common;
|
using Ryujinx.Audio.Renderer.Common;
|
||||||
|
using Ryujinx.Audio.Renderer.Dsp;
|
||||||
using Ryujinx.Audio.Renderer.Dsp.State;
|
using Ryujinx.Audio.Renderer.Dsp.State;
|
||||||
using Ryujinx.Audio.Renderer.Parameter;
|
using Ryujinx.Audio.Renderer.Parameter;
|
||||||
using Ryujinx.Audio.Renderer.Server.MemoryPool;
|
using Ryujinx.Audio.Renderer.Server.MemoryPool;
|
||||||
@@ -9,13 +10,13 @@ using System;
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using static Ryujinx.Audio.Renderer.Common.BehaviourParameter;
|
using static Ryujinx.Audio.Renderer.Common.BehaviourParameter;
|
||||||
using static Ryujinx.Audio.Renderer.Parameter.VoiceInParameter;
|
using static Ryujinx.Audio.Renderer.Parameter.VoiceInParameter1;
|
||||||
using PlayState = Ryujinx.Audio.Renderer.Server.Types.PlayState;
|
using PlayState = Ryujinx.Audio.Renderer.Server.Types.PlayState;
|
||||||
|
|
||||||
namespace Ryujinx.Audio.Renderer.Server.Voice
|
namespace Ryujinx.Audio.Renderer.Server.Voice
|
||||||
{
|
{
|
||||||
[StructLayout(LayoutKind.Sequential, Pack = Alignment)]
|
[StructLayout(LayoutKind.Sequential, Pack = Alignment)]
|
||||||
public struct VoiceState
|
public struct VoiceInfo
|
||||||
{
|
{
|
||||||
public const int Alignment = 0x10;
|
public const int Alignment = 0x10;
|
||||||
|
|
||||||
@@ -102,7 +103,7 @@ namespace Ryujinx.Audio.Renderer.Server.Voice
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Biquad filters to apply to the output of the voice.
|
/// Biquad filters to apply to the output of the voice.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Array2<BiquadFilterParameter> BiquadFilters;
|
public Array2<BiquadFilterParameter2> BiquadFilters;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Total count of <see cref="WaveBufferInternal"/> of the voice.
|
/// Total count of <see cref="WaveBufferInternal"/> of the voice.
|
||||||
@@ -185,7 +186,7 @@ namespace Ryujinx.Audio.Renderer.Server.Voice
|
|||||||
public Span<bool> BiquadFilterNeedInitialization => SpanHelpers.AsSpan<BiquadFilterNeedInitializationArrayStruct, bool>(ref _biquadFilterNeedInitialization);
|
public Span<bool> BiquadFilterNeedInitialization => SpanHelpers.AsSpan<BiquadFilterNeedInitializationArrayStruct, bool>(ref _biquadFilterNeedInitialization);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initialize the <see cref="VoiceState"/>.
|
/// Initialize the <see cref="VoiceInfo"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Initialize()
|
public void Initialize()
|
||||||
{
|
{
|
||||||
@@ -215,7 +216,7 @@ namespace Ryujinx.Audio.Renderer.Server.Voice
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initialize the <see cref="WaveBuffer"/> in this <see cref="VoiceState"/>.
|
/// Initialize the <see cref="WaveBuffer"/> in this <see cref="VoiceInfo"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeWaveBuffers()
|
private void InitializeWaveBuffers()
|
||||||
{
|
{
|
||||||
@@ -250,13 +251,13 @@ namespace Ryujinx.Audio.Renderer.Server.Voice
|
|||||||
{
|
{
|
||||||
return MixId != Constants.UnusedMixId || SplitterId != Constants.UnusedSplitterId;
|
return MixId != Constants.UnusedMixId || SplitterId != Constants.UnusedSplitterId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Indicate if the server voice information needs to be updated.
|
/// Indicate if the server voice information needs to be updated.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="parameter">The user parameter.</param>
|
/// <param name="parameter">The user parameter.</param>
|
||||||
/// <returns>Return true, if the server voice information needs to be updated.</returns>
|
/// <returns>Return true, if the server voice information needs to be updated.</returns>
|
||||||
private readonly bool ShouldUpdateParameters(in VoiceInParameter parameter)
|
private readonly bool ShouldUpdateParameters2(in VoiceInParameter2 parameter)
|
||||||
{
|
{
|
||||||
if (DataSourceStateAddressInfo.CpuAddress == parameter.DataSourceStateAddress)
|
if (DataSourceStateAddressInfo.CpuAddress == parameter.DataSourceStateAddress)
|
||||||
{
|
{
|
||||||
@@ -268,14 +269,31 @@ namespace Ryujinx.Audio.Renderer.Server.Voice
|
|||||||
DataSourceStateUnmapped;
|
DataSourceStateUnmapped;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicate if the server voice information needs to be updated.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="parameter">The user parameter.</param>
|
||||||
|
/// <returns>Return true, if the server voice information needs to be updated.</returns>
|
||||||
|
private readonly bool ShouldUpdateParameters1(in VoiceInParameter1 parameter)
|
||||||
|
{
|
||||||
|
if (DataSourceStateAddressInfo.CpuAddress == parameter.DataSourceStateAddress)
|
||||||
|
{
|
||||||
|
return DataSourceStateAddressInfo.Size != parameter.DataSourceStateSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
return DataSourceStateAddressInfo.CpuAddress != parameter.DataSourceStateAddress ||
|
||||||
|
DataSourceStateAddressInfo.Size != parameter.DataSourceStateSize ||
|
||||||
|
DataSourceStateUnmapped;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Update the internal state from a user parameter.
|
/// Update the internal state from a user parameter.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="outErrorInfo">The possible <see cref="ErrorInfo"/> that was generated.</param>
|
/// <param name="outErrorInfo">The possible <see cref="ErrorInfo"/> that was generated.</param>
|
||||||
/// <param name="parameter">The user parameter.</param>
|
/// <param name="parameter">The user parameter.</param>
|
||||||
/// <param name="poolMapper">The mapper to use.</param>
|
/// <param name="poolMapper">The mapper to use.</param>
|
||||||
/// <param name="behaviourContext">The behaviour context.</param>
|
/// <param name="behaviourInfo">The behaviour context.</param>
|
||||||
public void UpdateParameters(out ErrorInfo outErrorInfo, in VoiceInParameter parameter, PoolMapper poolMapper, ref BehaviourContext behaviourContext)
|
public void UpdateParameters2(out ErrorInfo outErrorInfo, in VoiceInParameter2 parameter, PoolMapper poolMapper, ref BehaviourInfo behaviourInfo)
|
||||||
{
|
{
|
||||||
InUse = parameter.InUse;
|
InUse = parameter.InUse;
|
||||||
Id = parameter.Id;
|
Id = parameter.Id;
|
||||||
@@ -296,14 +314,14 @@ namespace Ryujinx.Audio.Renderer.Server.Voice
|
|||||||
WaveBuffersCount = parameter.WaveBuffersCount;
|
WaveBuffersCount = parameter.WaveBuffersCount;
|
||||||
WaveBuffersIndex = parameter.WaveBuffersIndex;
|
WaveBuffersIndex = parameter.WaveBuffersIndex;
|
||||||
|
|
||||||
if (behaviourContext.IsFlushVoiceWaveBuffersSupported())
|
if (behaviourInfo.IsFlushVoiceWaveBuffersSupported())
|
||||||
{
|
{
|
||||||
FlushWaveBufferCount += parameter.FlushWaveBufferCount;
|
FlushWaveBufferCount += parameter.FlushWaveBufferCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
MixId = parameter.MixId;
|
MixId = parameter.MixId;
|
||||||
|
|
||||||
if (behaviourContext.IsSplitterSupported())
|
if (behaviourInfo.IsSplitterSupported())
|
||||||
{
|
{
|
||||||
SplitterId = parameter.SplitterId;
|
SplitterId = parameter.SplitterId;
|
||||||
}
|
}
|
||||||
@@ -316,7 +334,7 @@ namespace Ryujinx.Audio.Renderer.Server.Voice
|
|||||||
|
|
||||||
DecodingBehaviour behaviour = DecodingBehaviour.Default;
|
DecodingBehaviour behaviour = DecodingBehaviour.Default;
|
||||||
|
|
||||||
if (behaviourContext.IsDecodingBehaviourFlagSupported())
|
if (behaviourInfo.IsDecodingBehaviourFlagSupported())
|
||||||
{
|
{
|
||||||
behaviour = parameter.DecodingBehaviourFlags;
|
behaviour = parameter.DecodingBehaviourFlags;
|
||||||
}
|
}
|
||||||
@@ -328,7 +346,78 @@ namespace Ryujinx.Audio.Renderer.Server.Voice
|
|||||||
VoiceDropFlag = false;
|
VoiceDropFlag = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ShouldUpdateParameters(in parameter))
|
if (ShouldUpdateParameters2(in parameter))
|
||||||
|
{
|
||||||
|
DataSourceStateUnmapped = !poolMapper.TryAttachBuffer(out outErrorInfo, ref DataSourceStateAddressInfo, parameter.DataSourceStateAddress, parameter.DataSourceStateSize);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
outErrorInfo = new ErrorInfo();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Update the internal state from a user parameter.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="outErrorInfo">The possible <see cref="ErrorInfo"/> that was generated.</param>
|
||||||
|
/// <param name="parameter">The user paramter2.</param>
|
||||||
|
/// <param name="poolMapper">The mapper to use.</param>
|
||||||
|
/// <param name="behaviourInfo">The behaviour context.</param>
|
||||||
|
public void UpdateParameters1(out ErrorInfo outErrorInfo, in VoiceInParameter1 parameter, PoolMapper poolMapper, ref BehaviourInfo behaviourInfo)
|
||||||
|
{
|
||||||
|
InUse = parameter.InUse;
|
||||||
|
Id = parameter.Id;
|
||||||
|
NodeId = parameter.NodeId;
|
||||||
|
|
||||||
|
UpdatePlayState(parameter.PlayState);
|
||||||
|
|
||||||
|
SrcQuality = parameter.SrcQuality;
|
||||||
|
|
||||||
|
Priority = parameter.Priority;
|
||||||
|
SortingOrder = parameter.SortingOrder;
|
||||||
|
SampleRate = parameter.SampleRate;
|
||||||
|
SampleFormat = parameter.SampleFormat;
|
||||||
|
ChannelsCount = parameter.ChannelCount;
|
||||||
|
Pitch = parameter.Pitch;
|
||||||
|
Volume = parameter.Volume;
|
||||||
|
BiquadFilters[0] = BiquadFilterHelper.ToBiquadFilterParameter2(parameter.BiquadFilters[0]);
|
||||||
|
BiquadFilters[1] = BiquadFilterHelper.ToBiquadFilterParameter2(parameter.BiquadFilters[1]);
|
||||||
|
WaveBuffersCount = parameter.WaveBuffersCount;
|
||||||
|
WaveBuffersIndex = parameter.WaveBuffersIndex;
|
||||||
|
|
||||||
|
if (behaviourInfo.IsFlushVoiceWaveBuffersSupported())
|
||||||
|
{
|
||||||
|
FlushWaveBufferCount += parameter.FlushWaveBufferCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
MixId = parameter.MixId;
|
||||||
|
|
||||||
|
if (behaviourInfo.IsSplitterSupported())
|
||||||
|
{
|
||||||
|
SplitterId = parameter.SplitterId;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SplitterId = Constants.UnusedSplitterId;
|
||||||
|
}
|
||||||
|
|
||||||
|
parameter.ChannelResourceIds.AsSpan().CopyTo(ChannelResourceIds.AsSpan());
|
||||||
|
|
||||||
|
DecodingBehaviour behaviour = DecodingBehaviour.Default;
|
||||||
|
|
||||||
|
if (behaviourInfo.IsDecodingBehaviourFlagSupported())
|
||||||
|
{
|
||||||
|
behaviour = parameter.DecodingBehaviourFlags;
|
||||||
|
}
|
||||||
|
|
||||||
|
DecodingBehaviour = behaviour;
|
||||||
|
|
||||||
|
if (parameter.ResetVoiceDropFlag)
|
||||||
|
{
|
||||||
|
VoiceDropFlag = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ShouldUpdateParameters1(in parameter))
|
||||||
{
|
{
|
||||||
DataSourceStateUnmapped = !poolMapper.TryAttachBuffer(out outErrorInfo, ref DataSourceStateAddressInfo, parameter.DataSourceStateAddress, parameter.DataSourceStateSize);
|
DataSourceStateUnmapped = !poolMapper.TryAttachBuffer(out outErrorInfo, ref DataSourceStateAddressInfo, parameter.DataSourceStateAddress, parameter.DataSourceStateSize);
|
||||||
}
|
}
|
||||||
@@ -375,14 +464,14 @@ namespace Ryujinx.Audio.Renderer.Server.Voice
|
|||||||
|
|
||||||
PlayState = newServerPlayState;
|
PlayState = newServerPlayState;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Write the status of the voice to the given user output.
|
/// Write the status of the voice to the given user output.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="outStatus">The given user output.</param>
|
/// <param name="outStatus">The given user output.</param>
|
||||||
/// <param name="parameter">The user parameter.</param>
|
/// <param name="parameter">The user parameter.</param>
|
||||||
/// <param name="voiceUpdateStates">The voice states associated to the <see cref="VoiceState"/>.</param>
|
/// <param name="voiceStates">The voice states associated to the <see cref="VoiceInfo"/>.</param>
|
||||||
public void WriteOutStatus(ref VoiceOutStatus outStatus, in VoiceInParameter parameter, ReadOnlySpan<Memory<VoiceUpdateState>> voiceUpdateStates)
|
public void WriteOutStatus2(ref VoiceOutStatus outStatus, in VoiceInParameter2 parameter, ReadOnlySpan<Memory<VoiceState>> voiceStates)
|
||||||
{
|
{
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
// Sanity check in debug mode of the internal state
|
// Sanity check in debug mode of the internal state
|
||||||
@@ -390,8 +479,8 @@ namespace Ryujinx.Audio.Renderer.Server.Voice
|
|||||||
{
|
{
|
||||||
for (int i = 1; i < ChannelsCount; i++)
|
for (int i = 1; i < ChannelsCount; i++)
|
||||||
{
|
{
|
||||||
ref VoiceUpdateState stateA = ref voiceUpdateStates[i - 1].Span[0];
|
ref VoiceState stateA = ref voiceStates[i - 1].Span[0];
|
||||||
ref VoiceUpdateState stateB = ref voiceUpdateStates[i].Span[0];
|
ref VoiceState stateB = ref voiceStates[i].Span[0];
|
||||||
|
|
||||||
Debug.Assert(stateA.WaveBufferConsumed == stateB.WaveBufferConsumed);
|
Debug.Assert(stateA.WaveBufferConsumed == stateB.WaveBufferConsumed);
|
||||||
Debug.Assert(stateA.PlayedSampleCount == stateB.PlayedSampleCount);
|
Debug.Assert(stateA.PlayedSampleCount == stateB.PlayedSampleCount);
|
||||||
@@ -412,7 +501,7 @@ namespace Ryujinx.Audio.Renderer.Server.Voice
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ref VoiceUpdateState state = ref voiceUpdateStates[0].Span[0];
|
ref VoiceState state = ref voiceStates[0].Span[0];
|
||||||
|
|
||||||
outStatus.VoiceDropFlag = VoiceDropFlag;
|
outStatus.VoiceDropFlag = VoiceDropFlag;
|
||||||
outStatus.PlayedWaveBuffersCount = state.WaveBufferConsumed;
|
outStatus.PlayedWaveBuffersCount = state.WaveBufferConsumed;
|
||||||
@@ -421,19 +510,63 @@ namespace Ryujinx.Audio.Renderer.Server.Voice
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Update the internal state of all the <see cref="WaveBuffer"/> of the <see cref="VoiceState"/>.
|
/// Write the status of the voice to the given user output.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="outStatus">The given user output.</param>
|
||||||
|
/// <param name="parameter">The user parameter.</param>
|
||||||
|
/// <param name="voiceStates">The voice states associated to the <see cref="VoiceInfo"/>.</param>
|
||||||
|
public void WriteOutStatus1(ref VoiceOutStatus outStatus, in VoiceInParameter1 parameter, ReadOnlySpan<Memory<VoiceState>> voiceStates)
|
||||||
|
{
|
||||||
|
#if DEBUG
|
||||||
|
// Sanity check in debug mode of the internal state
|
||||||
|
if (!parameter.IsNew && !IsNew)
|
||||||
|
{
|
||||||
|
for (int i = 1; i < ChannelsCount; i++)
|
||||||
|
{
|
||||||
|
ref VoiceState stateA = ref voiceStates[i - 1].Span[0];
|
||||||
|
ref VoiceState stateB = ref voiceStates[i].Span[0];
|
||||||
|
|
||||||
|
Debug.Assert(stateA.WaveBufferConsumed == stateB.WaveBufferConsumed);
|
||||||
|
Debug.Assert(stateA.PlayedSampleCount == stateB.PlayedSampleCount);
|
||||||
|
Debug.Assert(stateA.Offset == stateB.Offset);
|
||||||
|
Debug.Assert(stateA.WaveBufferIndex == stateB.WaveBufferIndex);
|
||||||
|
Debug.Assert(stateA.Fraction == stateB.Fraction);
|
||||||
|
Debug.Assert(stateA.IsWaveBufferValid.SequenceEqual(stateB.IsWaveBufferValid));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
if (parameter.IsNew || IsNew)
|
||||||
|
{
|
||||||
|
IsNew = true;
|
||||||
|
|
||||||
|
outStatus.VoiceDropFlag = false;
|
||||||
|
outStatus.PlayedWaveBuffersCount = 0;
|
||||||
|
outStatus.PlayedSampleCount = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ref VoiceState state = ref voiceStates[0].Span[0];
|
||||||
|
|
||||||
|
outStatus.VoiceDropFlag = VoiceDropFlag;
|
||||||
|
outStatus.PlayedWaveBuffersCount = state.WaveBufferConsumed;
|
||||||
|
outStatus.PlayedSampleCount = state.PlayedSampleCount;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Update the internal state of all the <see cref="WaveBuffer"/> of the <see cref="VoiceInfo"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="errorInfos">An array of <see cref="ErrorInfo"/> used to report errors when mapping any of the <see cref="WaveBuffer"/>.</param>
|
/// <param name="errorInfos">An array of <see cref="ErrorInfo"/> used to report errors when mapping any of the <see cref="WaveBuffer"/>.</param>
|
||||||
/// <param name="parameter">The user parameter.</param>
|
/// <param name="parameter">The user parameter.</param>
|
||||||
/// <param name="voiceUpdateStates">The voice states associated to the <see cref="VoiceState"/>.</param>
|
/// <param name="voiceStates">The voice states associated to the <see cref="VoiceInfo"/>.</param>
|
||||||
/// <param name="mapper">The mapper to use.</param>
|
/// <param name="mapper">The mapper to use.</param>
|
||||||
/// <param name="behaviourContext">The behaviour context.</param>
|
/// <param name="behaviourInfo">The behaviour context.</param>
|
||||||
public void UpdateWaveBuffers(
|
public void UpdateWaveBuffers2(
|
||||||
out ErrorInfo[] errorInfos,
|
out ErrorInfo[] errorInfos,
|
||||||
in VoiceInParameter parameter,
|
in VoiceInParameter2 parameter,
|
||||||
ReadOnlySpan<Memory<VoiceUpdateState>> voiceUpdateStates,
|
ReadOnlySpan<Memory<VoiceState>> voiceStates,
|
||||||
PoolMapper mapper,
|
PoolMapper mapper,
|
||||||
ref BehaviourContext behaviourContext)
|
ref BehaviourInfo behaviourInfo)
|
||||||
{
|
{
|
||||||
errorInfos = new ErrorInfo[Constants.VoiceWaveBufferCount * 2];
|
errorInfos = new ErrorInfo[Constants.VoiceWaveBufferCount * 2];
|
||||||
|
|
||||||
@@ -443,23 +576,61 @@ namespace Ryujinx.Audio.Renderer.Server.Voice
|
|||||||
|
|
||||||
for (int i = 0; i < parameter.ChannelCount; i++)
|
for (int i = 0; i < parameter.ChannelCount; i++)
|
||||||
{
|
{
|
||||||
voiceUpdateStates[i].Span[0].IsWaveBufferValid.Clear();
|
voiceStates[i].Span[0].IsWaveBufferValid.Clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ref VoiceUpdateState voiceUpdateState = ref voiceUpdateStates[0].Span[0];
|
ref VoiceState voiceState = ref voiceStates[0].Span[0];
|
||||||
|
|
||||||
Span<WaveBuffer> waveBuffersSpan = WaveBuffers.AsSpan();
|
Span<WaveBuffer> waveBuffersSpan = WaveBuffers.AsSpan();
|
||||||
Span<WaveBufferInternal> pWaveBuffersSpan = parameter.WaveBuffers.AsSpan();
|
Span<WaveBufferInternal> pWaveBuffersSpan = parameter.WaveBuffers.AsSpan();
|
||||||
|
|
||||||
for (int i = 0; i < Constants.VoiceWaveBufferCount; i++)
|
for (int i = 0; i < Constants.VoiceWaveBufferCount; i++)
|
||||||
{
|
{
|
||||||
UpdateWaveBuffer(errorInfos.AsSpan(i * 2, 2), ref waveBuffersSpan[i], ref pWaveBuffersSpan[i], parameter.SampleFormat, voiceUpdateState.IsWaveBufferValid[i], mapper, ref behaviourContext);
|
UpdateWaveBuffer(errorInfos.AsSpan(i * 2, 2), ref waveBuffersSpan[i], ref pWaveBuffersSpan[i], parameter.SampleFormat, voiceState.IsWaveBufferValid[i], mapper, ref behaviourInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Update the internal state of one of the <see cref="WaveBuffer"/> of the <see cref="VoiceState"/>.
|
/// Update the internal state of all the <see cref="WaveBuffer"/> of the <see cref="VoiceInfo"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="errorInfos">An array of <see cref="ErrorInfo"/> used to report errors when mapping any of the <see cref="WaveBuffer"/>.</param>
|
||||||
|
/// <param name="parameter">The user parameter.</param>
|
||||||
|
/// <param name="voiceStates">The voice states associated to the <see cref="VoiceInfo"/>.</param>
|
||||||
|
/// <param name="mapper">The mapper to use.</param>
|
||||||
|
/// <param name="behaviourInfo">The behaviour context.</param>
|
||||||
|
public void UpdateWaveBuffers1(
|
||||||
|
out ErrorInfo[] errorInfos,
|
||||||
|
in VoiceInParameter1 parameter,
|
||||||
|
ReadOnlySpan<Memory<VoiceState>> voiceStates,
|
||||||
|
PoolMapper mapper,
|
||||||
|
ref BehaviourInfo behaviourInfo)
|
||||||
|
{
|
||||||
|
errorInfos = new ErrorInfo[Constants.VoiceWaveBufferCount * 2];
|
||||||
|
|
||||||
|
if (parameter.IsNew)
|
||||||
|
{
|
||||||
|
InitializeWaveBuffers();
|
||||||
|
|
||||||
|
for (int i = 0; i < parameter.ChannelCount; i++)
|
||||||
|
{
|
||||||
|
voiceStates[i].Span[0].IsWaveBufferValid.Clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ref VoiceState voiceState = ref voiceStates[0].Span[0];
|
||||||
|
|
||||||
|
Span<WaveBuffer> waveBuffersSpan = WaveBuffers.AsSpan();
|
||||||
|
Span<WaveBufferInternal> pWaveBuffersSpan = parameter.WaveBuffers.AsSpan();
|
||||||
|
|
||||||
|
for (int i = 0; i < Constants.VoiceWaveBufferCount; i++)
|
||||||
|
{
|
||||||
|
UpdateWaveBuffer(errorInfos.AsSpan(i * 2, 2), ref waveBuffersSpan[i], ref pWaveBuffersSpan[i], parameter.SampleFormat, voiceState.IsWaveBufferValid[i], mapper, ref behaviourInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Update the internal state of one of the <see cref="WaveBuffer"/> of the <see cref="VoiceInfo"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="errorInfos">A <see cref="Span{ErrorInfo}"/> used to report errors when mapping the <see cref="WaveBuffer"/>.</param>
|
/// <param name="errorInfos">A <see cref="Span{ErrorInfo}"/> used to report errors when mapping the <see cref="WaveBuffer"/>.</param>
|
||||||
/// <param name="waveBuffer">The <see cref="WaveBuffer"/> to update.</param>
|
/// <param name="waveBuffer">The <see cref="WaveBuffer"/> to update.</param>
|
||||||
@@ -467,7 +638,7 @@ namespace Ryujinx.Audio.Renderer.Server.Voice
|
|||||||
/// <param name="sampleFormat">The <see cref="SampleFormat"/> from the user input.</param>
|
/// <param name="sampleFormat">The <see cref="SampleFormat"/> from the user input.</param>
|
||||||
/// <param name="isValid">If set to true, the server side wavebuffer is considered valid.</param>
|
/// <param name="isValid">If set to true, the server side wavebuffer is considered valid.</param>
|
||||||
/// <param name="mapper">The mapper to use.</param>
|
/// <param name="mapper">The mapper to use.</param>
|
||||||
/// <param name="behaviourContext">The behaviour context.</param>
|
/// <param name="behaviourInfo">The behaviour context.</param>
|
||||||
private void UpdateWaveBuffer(
|
private void UpdateWaveBuffer(
|
||||||
Span<ErrorInfo> errorInfos,
|
Span<ErrorInfo> errorInfos,
|
||||||
ref WaveBuffer waveBuffer,
|
ref WaveBuffer waveBuffer,
|
||||||
@@ -475,7 +646,7 @@ namespace Ryujinx.Audio.Renderer.Server.Voice
|
|||||||
SampleFormat sampleFormat,
|
SampleFormat sampleFormat,
|
||||||
bool isValid,
|
bool isValid,
|
||||||
PoolMapper mapper,
|
PoolMapper mapper,
|
||||||
ref BehaviourContext behaviourContext)
|
ref BehaviourInfo behaviourInfo)
|
||||||
{
|
{
|
||||||
if (!isValid && waveBuffer.IsSendToAudioProcessor && waveBuffer.BufferAddressInfo.CpuAddress != 0)
|
if (!isValid && waveBuffer.IsSendToAudioProcessor && waveBuffer.BufferAddressInfo.CpuAddress != 0)
|
||||||
{
|
{
|
||||||
@@ -502,7 +673,7 @@ namespace Ryujinx.Audio.Renderer.Server.Voice
|
|||||||
|
|
||||||
errorInfos[0] = bufferInfoError;
|
errorInfos[0] = bufferInfoError;
|
||||||
|
|
||||||
if (sampleFormat == SampleFormat.Adpcm && behaviourContext.IsAdpcmLoopContextBugFixed() && inputWaveBuffer.ContextAddress != 0)
|
if (sampleFormat == SampleFormat.Adpcm && behaviourInfo.IsAdpcmLoopContextBugFixed() && inputWaveBuffer.ContextAddress != 0)
|
||||||
{
|
{
|
||||||
bool adpcmLoopContextMapped = mapper.TryAttachBuffer(out ErrorInfo adpcmLoopContextInfoError,
|
bool adpcmLoopContextMapped = mapper.TryAttachBuffer(out ErrorInfo adpcmLoopContextInfoError,
|
||||||
ref waveBuffer.ContextAddressInfo,
|
ref waveBuffer.ContextAddressInfo,
|
||||||
@@ -511,13 +682,13 @@ namespace Ryujinx.Audio.Renderer.Server.Voice
|
|||||||
|
|
||||||
errorInfos[1] = adpcmLoopContextInfoError;
|
errorInfos[1] = adpcmLoopContextInfoError;
|
||||||
|
|
||||||
if (adpcmLoopContextMapped)
|
if (!adpcmLoopContextMapped || BufferInfoUnmapped)
|
||||||
{
|
{
|
||||||
BufferInfoUnmapped = DataSourceStateUnmapped;
|
BufferInfoUnmapped = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
BufferInfoUnmapped = true;
|
BufferInfoUnmapped = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -534,7 +705,7 @@ namespace Ryujinx.Audio.Renderer.Server.Voice
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reset the resources associated to this <see cref="VoiceState"/>.
|
/// Reset the resources associated to this <see cref="VoiceInfo"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="context">The voice context.</param>
|
/// <param name="context">The voice context.</param>
|
||||||
private void ResetResources(VoiceContext context)
|
private void ResetResources(VoiceContext context)
|
||||||
@@ -549,9 +720,9 @@ namespace Ryujinx.Audio.Renderer.Server.Voice
|
|||||||
|
|
||||||
Debug.Assert(voiceChannelResource.IsUsed);
|
Debug.Assert(voiceChannelResource.IsUsed);
|
||||||
|
|
||||||
Memory<VoiceUpdateState> dspSharedState = context.GetUpdateStateForDsp(channelResourceId);
|
Memory<VoiceState> dspSharedState = context.GetUpdateStateForDsp(channelResourceId);
|
||||||
|
|
||||||
MemoryMarshal.Cast<VoiceUpdateState, byte>(dspSharedState.Span).Clear();
|
MemoryMarshal.Cast<VoiceState, byte>(dspSharedState.Span).Clear();
|
||||||
|
|
||||||
voiceChannelResource.UpdateState();
|
voiceChannelResource.UpdateState();
|
||||||
}
|
}
|
||||||
@@ -561,9 +732,9 @@ namespace Ryujinx.Audio.Renderer.Server.Voice
|
|||||||
/// Flush a certain amount of <see cref="WaveBuffer"/>.
|
/// Flush a certain amount of <see cref="WaveBuffer"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="waveBufferCount">The amount of wavebuffer to flush.</param>
|
/// <param name="waveBufferCount">The amount of wavebuffer to flush.</param>
|
||||||
/// <param name="voiceUpdateStates">The voice states associated to the <see cref="VoiceState"/>.</param>
|
/// <param name="voiceStates">The voice states associated to the <see cref="VoiceInfo"/>.</param>
|
||||||
/// <param name="channelCount">The channel count from user input.</param>
|
/// <param name="channelCount">The channel count from user input.</param>
|
||||||
private void FlushWaveBuffers(uint waveBufferCount, Memory<VoiceUpdateState>[] voiceUpdateStates, uint channelCount)
|
private void FlushWaveBuffers(uint waveBufferCount, Memory<VoiceState>[] voiceStates, uint channelCount)
|
||||||
{
|
{
|
||||||
uint waveBufferIndex = WaveBuffersIndex;
|
uint waveBufferIndex = WaveBuffersIndex;
|
||||||
|
|
||||||
@@ -575,12 +746,17 @@ namespace Ryujinx.Audio.Renderer.Server.Voice
|
|||||||
|
|
||||||
for (int j = 0; j < channelCount; j++)
|
for (int j = 0; j < channelCount; j++)
|
||||||
{
|
{
|
||||||
ref VoiceUpdateState voiceUpdateState = ref voiceUpdateStates[j].Span[0];
|
ref VoiceState voiceState = ref voiceStates[j].Span[0];
|
||||||
|
|
||||||
voiceUpdateState.WaveBufferIndex = (voiceUpdateState.WaveBufferIndex + 1) % Constants.VoiceWaveBufferCount;
|
if (!waveBuffersSpan[(int)waveBufferIndex].IsSendToAudioProcessor || voiceState.IsWaveBufferValid[(int)waveBufferIndex])
|
||||||
voiceUpdateState.WaveBufferConsumed++;
|
{
|
||||||
voiceUpdateState.IsWaveBufferValid[(int)waveBufferIndex] = false;
|
voiceState.WaveBufferIndex = (voiceState.WaveBufferIndex + 1) % Constants.VoiceWaveBufferCount;
|
||||||
|
voiceState.WaveBufferConsumed++;
|
||||||
|
voiceState.IsWaveBufferValid[(int)waveBufferIndex] = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
waveBuffersSpan[(int)waveBufferIndex].IsSendToAudioProcessor = true;
|
||||||
|
|
||||||
waveBufferIndex = (waveBufferIndex + 1) % Constants.VoiceWaveBufferCount;
|
waveBufferIndex = (waveBufferIndex + 1) % Constants.VoiceWaveBufferCount;
|
||||||
}
|
}
|
||||||
@@ -589,13 +765,13 @@ namespace Ryujinx.Audio.Renderer.Server.Voice
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Update the internal parameters for command generation.
|
/// Update the internal parameters for command generation.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="voiceUpdateStates">The voice states associated to the <see cref="VoiceState"/>.</param>
|
/// <param name="voiceStates">The voice states associated to the <see cref="VoiceInfo"/>.</param>
|
||||||
/// <returns>Return true if this voice should be played.</returns>
|
/// <returns>Return true if this voice should be played.</returns>
|
||||||
public bool UpdateParametersForCommandGeneration(Memory<VoiceUpdateState>[] voiceUpdateStates)
|
public bool UpdateParametersForCommandGeneration(Memory<VoiceState>[] voiceStates)
|
||||||
{
|
{
|
||||||
if (FlushWaveBufferCount != 0)
|
if (FlushWaveBufferCount != 0)
|
||||||
{
|
{
|
||||||
FlushWaveBuffers(FlushWaveBufferCount, voiceUpdateStates, ChannelsCount);
|
FlushWaveBuffers(FlushWaveBufferCount, voiceStates, ChannelsCount);
|
||||||
|
|
||||||
FlushWaveBufferCount = 0;
|
FlushWaveBufferCount = 0;
|
||||||
}
|
}
|
||||||
@@ -615,9 +791,9 @@ namespace Ryujinx.Audio.Renderer.Server.Voice
|
|||||||
{
|
{
|
||||||
for (int y = 0; y < ChannelsCount; y++)
|
for (int y = 0; y < ChannelsCount; y++)
|
||||||
{
|
{
|
||||||
Debug.Assert(!voiceUpdateStates[y].Span[0].IsWaveBufferValid[i]);
|
Debug.Assert(!voiceStates[y].Span[0].IsWaveBufferValid[i]);
|
||||||
|
|
||||||
voiceUpdateStates[y].Span[0].IsWaveBufferValid[i] = true;
|
voiceStates[y].Span[0].IsWaveBufferValid[i] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
waveBuffer.IsSendToAudioProcessor = true;
|
waveBuffer.IsSendToAudioProcessor = true;
|
||||||
@@ -626,11 +802,11 @@ namespace Ryujinx.Audio.Renderer.Server.Voice
|
|||||||
|
|
||||||
WasPlaying = false;
|
WasPlaying = false;
|
||||||
|
|
||||||
ref VoiceUpdateState primaryVoiceUpdateState = ref voiceUpdateStates[0].Span[0];
|
ref VoiceState primaryVoiceState = ref voiceStates[0].Span[0];
|
||||||
|
|
||||||
for (int i = 0; i < primaryVoiceUpdateState.IsWaveBufferValid.Length; i++)
|
for (int i = 0; i < primaryVoiceState.IsWaveBufferValid.Length; i++)
|
||||||
{
|
{
|
||||||
if (primaryVoiceUpdateState.IsWaveBufferValid[i])
|
if (primaryVoiceState.IsWaveBufferValid[i])
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -649,27 +825,27 @@ namespace Ryujinx.Audio.Renderer.Server.Voice
|
|||||||
|
|
||||||
for (int j = 0; j < ChannelsCount; j++)
|
for (int j = 0; j < ChannelsCount; j++)
|
||||||
{
|
{
|
||||||
ref VoiceUpdateState voiceUpdateState = ref voiceUpdateStates[j].Span[0];
|
ref VoiceState voiceState = ref voiceStates[j].Span[0];
|
||||||
|
|
||||||
if (voiceUpdateState.IsWaveBufferValid[i])
|
if (voiceState.IsWaveBufferValid[i])
|
||||||
{
|
{
|
||||||
voiceUpdateState.WaveBufferIndex = (voiceUpdateState.WaveBufferIndex + 1) % Constants.VoiceWaveBufferCount;
|
voiceState.WaveBufferIndex = (voiceState.WaveBufferIndex + 1) % Constants.VoiceWaveBufferCount;
|
||||||
voiceUpdateState.WaveBufferConsumed++;
|
voiceState.WaveBufferConsumed++;
|
||||||
}
|
}
|
||||||
|
|
||||||
voiceUpdateState.IsWaveBufferValid[i] = false;
|
voiceState.IsWaveBufferValid[i] = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < ChannelsCount; i++)
|
for (int i = 0; i < ChannelsCount; i++)
|
||||||
{
|
{
|
||||||
ref VoiceUpdateState voiceUpdateState = ref voiceUpdateStates[i].Span[0];
|
ref VoiceState voiceState = ref voiceStates[i].Span[0];
|
||||||
|
|
||||||
voiceUpdateState.Offset = 0;
|
voiceState.Offset = 0;
|
||||||
voiceUpdateState.PlayedSampleCount = 0;
|
voiceState.PlayedSampleCount = 0;
|
||||||
voiceUpdateState.Pitch.AsSpan().Clear();
|
voiceState.Pitch.AsSpan().Clear();
|
||||||
voiceUpdateState.Fraction = 0;
|
voiceState.Fraction = 0;
|
||||||
voiceUpdateState.LoopContext = new AdpcmLoopContext();
|
voiceState.LoopContext = new AdpcmLoopContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayState = PlayState.Stopped;
|
PlayState = PlayState.Stopped;
|
||||||
@@ -715,16 +891,16 @@ namespace Ryujinx.Audio.Renderer.Server.Voice
|
|||||||
IsNew = false;
|
IsNew = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Memory<VoiceUpdateState>[] voiceUpdateStates = new Memory<VoiceUpdateState>[Constants.VoiceChannelCountMax];
|
Memory<VoiceState>[] voiceStates = new Memory<VoiceState>[Constants.VoiceChannelCountMax];
|
||||||
|
|
||||||
Span<int> channelResourceIdsSpan = ChannelResourceIds.AsSpan();
|
Span<int> channelResourceIdsSpan = ChannelResourceIds.AsSpan();
|
||||||
|
|
||||||
for (int i = 0; i < ChannelsCount; i++)
|
for (int i = 0; i < ChannelsCount; i++)
|
||||||
{
|
{
|
||||||
voiceUpdateStates[i] = context.GetUpdateStateForDsp(channelResourceIdsSpan[i]);
|
voiceStates[i] = context.GetUpdateStateForDsp(channelResourceIdsSpan[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return UpdateParametersForCommandGeneration(voiceUpdateStates);
|
return UpdateParametersForCommandGeneration(voiceStates);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -50,7 +50,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid.Types.SharedMemory.Common
|
|||||||
|
|
||||||
ulong value = BinaryPrimitives.ReadUInt64LittleEndian(byteSpan);
|
ulong value = BinaryPrimitives.ReadUInt64LittleEndian(byteSpan);
|
||||||
|
|
||||||
return value;
|
return value << 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int GetSamplingNumberFieldOffset<T>(ref T sampledDataStruct) where T : unmanaged, ISampledDataStruct
|
private static int GetSamplingNumberFieldOffset<T>(ref T sampledDataStruct) where T : unmanaged, ISampledDataStruct
|
||||||
|
|||||||
@@ -33,11 +33,13 @@ namespace Ryujinx.Horizon.Audio
|
|||||||
AudioOutManager audioOutManager = new(_managers.AudioOutputManager);
|
AudioOutManager audioOutManager = new(_managers.AudioOutputManager);
|
||||||
AudioInManager audioInManager = new(_managers.AudioInputManager);
|
AudioInManager audioInManager = new(_managers.AudioInputManager);
|
||||||
FinalOutputRecorderManager finalOutputRecorderManager = new();
|
FinalOutputRecorderManager finalOutputRecorderManager = new();
|
||||||
|
AudioSnoopManager audioSnoopManager = new();
|
||||||
|
|
||||||
_serverManager.RegisterObjectForServer(audioRendererManager, ServiceName.Encode("audren:u"), MaxSessionsCount);
|
_serverManager.RegisterObjectForServer(audioRendererManager, ServiceName.Encode("audren:u"), MaxSessionsCount);
|
||||||
_serverManager.RegisterObjectForServer(audioOutManager, ServiceName.Encode("audout:u"), MaxSessionsCount);
|
_serverManager.RegisterObjectForServer(audioOutManager, ServiceName.Encode("audout:u"), MaxSessionsCount);
|
||||||
_serverManager.RegisterObjectForServer(audioInManager, ServiceName.Encode("audin:u"), MaxSessionsCount);
|
_serverManager.RegisterObjectForServer(audioInManager, ServiceName.Encode("audin:u"), MaxSessionsCount);
|
||||||
_serverManager.RegisterObjectForServer(finalOutputRecorderManager, ServiceName.Encode("audrec:u"), MaxSessionsCount);
|
_serverManager.RegisterObjectForServer(finalOutputRecorderManager, ServiceName.Encode("audrec:u"), MaxSessionsCount);
|
||||||
|
_serverManager.RegisterObjectForServer(audioSnoopManager, ServiceName.Encode("auddev"), MaxSessionsCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ServiceRequests()
|
public void ServiceRequests()
|
||||||
|
|||||||
@@ -23,10 +23,10 @@ namespace Ryujinx.Horizon.Sdk.Audio.Detail
|
|||||||
{
|
{
|
||||||
_registry = registry;
|
_registry = registry;
|
||||||
|
|
||||||
BehaviourContext behaviourContext = new();
|
BehaviourInfo behaviourInfo = new();
|
||||||
behaviourContext.SetUserRevision((int)revision);
|
behaviourInfo.SetUserRevision((int)revision);
|
||||||
|
|
||||||
_isUsbDeviceSupported = behaviourContext.IsAudioUsbDeviceOutputSupported();
|
_isUsbDeviceSupported = behaviourInfo.IsAudioUsbDeviceOutputSupported();
|
||||||
_sessions = registry.GetSessionByAppletResourceId(appletResourceId.Id);
|
_sessions = registry.GetSessionByAppletResourceId(appletResourceId.Id);
|
||||||
|
|
||||||
Os.CreateSystemEvent(out _audioEvent, EventClearMode.AutoClear, interProcess: true);
|
Os.CreateSystemEvent(out _audioEvent, EventClearMode.AutoClear, interProcess: true);
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ namespace Ryujinx.Horizon.Sdk.Audio.Detail
|
|||||||
[CmifCommand(1)]
|
[CmifCommand(1)]
|
||||||
public Result GetWorkBufferSize(out long workBufferSize, AudioRendererParameterInternal parameter)
|
public Result GetWorkBufferSize(out long workBufferSize, AudioRendererParameterInternal parameter)
|
||||||
{
|
{
|
||||||
if (BehaviourContext.CheckValidRevision(parameter.Configuration.Revision))
|
if (BehaviourInfo.CheckValidRevision(parameter.Configuration.Revision))
|
||||||
{
|
{
|
||||||
workBufferSize = (long)Ryujinx.Audio.Renderer.Server.AudioRendererManager.GetWorkBufferSize(ref parameter.Configuration);
|
workBufferSize = (long)Ryujinx.Audio.Renderer.Server.AudioRendererManager.GetWorkBufferSize(ref parameter.Configuration);
|
||||||
|
|
||||||
@@ -73,7 +73,7 @@ namespace Ryujinx.Horizon.Sdk.Audio.Detail
|
|||||||
{
|
{
|
||||||
workBufferSize = 0;
|
workBufferSize = 0;
|
||||||
|
|
||||||
Logger.Warning?.Print(LogClass.ServiceAudio, $"Library Revision REV{BehaviourContext.GetRevisionNumber(parameter.Configuration.Revision)} is not supported!");
|
Logger.Warning?.Print(LogClass.ServiceAudio, $"Library Revision REV{BehaviourInfo.GetRevisionNumber(parameter.Configuration.Revision)} is not supported!");
|
||||||
|
|
||||||
return AudioResult.UnsupportedRevision;
|
return AudioResult.UnsupportedRevision;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,30 +1,64 @@
|
|||||||
using Ryujinx.Horizon.Common;
|
using Ryujinx.Horizon.Common;
|
||||||
using Ryujinx.Horizon.Sdk.Sf;
|
using Ryujinx.Horizon.Sdk.Sf;
|
||||||
|
using Ryujinx.Horizon.Sdk.Sf.Hipc;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace Ryujinx.Horizon.Sdk.Audio.Detail
|
namespace Ryujinx.Horizon.Sdk.Audio.Detail
|
||||||
{
|
{
|
||||||
partial class AudioSnoopManager : IAudioSnoopManager
|
partial class AudioSnoopManager : IAudioSnoopManager
|
||||||
{
|
{
|
||||||
|
private byte[] _dspStatisticsParameter;
|
||||||
|
|
||||||
// Note: The interface changed completely on firmware 17.0.0, this implementation is for older firmware.
|
// Note: The interface changed completely on firmware 17.0.0, this implementation is for older firmware.
|
||||||
|
|
||||||
[CmifCommand(0)]
|
[CmifCommand(0)] // [6.0.0-16.1.0]
|
||||||
public Result EnableDspUsageMeasurement()
|
public Result EnableDspUsageMeasurement()
|
||||||
{
|
{
|
||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
[CmifCommand(1)]
|
[CmifCommand(1)] // [6.0.0-16.1.0]
|
||||||
public Result DisableDspUsageMeasurement()
|
public Result DisableDspUsageMeasurement()
|
||||||
{
|
{
|
||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
[CmifCommand(6)]
|
[CmifCommand(6)] // [6.0.0-16.1.0]
|
||||||
public Result GetDspUsage(out uint usage)
|
public Result GetDspUsage(out uint usage)
|
||||||
{
|
{
|
||||||
usage = 0;
|
usage = 0;
|
||||||
|
|
||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[CmifCommand(0)] // 17.0.0+
|
||||||
|
public Result GetDspStatistics(out uint statistics) => GetDspUsage(out statistics);
|
||||||
|
|
||||||
|
[CmifCommand(1)] // 20.0.0+
|
||||||
|
public Result GetAppletStateSummaries([Buffer(HipcBufferFlags.Out | HipcBufferFlags.MapAlias)] Span<byte> summaries)
|
||||||
|
{
|
||||||
|
// Since we do not have any real applets, return empty state summaries.
|
||||||
|
summaries.Clear();
|
||||||
|
|
||||||
|
return Result.Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
[CmifCommand(2)] // 20.0.0+
|
||||||
|
public Result SetDspStatisticsParameter([Buffer(HipcBufferFlags.In | HipcBufferFlags.MapAlias)] ReadOnlySpan<byte> parameter)
|
||||||
|
{
|
||||||
|
_dspStatisticsParameter = null;
|
||||||
|
_dspStatisticsParameter = new byte[0x100];
|
||||||
|
parameter.CopyTo(_dspStatisticsParameter);
|
||||||
|
|
||||||
|
return Result.Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
[CmifCommand(3)] // 20.0.0+
|
||||||
|
public Result GetDspStatisticsParameter([Buffer(HipcBufferFlags.Out | HipcBufferFlags.MapAlias)] Span<byte> parameter)
|
||||||
|
{
|
||||||
|
_dspStatisticsParameter.CopyTo(parameter);
|
||||||
|
|
||||||
|
return Result.Success;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using Ryujinx.Horizon.Common;
|
using Ryujinx.Horizon.Common;
|
||||||
using Ryujinx.Horizon.Sdk.Sf;
|
using Ryujinx.Horizon.Sdk.Sf;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace Ryujinx.Horizon.Sdk.Audio.Detail
|
namespace Ryujinx.Horizon.Sdk.Audio.Detail
|
||||||
{
|
{
|
||||||
@@ -8,5 +9,10 @@ namespace Ryujinx.Horizon.Sdk.Audio.Detail
|
|||||||
Result EnableDspUsageMeasurement();
|
Result EnableDspUsageMeasurement();
|
||||||
Result DisableDspUsageMeasurement();
|
Result DisableDspUsageMeasurement();
|
||||||
Result GetDspUsage(out uint usage);
|
Result GetDspUsage(out uint usage);
|
||||||
|
|
||||||
|
Result GetDspStatistics(out uint statistics);
|
||||||
|
Result GetAppletStateSummaries(Span<byte> summaries);
|
||||||
|
Result SetDspStatisticsParameter(ReadOnlySpan<byte> parameter);
|
||||||
|
Result GetDspStatisticsParameter(Span<byte> parameter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,8 @@ namespace Ryujinx.Tests.Audio.Renderer
|
|||||||
[Test]
|
[Test]
|
||||||
public void EnsureTypeSize()
|
public void EnsureTypeSize()
|
||||||
{
|
{
|
||||||
Assert.AreEqual(0xC, Unsafe.SizeOf<BiquadFilterParameter>());
|
Assert.AreEqual(0xC, Unsafe.SizeOf<BiquadFilterParameter1>());
|
||||||
|
Assert.AreEqual(0x18, Unsafe.SizeOf<BiquadFilterParameter2>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,12 +4,12 @@ using System.Runtime.CompilerServices;
|
|||||||
|
|
||||||
namespace Ryujinx.Tests.Audio.Renderer.Common
|
namespace Ryujinx.Tests.Audio.Renderer.Common
|
||||||
{
|
{
|
||||||
class VoiceUpdateStateTests
|
class VoiceStateTests
|
||||||
{
|
{
|
||||||
[Test]
|
[Test]
|
||||||
public void EnsureTypeSize()
|
public void EnsureTypeSize()
|
||||||
{
|
{
|
||||||
Assert.LessOrEqual(Unsafe.SizeOf<VoiceUpdateState>(), 0x100);
|
Assert.LessOrEqual(Unsafe.SizeOf<VoiceState>(), 0x100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -8,19 +8,19 @@ namespace Ryujinx.Tests.Audio.Renderer.Dsp
|
|||||||
class ResamplerTests
|
class ResamplerTests
|
||||||
{
|
{
|
||||||
[Test]
|
[Test]
|
||||||
[TestCase(VoiceInParameter.SampleRateConversionQuality.Low)]
|
[TestCase(SampleRateConversionQuality.Low)]
|
||||||
[TestCase(VoiceInParameter.SampleRateConversionQuality.Default)]
|
[TestCase(SampleRateConversionQuality.Default)]
|
||||||
[TestCase(VoiceInParameter.SampleRateConversionQuality.High)]
|
[TestCase(SampleRateConversionQuality.High)]
|
||||||
public void TestResamplerConsistencyUpsampling(VoiceInParameter.SampleRateConversionQuality quality)
|
public void TestResamplerConsistencyUpsampling(SampleRateConversionQuality quality)
|
||||||
{
|
{
|
||||||
DoResamplingTest(44100, 48000, quality);
|
DoResamplingTest(44100, 48000, quality);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
[TestCase(VoiceInParameter.SampleRateConversionQuality.Low)]
|
[TestCase(SampleRateConversionQuality.Low)]
|
||||||
[TestCase(VoiceInParameter.SampleRateConversionQuality.Default)]
|
[TestCase(SampleRateConversionQuality.Default)]
|
||||||
[TestCase(VoiceInParameter.SampleRateConversionQuality.High)]
|
[TestCase(SampleRateConversionQuality.High)]
|
||||||
public void TestResamplerConsistencyDownsampling(VoiceInParameter.SampleRateConversionQuality quality)
|
public void TestResamplerConsistencyDownsampling(SampleRateConversionQuality quality)
|
||||||
{
|
{
|
||||||
DoResamplingTest(48000, 44100, quality);
|
DoResamplingTest(48000, 44100, quality);
|
||||||
}
|
}
|
||||||
@@ -32,7 +32,7 @@ namespace Ryujinx.Tests.Audio.Renderer.Dsp
|
|||||||
/// <param name="inputRate">The input sample rate to test</param>
|
/// <param name="inputRate">The input sample rate to test</param>
|
||||||
/// <param name="outputRate">The output sample rate to test</param>
|
/// <param name="outputRate">The output sample rate to test</param>
|
||||||
/// <param name="quality">The resampler quality to use</param>
|
/// <param name="quality">The resampler quality to use</param>
|
||||||
private static void DoResamplingTest(int inputRate, int outputRate, VoiceInParameter.SampleRateConversionQuality quality)
|
private static void DoResamplingTest(int inputRate, int outputRate, SampleRateConversionQuality quality)
|
||||||
{
|
{
|
||||||
float inputSampleRate = inputRate;
|
float inputSampleRate = inputRate;
|
||||||
float outputSampleRate = outputRate;
|
float outputSampleRate = outputRate;
|
||||||
@@ -61,8 +61,8 @@ namespace Ryujinx.Tests.Audio.Renderer.Dsp
|
|||||||
float sumDifference = 0;
|
float sumDifference = 0;
|
||||||
int delay = quality switch
|
int delay = quality switch
|
||||||
{
|
{
|
||||||
VoiceInParameter.SampleRateConversionQuality.High => 3,
|
SampleRateConversionQuality.High => 3,
|
||||||
VoiceInParameter.SampleRateConversionQuality.Default => 1,
|
SampleRateConversionQuality.Default => 1,
|
||||||
_ => 0,
|
_ => 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,8 @@ namespace Ryujinx.Tests.Audio.Renderer.Parameter.Effect
|
|||||||
[Test]
|
[Test]
|
||||||
public void EnsureTypeSize()
|
public void EnsureTypeSize()
|
||||||
{
|
{
|
||||||
Assert.AreEqual(0x18, Unsafe.SizeOf<BiquadFilterEffectParameter>());
|
Assert.AreEqual(0x18, Unsafe.SizeOf<BiquadFilterEffectParameter1>());
|
||||||
|
Assert.AreEqual(0x24, Unsafe.SizeOf<BiquadFilterEffectParameter2>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ namespace Ryujinx.Tests.Audio.Renderer.Server
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestGetReference()
|
public void TestGetReference()
|
||||||
{
|
{
|
||||||
MemoryPoolState[] memoryPoolState = new MemoryPoolState[1];
|
MemoryPoolInfo[] memoryPoolState = new MemoryPoolInfo[1];
|
||||||
memoryPoolState[0] = MemoryPoolState.Create(MemoryPoolState.LocationType.Cpu);
|
memoryPoolState[0] = MemoryPoolInfo.Create(MemoryPoolInfo.LocationType.Cpu);
|
||||||
memoryPoolState[0].SetCpuAddress(0x1000000, 0x10000);
|
memoryPoolState[0].SetCpuAddress(0x1000000, 0x10000);
|
||||||
memoryPoolState[0].DspAddress = 0x4000000;
|
memoryPoolState[0].DspAddress = 0x4000000;
|
||||||
|
|
||||||
|
|||||||
@@ -1,413 +0,0 @@
|
|||||||
using NUnit.Framework;
|
|
||||||
using Ryujinx.Audio.Renderer.Server;
|
|
||||||
|
|
||||||
namespace Ryujinx.Tests.Audio.Renderer.Server
|
|
||||||
{
|
|
||||||
public class BehaviourContextTests
|
|
||||||
{
|
|
||||||
[Test]
|
|
||||||
public void TestCheckFeature()
|
|
||||||
{
|
|
||||||
int latestRevision = BehaviourContext.BaseRevisionMagic + BehaviourContext.LastRevision;
|
|
||||||
int previousRevision = BehaviourContext.BaseRevisionMagic + (BehaviourContext.LastRevision - 1);
|
|
||||||
int invalidRevision = BehaviourContext.BaseRevisionMagic + (BehaviourContext.LastRevision + 1);
|
|
||||||
|
|
||||||
Assert.IsTrue(BehaviourContext.CheckFeatureSupported(latestRevision, latestRevision));
|
|
||||||
Assert.IsFalse(BehaviourContext.CheckFeatureSupported(previousRevision, latestRevision));
|
|
||||||
Assert.IsTrue(BehaviourContext.CheckFeatureSupported(latestRevision, previousRevision));
|
|
||||||
// In case we get an invalid revision, this is supposed to auto default to REV1 internally.. idk what the hell Nintendo was thinking here..
|
|
||||||
Assert.IsTrue(BehaviourContext.CheckFeatureSupported(invalidRevision, latestRevision));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void TestsMemoryPoolForceMappingEnabled()
|
|
||||||
{
|
|
||||||
BehaviourContext behaviourContext = new();
|
|
||||||
|
|
||||||
behaviourContext.SetUserRevision(BehaviourContext.BaseRevisionMagic + BehaviourContext.Revision1);
|
|
||||||
|
|
||||||
Assert.IsFalse(behaviourContext.IsMemoryPoolForceMappingEnabled());
|
|
||||||
|
|
||||||
behaviourContext.UpdateFlags(0x1);
|
|
||||||
|
|
||||||
Assert.IsTrue(behaviourContext.IsMemoryPoolForceMappingEnabled());
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void TestRevision1()
|
|
||||||
{
|
|
||||||
BehaviourContext behaviourContext = new();
|
|
||||||
|
|
||||||
behaviourContext.SetUserRevision(BehaviourContext.BaseRevisionMagic + BehaviourContext.Revision1);
|
|
||||||
|
|
||||||
Assert.IsFalse(behaviourContext.IsAdpcmLoopContextBugFixed());
|
|
||||||
Assert.IsFalse(behaviourContext.IsSplitterSupported());
|
|
||||||
Assert.IsFalse(behaviourContext.IsLongSizePreDelaySupported());
|
|
||||||
Assert.IsFalse(behaviourContext.IsAudioUsbDeviceOutputSupported());
|
|
||||||
Assert.IsFalse(behaviourContext.IsFlushVoiceWaveBuffersSupported());
|
|
||||||
Assert.IsFalse(behaviourContext.IsSplitterBugFixed());
|
|
||||||
Assert.IsFalse(behaviourContext.IsElapsedFrameCountSupported());
|
|
||||||
Assert.IsFalse(behaviourContext.IsDecodingBehaviourFlagSupported());
|
|
||||||
Assert.IsFalse(behaviourContext.IsBiquadFilterEffectStateClearBugFixed());
|
|
||||||
Assert.IsFalse(behaviourContext.IsMixInParameterDirtyOnlyUpdateSupported());
|
|
||||||
Assert.IsFalse(behaviourContext.IsWaveBufferVersion2Supported());
|
|
||||||
Assert.IsFalse(behaviourContext.IsEffectInfoVersion2Supported());
|
|
||||||
Assert.IsFalse(behaviourContext.UseMultiTapBiquadFilterProcessing());
|
|
||||||
Assert.IsFalse(behaviourContext.IsNewEffectChannelMappingSupported());
|
|
||||||
Assert.IsFalse(behaviourContext.IsBiquadFilterParameterForSplitterEnabled());
|
|
||||||
Assert.IsFalse(behaviourContext.IsSplitterPrevVolumeResetSupported());
|
|
||||||
|
|
||||||
Assert.AreEqual(0.70f, behaviourContext.GetAudioRendererProcessingTimeLimit());
|
|
||||||
Assert.AreEqual(1, behaviourContext.GetCommandProcessingTimeEstimatorVersion());
|
|
||||||
Assert.AreEqual(1, behaviourContext.GetPerformanceMetricsDataFormat());
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void TestRevision2()
|
|
||||||
{
|
|
||||||
BehaviourContext behaviourContext = new();
|
|
||||||
|
|
||||||
behaviourContext.SetUserRevision(BehaviourContext.BaseRevisionMagic + BehaviourContext.Revision2);
|
|
||||||
|
|
||||||
Assert.IsTrue(behaviourContext.IsAdpcmLoopContextBugFixed());
|
|
||||||
Assert.IsTrue(behaviourContext.IsSplitterSupported());
|
|
||||||
Assert.IsFalse(behaviourContext.IsLongSizePreDelaySupported());
|
|
||||||
Assert.IsFalse(behaviourContext.IsAudioUsbDeviceOutputSupported());
|
|
||||||
Assert.IsFalse(behaviourContext.IsFlushVoiceWaveBuffersSupported());
|
|
||||||
Assert.IsFalse(behaviourContext.IsSplitterBugFixed());
|
|
||||||
Assert.IsFalse(behaviourContext.IsElapsedFrameCountSupported());
|
|
||||||
Assert.IsFalse(behaviourContext.IsDecodingBehaviourFlagSupported());
|
|
||||||
Assert.IsFalse(behaviourContext.IsBiquadFilterEffectStateClearBugFixed());
|
|
||||||
Assert.IsFalse(behaviourContext.IsMixInParameterDirtyOnlyUpdateSupported());
|
|
||||||
Assert.IsFalse(behaviourContext.IsWaveBufferVersion2Supported());
|
|
||||||
Assert.IsFalse(behaviourContext.IsEffectInfoVersion2Supported());
|
|
||||||
Assert.IsFalse(behaviourContext.UseMultiTapBiquadFilterProcessing());
|
|
||||||
Assert.IsFalse(behaviourContext.IsNewEffectChannelMappingSupported());
|
|
||||||
Assert.IsFalse(behaviourContext.IsBiquadFilterParameterForSplitterEnabled());
|
|
||||||
Assert.IsFalse(behaviourContext.IsSplitterPrevVolumeResetSupported());
|
|
||||||
|
|
||||||
Assert.AreEqual(0.70f, behaviourContext.GetAudioRendererProcessingTimeLimit());
|
|
||||||
Assert.AreEqual(1, behaviourContext.GetCommandProcessingTimeEstimatorVersion());
|
|
||||||
Assert.AreEqual(1, behaviourContext.GetPerformanceMetricsDataFormat());
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void TestRevision3()
|
|
||||||
{
|
|
||||||
BehaviourContext behaviourContext = new();
|
|
||||||
|
|
||||||
behaviourContext.SetUserRevision(BehaviourContext.BaseRevisionMagic + BehaviourContext.Revision3);
|
|
||||||
|
|
||||||
Assert.IsTrue(behaviourContext.IsAdpcmLoopContextBugFixed());
|
|
||||||
Assert.IsTrue(behaviourContext.IsSplitterSupported());
|
|
||||||
Assert.IsTrue(behaviourContext.IsLongSizePreDelaySupported());
|
|
||||||
Assert.IsFalse(behaviourContext.IsAudioUsbDeviceOutputSupported());
|
|
||||||
Assert.IsFalse(behaviourContext.IsFlushVoiceWaveBuffersSupported());
|
|
||||||
Assert.IsFalse(behaviourContext.IsSplitterBugFixed());
|
|
||||||
Assert.IsFalse(behaviourContext.IsElapsedFrameCountSupported());
|
|
||||||
Assert.IsFalse(behaviourContext.IsDecodingBehaviourFlagSupported());
|
|
||||||
Assert.IsFalse(behaviourContext.IsBiquadFilterEffectStateClearBugFixed());
|
|
||||||
Assert.IsFalse(behaviourContext.IsMixInParameterDirtyOnlyUpdateSupported());
|
|
||||||
Assert.IsFalse(behaviourContext.IsWaveBufferVersion2Supported());
|
|
||||||
Assert.IsFalse(behaviourContext.IsEffectInfoVersion2Supported());
|
|
||||||
Assert.IsFalse(behaviourContext.UseMultiTapBiquadFilterProcessing());
|
|
||||||
Assert.IsFalse(behaviourContext.IsNewEffectChannelMappingSupported());
|
|
||||||
Assert.IsFalse(behaviourContext.IsBiquadFilterParameterForSplitterEnabled());
|
|
||||||
Assert.IsFalse(behaviourContext.IsSplitterPrevVolumeResetSupported());
|
|
||||||
|
|
||||||
Assert.AreEqual(0.70f, behaviourContext.GetAudioRendererProcessingTimeLimit());
|
|
||||||
Assert.AreEqual(1, behaviourContext.GetCommandProcessingTimeEstimatorVersion());
|
|
||||||
Assert.AreEqual(1, behaviourContext.GetPerformanceMetricsDataFormat());
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void TestRevision4()
|
|
||||||
{
|
|
||||||
BehaviourContext behaviourContext = new();
|
|
||||||
|
|
||||||
behaviourContext.SetUserRevision(BehaviourContext.BaseRevisionMagic + BehaviourContext.Revision4);
|
|
||||||
|
|
||||||
Assert.IsTrue(behaviourContext.IsAdpcmLoopContextBugFixed());
|
|
||||||
Assert.IsTrue(behaviourContext.IsSplitterSupported());
|
|
||||||
Assert.IsTrue(behaviourContext.IsLongSizePreDelaySupported());
|
|
||||||
Assert.IsTrue(behaviourContext.IsAudioUsbDeviceOutputSupported());
|
|
||||||
Assert.IsFalse(behaviourContext.IsFlushVoiceWaveBuffersSupported());
|
|
||||||
Assert.IsFalse(behaviourContext.IsSplitterBugFixed());
|
|
||||||
Assert.IsFalse(behaviourContext.IsElapsedFrameCountSupported());
|
|
||||||
Assert.IsFalse(behaviourContext.IsDecodingBehaviourFlagSupported());
|
|
||||||
Assert.IsFalse(behaviourContext.IsBiquadFilterEffectStateClearBugFixed());
|
|
||||||
Assert.IsFalse(behaviourContext.IsMixInParameterDirtyOnlyUpdateSupported());
|
|
||||||
Assert.IsFalse(behaviourContext.IsWaveBufferVersion2Supported());
|
|
||||||
Assert.IsFalse(behaviourContext.IsEffectInfoVersion2Supported());
|
|
||||||
Assert.IsFalse(behaviourContext.UseMultiTapBiquadFilterProcessing());
|
|
||||||
Assert.IsFalse(behaviourContext.IsNewEffectChannelMappingSupported());
|
|
||||||
Assert.IsFalse(behaviourContext.IsBiquadFilterParameterForSplitterEnabled());
|
|
||||||
Assert.IsFalse(behaviourContext.IsSplitterPrevVolumeResetSupported());
|
|
||||||
|
|
||||||
Assert.AreEqual(0.75f, behaviourContext.GetAudioRendererProcessingTimeLimit());
|
|
||||||
Assert.AreEqual(1, behaviourContext.GetCommandProcessingTimeEstimatorVersion());
|
|
||||||
Assert.AreEqual(1, behaviourContext.GetPerformanceMetricsDataFormat());
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void TestRevision5()
|
|
||||||
{
|
|
||||||
BehaviourContext behaviourContext = new();
|
|
||||||
|
|
||||||
behaviourContext.SetUserRevision(BehaviourContext.BaseRevisionMagic + BehaviourContext.Revision5);
|
|
||||||
|
|
||||||
Assert.IsTrue(behaviourContext.IsAdpcmLoopContextBugFixed());
|
|
||||||
Assert.IsTrue(behaviourContext.IsSplitterSupported());
|
|
||||||
Assert.IsTrue(behaviourContext.IsLongSizePreDelaySupported());
|
|
||||||
Assert.IsTrue(behaviourContext.IsAudioUsbDeviceOutputSupported());
|
|
||||||
Assert.IsTrue(behaviourContext.IsFlushVoiceWaveBuffersSupported());
|
|
||||||
Assert.IsTrue(behaviourContext.IsSplitterBugFixed());
|
|
||||||
Assert.IsTrue(behaviourContext.IsElapsedFrameCountSupported());
|
|
||||||
Assert.IsTrue(behaviourContext.IsDecodingBehaviourFlagSupported());
|
|
||||||
Assert.IsFalse(behaviourContext.IsBiquadFilterEffectStateClearBugFixed());
|
|
||||||
Assert.IsFalse(behaviourContext.IsMixInParameterDirtyOnlyUpdateSupported());
|
|
||||||
Assert.IsFalse(behaviourContext.IsWaveBufferVersion2Supported());
|
|
||||||
Assert.IsFalse(behaviourContext.IsEffectInfoVersion2Supported());
|
|
||||||
Assert.IsFalse(behaviourContext.UseMultiTapBiquadFilterProcessing());
|
|
||||||
Assert.IsFalse(behaviourContext.IsNewEffectChannelMappingSupported());
|
|
||||||
Assert.IsFalse(behaviourContext.IsBiquadFilterParameterForSplitterEnabled());
|
|
||||||
Assert.IsFalse(behaviourContext.IsSplitterPrevVolumeResetSupported());
|
|
||||||
|
|
||||||
Assert.AreEqual(0.80f, behaviourContext.GetAudioRendererProcessingTimeLimit());
|
|
||||||
Assert.AreEqual(2, behaviourContext.GetCommandProcessingTimeEstimatorVersion());
|
|
||||||
Assert.AreEqual(2, behaviourContext.GetPerformanceMetricsDataFormat());
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void TestRevision6()
|
|
||||||
{
|
|
||||||
BehaviourContext behaviourContext = new();
|
|
||||||
|
|
||||||
behaviourContext.SetUserRevision(BehaviourContext.BaseRevisionMagic + BehaviourContext.Revision6);
|
|
||||||
|
|
||||||
Assert.IsTrue(behaviourContext.IsAdpcmLoopContextBugFixed());
|
|
||||||
Assert.IsTrue(behaviourContext.IsSplitterSupported());
|
|
||||||
Assert.IsTrue(behaviourContext.IsLongSizePreDelaySupported());
|
|
||||||
Assert.IsTrue(behaviourContext.IsAudioUsbDeviceOutputSupported());
|
|
||||||
Assert.IsTrue(behaviourContext.IsFlushVoiceWaveBuffersSupported());
|
|
||||||
Assert.IsTrue(behaviourContext.IsSplitterBugFixed());
|
|
||||||
Assert.IsTrue(behaviourContext.IsElapsedFrameCountSupported());
|
|
||||||
Assert.IsTrue(behaviourContext.IsDecodingBehaviourFlagSupported());
|
|
||||||
Assert.IsTrue(behaviourContext.IsBiquadFilterEffectStateClearBugFixed());
|
|
||||||
Assert.IsFalse(behaviourContext.IsMixInParameterDirtyOnlyUpdateSupported());
|
|
||||||
Assert.IsFalse(behaviourContext.IsWaveBufferVersion2Supported());
|
|
||||||
Assert.IsFalse(behaviourContext.IsEffectInfoVersion2Supported());
|
|
||||||
Assert.IsFalse(behaviourContext.UseMultiTapBiquadFilterProcessing());
|
|
||||||
Assert.IsFalse(behaviourContext.IsNewEffectChannelMappingSupported());
|
|
||||||
Assert.IsFalse(behaviourContext.IsBiquadFilterParameterForSplitterEnabled());
|
|
||||||
Assert.IsFalse(behaviourContext.IsSplitterPrevVolumeResetSupported());
|
|
||||||
|
|
||||||
Assert.AreEqual(0.80f, behaviourContext.GetAudioRendererProcessingTimeLimit());
|
|
||||||
Assert.AreEqual(2, behaviourContext.GetCommandProcessingTimeEstimatorVersion());
|
|
||||||
Assert.AreEqual(2, behaviourContext.GetPerformanceMetricsDataFormat());
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void TestRevision7()
|
|
||||||
{
|
|
||||||
BehaviourContext behaviourContext = new();
|
|
||||||
|
|
||||||
behaviourContext.SetUserRevision(BehaviourContext.BaseRevisionMagic + BehaviourContext.Revision7);
|
|
||||||
|
|
||||||
Assert.IsTrue(behaviourContext.IsAdpcmLoopContextBugFixed());
|
|
||||||
Assert.IsTrue(behaviourContext.IsSplitterSupported());
|
|
||||||
Assert.IsTrue(behaviourContext.IsLongSizePreDelaySupported());
|
|
||||||
Assert.IsTrue(behaviourContext.IsAudioUsbDeviceOutputSupported());
|
|
||||||
Assert.IsTrue(behaviourContext.IsFlushVoiceWaveBuffersSupported());
|
|
||||||
Assert.IsTrue(behaviourContext.IsSplitterBugFixed());
|
|
||||||
Assert.IsTrue(behaviourContext.IsElapsedFrameCountSupported());
|
|
||||||
Assert.IsTrue(behaviourContext.IsDecodingBehaviourFlagSupported());
|
|
||||||
Assert.IsTrue(behaviourContext.IsBiquadFilterEffectStateClearBugFixed());
|
|
||||||
Assert.IsTrue(behaviourContext.IsMixInParameterDirtyOnlyUpdateSupported());
|
|
||||||
Assert.IsFalse(behaviourContext.IsWaveBufferVersion2Supported());
|
|
||||||
Assert.IsFalse(behaviourContext.IsEffectInfoVersion2Supported());
|
|
||||||
Assert.IsFalse(behaviourContext.UseMultiTapBiquadFilterProcessing());
|
|
||||||
Assert.IsFalse(behaviourContext.IsNewEffectChannelMappingSupported());
|
|
||||||
Assert.IsFalse(behaviourContext.IsBiquadFilterParameterForSplitterEnabled());
|
|
||||||
Assert.IsFalse(behaviourContext.IsSplitterPrevVolumeResetSupported());
|
|
||||||
|
|
||||||
Assert.AreEqual(0.80f, behaviourContext.GetAudioRendererProcessingTimeLimit());
|
|
||||||
Assert.AreEqual(2, behaviourContext.GetCommandProcessingTimeEstimatorVersion());
|
|
||||||
Assert.AreEqual(2, behaviourContext.GetPerformanceMetricsDataFormat());
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void TestRevision8()
|
|
||||||
{
|
|
||||||
BehaviourContext behaviourContext = new();
|
|
||||||
|
|
||||||
behaviourContext.SetUserRevision(BehaviourContext.BaseRevisionMagic + BehaviourContext.Revision8);
|
|
||||||
|
|
||||||
Assert.IsTrue(behaviourContext.IsAdpcmLoopContextBugFixed());
|
|
||||||
Assert.IsTrue(behaviourContext.IsSplitterSupported());
|
|
||||||
Assert.IsTrue(behaviourContext.IsLongSizePreDelaySupported());
|
|
||||||
Assert.IsTrue(behaviourContext.IsAudioUsbDeviceOutputSupported());
|
|
||||||
Assert.IsTrue(behaviourContext.IsFlushVoiceWaveBuffersSupported());
|
|
||||||
Assert.IsTrue(behaviourContext.IsSplitterBugFixed());
|
|
||||||
Assert.IsTrue(behaviourContext.IsElapsedFrameCountSupported());
|
|
||||||
Assert.IsTrue(behaviourContext.IsDecodingBehaviourFlagSupported());
|
|
||||||
Assert.IsTrue(behaviourContext.IsBiquadFilterEffectStateClearBugFixed());
|
|
||||||
Assert.IsTrue(behaviourContext.IsMixInParameterDirtyOnlyUpdateSupported());
|
|
||||||
Assert.IsTrue(behaviourContext.IsWaveBufferVersion2Supported());
|
|
||||||
Assert.IsFalse(behaviourContext.IsEffectInfoVersion2Supported());
|
|
||||||
Assert.IsFalse(behaviourContext.UseMultiTapBiquadFilterProcessing());
|
|
||||||
Assert.IsFalse(behaviourContext.IsNewEffectChannelMappingSupported());
|
|
||||||
Assert.IsFalse(behaviourContext.IsBiquadFilterParameterForSplitterEnabled());
|
|
||||||
Assert.IsFalse(behaviourContext.IsSplitterPrevVolumeResetSupported());
|
|
||||||
|
|
||||||
Assert.AreEqual(0.80f, behaviourContext.GetAudioRendererProcessingTimeLimit());
|
|
||||||
Assert.AreEqual(3, behaviourContext.GetCommandProcessingTimeEstimatorVersion());
|
|
||||||
Assert.AreEqual(2, behaviourContext.GetPerformanceMetricsDataFormat());
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void TestRevision9()
|
|
||||||
{
|
|
||||||
BehaviourContext behaviourContext = new();
|
|
||||||
|
|
||||||
behaviourContext.SetUserRevision(BehaviourContext.BaseRevisionMagic + BehaviourContext.Revision9);
|
|
||||||
|
|
||||||
Assert.IsTrue(behaviourContext.IsAdpcmLoopContextBugFixed());
|
|
||||||
Assert.IsTrue(behaviourContext.IsSplitterSupported());
|
|
||||||
Assert.IsTrue(behaviourContext.IsLongSizePreDelaySupported());
|
|
||||||
Assert.IsTrue(behaviourContext.IsAudioUsbDeviceOutputSupported());
|
|
||||||
Assert.IsTrue(behaviourContext.IsFlushVoiceWaveBuffersSupported());
|
|
||||||
Assert.IsTrue(behaviourContext.IsSplitterBugFixed());
|
|
||||||
Assert.IsTrue(behaviourContext.IsElapsedFrameCountSupported());
|
|
||||||
Assert.IsTrue(behaviourContext.IsDecodingBehaviourFlagSupported());
|
|
||||||
Assert.IsTrue(behaviourContext.IsBiquadFilterEffectStateClearBugFixed());
|
|
||||||
Assert.IsTrue(behaviourContext.IsMixInParameterDirtyOnlyUpdateSupported());
|
|
||||||
Assert.IsTrue(behaviourContext.IsWaveBufferVersion2Supported());
|
|
||||||
Assert.IsTrue(behaviourContext.IsEffectInfoVersion2Supported());
|
|
||||||
Assert.IsFalse(behaviourContext.UseMultiTapBiquadFilterProcessing());
|
|
||||||
Assert.IsFalse(behaviourContext.IsNewEffectChannelMappingSupported());
|
|
||||||
Assert.IsFalse(behaviourContext.IsBiquadFilterParameterForSplitterEnabled());
|
|
||||||
Assert.IsFalse(behaviourContext.IsSplitterPrevVolumeResetSupported());
|
|
||||||
|
|
||||||
Assert.AreEqual(0.80f, behaviourContext.GetAudioRendererProcessingTimeLimit());
|
|
||||||
Assert.AreEqual(3, behaviourContext.GetCommandProcessingTimeEstimatorVersion());
|
|
||||||
Assert.AreEqual(2, behaviourContext.GetPerformanceMetricsDataFormat());
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void TestRevision10()
|
|
||||||
{
|
|
||||||
BehaviourContext behaviourContext = new();
|
|
||||||
|
|
||||||
behaviourContext.SetUserRevision(BehaviourContext.BaseRevisionMagic + BehaviourContext.Revision10);
|
|
||||||
|
|
||||||
Assert.IsTrue(behaviourContext.IsAdpcmLoopContextBugFixed());
|
|
||||||
Assert.IsTrue(behaviourContext.IsSplitterSupported());
|
|
||||||
Assert.IsTrue(behaviourContext.IsLongSizePreDelaySupported());
|
|
||||||
Assert.IsTrue(behaviourContext.IsAudioUsbDeviceOutputSupported());
|
|
||||||
Assert.IsTrue(behaviourContext.IsFlushVoiceWaveBuffersSupported());
|
|
||||||
Assert.IsTrue(behaviourContext.IsSplitterBugFixed());
|
|
||||||
Assert.IsTrue(behaviourContext.IsElapsedFrameCountSupported());
|
|
||||||
Assert.IsTrue(behaviourContext.IsDecodingBehaviourFlagSupported());
|
|
||||||
Assert.IsTrue(behaviourContext.IsBiquadFilterEffectStateClearBugFixed());
|
|
||||||
Assert.IsTrue(behaviourContext.IsMixInParameterDirtyOnlyUpdateSupported());
|
|
||||||
Assert.IsTrue(behaviourContext.IsWaveBufferVersion2Supported());
|
|
||||||
Assert.IsTrue(behaviourContext.IsEffectInfoVersion2Supported());
|
|
||||||
Assert.IsTrue(behaviourContext.UseMultiTapBiquadFilterProcessing());
|
|
||||||
Assert.IsFalse(behaviourContext.IsNewEffectChannelMappingSupported());
|
|
||||||
Assert.IsFalse(behaviourContext.IsBiquadFilterParameterForSplitterEnabled());
|
|
||||||
Assert.IsFalse(behaviourContext.IsSplitterPrevVolumeResetSupported());
|
|
||||||
|
|
||||||
Assert.AreEqual(0.80f, behaviourContext.GetAudioRendererProcessingTimeLimit());
|
|
||||||
Assert.AreEqual(4, behaviourContext.GetCommandProcessingTimeEstimatorVersion());
|
|
||||||
Assert.AreEqual(2, behaviourContext.GetPerformanceMetricsDataFormat());
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void TestRevision11()
|
|
||||||
{
|
|
||||||
BehaviourContext behaviourContext = new();
|
|
||||||
|
|
||||||
behaviourContext.SetUserRevision(BehaviourContext.BaseRevisionMagic + BehaviourContext.Revision11);
|
|
||||||
|
|
||||||
Assert.IsTrue(behaviourContext.IsAdpcmLoopContextBugFixed());
|
|
||||||
Assert.IsTrue(behaviourContext.IsSplitterSupported());
|
|
||||||
Assert.IsTrue(behaviourContext.IsLongSizePreDelaySupported());
|
|
||||||
Assert.IsTrue(behaviourContext.IsAudioUsbDeviceOutputSupported());
|
|
||||||
Assert.IsTrue(behaviourContext.IsFlushVoiceWaveBuffersSupported());
|
|
||||||
Assert.IsTrue(behaviourContext.IsSplitterBugFixed());
|
|
||||||
Assert.IsTrue(behaviourContext.IsElapsedFrameCountSupported());
|
|
||||||
Assert.IsTrue(behaviourContext.IsDecodingBehaviourFlagSupported());
|
|
||||||
Assert.IsTrue(behaviourContext.IsBiquadFilterEffectStateClearBugFixed());
|
|
||||||
Assert.IsTrue(behaviourContext.IsMixInParameterDirtyOnlyUpdateSupported());
|
|
||||||
Assert.IsTrue(behaviourContext.IsWaveBufferVersion2Supported());
|
|
||||||
Assert.IsTrue(behaviourContext.IsEffectInfoVersion2Supported());
|
|
||||||
Assert.IsTrue(behaviourContext.UseMultiTapBiquadFilterProcessing());
|
|
||||||
Assert.IsTrue(behaviourContext.IsNewEffectChannelMappingSupported());
|
|
||||||
Assert.IsFalse(behaviourContext.IsBiquadFilterParameterForSplitterEnabled());
|
|
||||||
Assert.IsFalse(behaviourContext.IsSplitterPrevVolumeResetSupported());
|
|
||||||
|
|
||||||
Assert.AreEqual(0.80f, behaviourContext.GetAudioRendererProcessingTimeLimit());
|
|
||||||
Assert.AreEqual(5, behaviourContext.GetCommandProcessingTimeEstimatorVersion());
|
|
||||||
Assert.AreEqual(2, behaviourContext.GetPerformanceMetricsDataFormat());
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void TestRevision12()
|
|
||||||
{
|
|
||||||
BehaviourContext behaviourContext = new();
|
|
||||||
|
|
||||||
behaviourContext.SetUserRevision(BehaviourContext.BaseRevisionMagic + BehaviourContext.Revision12);
|
|
||||||
|
|
||||||
Assert.IsTrue(behaviourContext.IsAdpcmLoopContextBugFixed());
|
|
||||||
Assert.IsTrue(behaviourContext.IsSplitterSupported());
|
|
||||||
Assert.IsTrue(behaviourContext.IsLongSizePreDelaySupported());
|
|
||||||
Assert.IsTrue(behaviourContext.IsAudioUsbDeviceOutputSupported());
|
|
||||||
Assert.IsTrue(behaviourContext.IsFlushVoiceWaveBuffersSupported());
|
|
||||||
Assert.IsTrue(behaviourContext.IsSplitterBugFixed());
|
|
||||||
Assert.IsTrue(behaviourContext.IsElapsedFrameCountSupported());
|
|
||||||
Assert.IsTrue(behaviourContext.IsDecodingBehaviourFlagSupported());
|
|
||||||
Assert.IsTrue(behaviourContext.IsBiquadFilterEffectStateClearBugFixed());
|
|
||||||
Assert.IsTrue(behaviourContext.IsMixInParameterDirtyOnlyUpdateSupported());
|
|
||||||
Assert.IsTrue(behaviourContext.IsWaveBufferVersion2Supported());
|
|
||||||
Assert.IsTrue(behaviourContext.IsEffectInfoVersion2Supported());
|
|
||||||
Assert.IsTrue(behaviourContext.UseMultiTapBiquadFilterProcessing());
|
|
||||||
Assert.IsTrue(behaviourContext.IsNewEffectChannelMappingSupported());
|
|
||||||
Assert.IsTrue(behaviourContext.IsBiquadFilterParameterForSplitterEnabled());
|
|
||||||
Assert.IsFalse(behaviourContext.IsSplitterPrevVolumeResetSupported());
|
|
||||||
|
|
||||||
Assert.AreEqual(0.80f, behaviourContext.GetAudioRendererProcessingTimeLimit());
|
|
||||||
Assert.AreEqual(5, behaviourContext.GetCommandProcessingTimeEstimatorVersion());
|
|
||||||
Assert.AreEqual(2, behaviourContext.GetPerformanceMetricsDataFormat());
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void TestRevision13()
|
|
||||||
{
|
|
||||||
BehaviourContext behaviourContext = new();
|
|
||||||
|
|
||||||
behaviourContext.SetUserRevision(BehaviourContext.BaseRevisionMagic + BehaviourContext.Revision13);
|
|
||||||
|
|
||||||
Assert.IsTrue(behaviourContext.IsAdpcmLoopContextBugFixed());
|
|
||||||
Assert.IsTrue(behaviourContext.IsSplitterSupported());
|
|
||||||
Assert.IsTrue(behaviourContext.IsLongSizePreDelaySupported());
|
|
||||||
Assert.IsTrue(behaviourContext.IsAudioUsbDeviceOutputSupported());
|
|
||||||
Assert.IsTrue(behaviourContext.IsFlushVoiceWaveBuffersSupported());
|
|
||||||
Assert.IsTrue(behaviourContext.IsSplitterBugFixed());
|
|
||||||
Assert.IsTrue(behaviourContext.IsElapsedFrameCountSupported());
|
|
||||||
Assert.IsTrue(behaviourContext.IsDecodingBehaviourFlagSupported());
|
|
||||||
Assert.IsTrue(behaviourContext.IsBiquadFilterEffectStateClearBugFixed());
|
|
||||||
Assert.IsTrue(behaviourContext.IsMixInParameterDirtyOnlyUpdateSupported());
|
|
||||||
Assert.IsTrue(behaviourContext.IsWaveBufferVersion2Supported());
|
|
||||||
Assert.IsTrue(behaviourContext.IsEffectInfoVersion2Supported());
|
|
||||||
Assert.IsTrue(behaviourContext.UseMultiTapBiquadFilterProcessing());
|
|
||||||
Assert.IsTrue(behaviourContext.IsNewEffectChannelMappingSupported());
|
|
||||||
Assert.IsTrue(behaviourContext.IsBiquadFilterParameterForSplitterEnabled());
|
|
||||||
Assert.IsTrue(behaviourContext.IsSplitterPrevVolumeResetSupported());
|
|
||||||
|
|
||||||
Assert.AreEqual(0.80f, behaviourContext.GetAudioRendererProcessingTimeLimit());
|
|
||||||
Assert.AreEqual(5, behaviourContext.GetCommandProcessingTimeEstimatorVersion());
|
|
||||||
Assert.AreEqual(2, behaviourContext.GetPerformanceMetricsDataFormat());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
413
src/Ryujinx.Tests/Audio/Renderer/Server/BehaviourInfoTests.cs
Normal file
413
src/Ryujinx.Tests/Audio/Renderer/Server/BehaviourInfoTests.cs
Normal file
@@ -0,0 +1,413 @@
|
|||||||
|
using NUnit.Framework;
|
||||||
|
using Ryujinx.Audio.Renderer.Server;
|
||||||
|
|
||||||
|
namespace Ryujinx.Tests.Audio.Renderer.Server
|
||||||
|
{
|
||||||
|
public class BehaviourInfoTests
|
||||||
|
{
|
||||||
|
[Test]
|
||||||
|
public void TestCheckFeature()
|
||||||
|
{
|
||||||
|
int latestRevision = BehaviourInfo.BaseRevisionMagic + BehaviourInfo.LastRevision;
|
||||||
|
int previousRevision = BehaviourInfo.BaseRevisionMagic + (BehaviourInfo.LastRevision - 1);
|
||||||
|
int invalidRevision = BehaviourInfo.BaseRevisionMagic + (BehaviourInfo.LastRevision + 1);
|
||||||
|
|
||||||
|
Assert.IsTrue(BehaviourInfo.CheckFeatureSupported(latestRevision, latestRevision));
|
||||||
|
Assert.IsFalse(BehaviourInfo.CheckFeatureSupported(previousRevision, latestRevision));
|
||||||
|
Assert.IsTrue(BehaviourInfo.CheckFeatureSupported(latestRevision, previousRevision));
|
||||||
|
// In case we get an invalid revision, this is supposed to auto default to REV1 internally.. idk what the hell Nintendo was thinking here..
|
||||||
|
Assert.IsTrue(BehaviourInfo.CheckFeatureSupported(invalidRevision, latestRevision));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestsMemoryPoolForceMappingEnabled()
|
||||||
|
{
|
||||||
|
BehaviourInfo behaviourInfo = new();
|
||||||
|
|
||||||
|
behaviourInfo.SetUserRevision(BehaviourInfo.BaseRevisionMagic + BehaviourInfo.Revision1);
|
||||||
|
|
||||||
|
Assert.IsFalse(behaviourInfo.IsMemoryPoolForceMappingEnabled());
|
||||||
|
|
||||||
|
behaviourInfo.UpdateFlags(0x1);
|
||||||
|
|
||||||
|
Assert.IsTrue(behaviourInfo.IsMemoryPoolForceMappingEnabled());
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestRevision1()
|
||||||
|
{
|
||||||
|
BehaviourInfo behaviourInfo = new();
|
||||||
|
|
||||||
|
behaviourInfo.SetUserRevision(BehaviourInfo.BaseRevisionMagic + BehaviourInfo.Revision1);
|
||||||
|
|
||||||
|
Assert.IsFalse(behaviourInfo.IsAdpcmLoopContextBugFixed());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsSplitterSupported());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsLongSizePreDelaySupported());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsAudioUsbDeviceOutputSupported());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsFlushVoiceWaveBuffersSupported());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsSplitterBugFixed());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsElapsedFrameCountSupported());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsDecodingBehaviourFlagSupported());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsBiquadFilterEffectStateClearBugFixed());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsMixInParameterDirtyOnlyUpdateSupported());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsWaveBufferVersion2Supported());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsEffectInfoVersion2Supported());
|
||||||
|
Assert.IsFalse(behaviourInfo.UseMultiTapBiquadFilterProcessing());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsNewEffectChannelMappingSupported());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsBiquadFilterParameterForSplitterEnabled());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsSplitterPrevVolumeResetSupported());
|
||||||
|
|
||||||
|
Assert.AreEqual(0.70f, behaviourInfo.GetAudioRendererProcessingTimeLimit());
|
||||||
|
Assert.AreEqual(1, behaviourInfo.GetCommandProcessingTimeEstimatorVersion());
|
||||||
|
Assert.AreEqual(1, behaviourInfo.GetPerformanceMetricsDataFormat());
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestRevision2()
|
||||||
|
{
|
||||||
|
BehaviourInfo behaviourInfo = new();
|
||||||
|
|
||||||
|
behaviourInfo.SetUserRevision(BehaviourInfo.BaseRevisionMagic + BehaviourInfo.Revision2);
|
||||||
|
|
||||||
|
Assert.IsTrue(behaviourInfo.IsAdpcmLoopContextBugFixed());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsSplitterSupported());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsLongSizePreDelaySupported());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsAudioUsbDeviceOutputSupported());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsFlushVoiceWaveBuffersSupported());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsSplitterBugFixed());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsElapsedFrameCountSupported());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsDecodingBehaviourFlagSupported());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsBiquadFilterEffectStateClearBugFixed());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsMixInParameterDirtyOnlyUpdateSupported());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsWaveBufferVersion2Supported());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsEffectInfoVersion2Supported());
|
||||||
|
Assert.IsFalse(behaviourInfo.UseMultiTapBiquadFilterProcessing());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsNewEffectChannelMappingSupported());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsBiquadFilterParameterForSplitterEnabled());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsSplitterPrevVolumeResetSupported());
|
||||||
|
|
||||||
|
Assert.AreEqual(0.70f, behaviourInfo.GetAudioRendererProcessingTimeLimit());
|
||||||
|
Assert.AreEqual(1, behaviourInfo.GetCommandProcessingTimeEstimatorVersion());
|
||||||
|
Assert.AreEqual(1, behaviourInfo.GetPerformanceMetricsDataFormat());
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestRevision3()
|
||||||
|
{
|
||||||
|
BehaviourInfo behaviourInfo = new();
|
||||||
|
|
||||||
|
behaviourInfo.SetUserRevision(BehaviourInfo.BaseRevisionMagic + BehaviourInfo.Revision3);
|
||||||
|
|
||||||
|
Assert.IsTrue(behaviourInfo.IsAdpcmLoopContextBugFixed());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsSplitterSupported());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsLongSizePreDelaySupported());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsAudioUsbDeviceOutputSupported());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsFlushVoiceWaveBuffersSupported());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsSplitterBugFixed());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsElapsedFrameCountSupported());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsDecodingBehaviourFlagSupported());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsBiquadFilterEffectStateClearBugFixed());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsMixInParameterDirtyOnlyUpdateSupported());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsWaveBufferVersion2Supported());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsEffectInfoVersion2Supported());
|
||||||
|
Assert.IsFalse(behaviourInfo.UseMultiTapBiquadFilterProcessing());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsNewEffectChannelMappingSupported());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsBiquadFilterParameterForSplitterEnabled());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsSplitterPrevVolumeResetSupported());
|
||||||
|
|
||||||
|
Assert.AreEqual(0.70f, behaviourInfo.GetAudioRendererProcessingTimeLimit());
|
||||||
|
Assert.AreEqual(1, behaviourInfo.GetCommandProcessingTimeEstimatorVersion());
|
||||||
|
Assert.AreEqual(1, behaviourInfo.GetPerformanceMetricsDataFormat());
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestRevision4()
|
||||||
|
{
|
||||||
|
BehaviourInfo behaviourInfo = new();
|
||||||
|
|
||||||
|
behaviourInfo.SetUserRevision(BehaviourInfo.BaseRevisionMagic + BehaviourInfo.Revision4);
|
||||||
|
|
||||||
|
Assert.IsTrue(behaviourInfo.IsAdpcmLoopContextBugFixed());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsSplitterSupported());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsLongSizePreDelaySupported());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsAudioUsbDeviceOutputSupported());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsFlushVoiceWaveBuffersSupported());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsSplitterBugFixed());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsElapsedFrameCountSupported());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsDecodingBehaviourFlagSupported());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsBiquadFilterEffectStateClearBugFixed());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsMixInParameterDirtyOnlyUpdateSupported());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsWaveBufferVersion2Supported());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsEffectInfoVersion2Supported());
|
||||||
|
Assert.IsFalse(behaviourInfo.UseMultiTapBiquadFilterProcessing());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsNewEffectChannelMappingSupported());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsBiquadFilterParameterForSplitterEnabled());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsSplitterPrevVolumeResetSupported());
|
||||||
|
|
||||||
|
Assert.AreEqual(0.75f, behaviourInfo.GetAudioRendererProcessingTimeLimit());
|
||||||
|
Assert.AreEqual(1, behaviourInfo.GetCommandProcessingTimeEstimatorVersion());
|
||||||
|
Assert.AreEqual(1, behaviourInfo.GetPerformanceMetricsDataFormat());
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestRevision5()
|
||||||
|
{
|
||||||
|
BehaviourInfo behaviourInfo = new();
|
||||||
|
|
||||||
|
behaviourInfo.SetUserRevision(BehaviourInfo.BaseRevisionMagic + BehaviourInfo.Revision5);
|
||||||
|
|
||||||
|
Assert.IsTrue(behaviourInfo.IsAdpcmLoopContextBugFixed());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsSplitterSupported());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsLongSizePreDelaySupported());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsAudioUsbDeviceOutputSupported());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsFlushVoiceWaveBuffersSupported());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsSplitterBugFixed());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsElapsedFrameCountSupported());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsDecodingBehaviourFlagSupported());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsBiquadFilterEffectStateClearBugFixed());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsMixInParameterDirtyOnlyUpdateSupported());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsWaveBufferVersion2Supported());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsEffectInfoVersion2Supported());
|
||||||
|
Assert.IsFalse(behaviourInfo.UseMultiTapBiquadFilterProcessing());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsNewEffectChannelMappingSupported());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsBiquadFilterParameterForSplitterEnabled());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsSplitterPrevVolumeResetSupported());
|
||||||
|
|
||||||
|
Assert.AreEqual(0.80f, behaviourInfo.GetAudioRendererProcessingTimeLimit());
|
||||||
|
Assert.AreEqual(2, behaviourInfo.GetCommandProcessingTimeEstimatorVersion());
|
||||||
|
Assert.AreEqual(2, behaviourInfo.GetPerformanceMetricsDataFormat());
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestRevision6()
|
||||||
|
{
|
||||||
|
BehaviourInfo behaviourInfo = new();
|
||||||
|
|
||||||
|
behaviourInfo.SetUserRevision(BehaviourInfo.BaseRevisionMagic + BehaviourInfo.Revision6);
|
||||||
|
|
||||||
|
Assert.IsTrue(behaviourInfo.IsAdpcmLoopContextBugFixed());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsSplitterSupported());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsLongSizePreDelaySupported());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsAudioUsbDeviceOutputSupported());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsFlushVoiceWaveBuffersSupported());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsSplitterBugFixed());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsElapsedFrameCountSupported());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsDecodingBehaviourFlagSupported());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsBiquadFilterEffectStateClearBugFixed());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsMixInParameterDirtyOnlyUpdateSupported());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsWaveBufferVersion2Supported());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsEffectInfoVersion2Supported());
|
||||||
|
Assert.IsFalse(behaviourInfo.UseMultiTapBiquadFilterProcessing());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsNewEffectChannelMappingSupported());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsBiquadFilterParameterForSplitterEnabled());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsSplitterPrevVolumeResetSupported());
|
||||||
|
|
||||||
|
Assert.AreEqual(0.80f, behaviourInfo.GetAudioRendererProcessingTimeLimit());
|
||||||
|
Assert.AreEqual(2, behaviourInfo.GetCommandProcessingTimeEstimatorVersion());
|
||||||
|
Assert.AreEqual(2, behaviourInfo.GetPerformanceMetricsDataFormat());
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestRevision7()
|
||||||
|
{
|
||||||
|
BehaviourInfo behaviourInfo = new();
|
||||||
|
|
||||||
|
behaviourInfo.SetUserRevision(BehaviourInfo.BaseRevisionMagic + BehaviourInfo.Revision7);
|
||||||
|
|
||||||
|
Assert.IsTrue(behaviourInfo.IsAdpcmLoopContextBugFixed());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsSplitterSupported());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsLongSizePreDelaySupported());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsAudioUsbDeviceOutputSupported());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsFlushVoiceWaveBuffersSupported());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsSplitterBugFixed());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsElapsedFrameCountSupported());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsDecodingBehaviourFlagSupported());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsBiquadFilterEffectStateClearBugFixed());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsMixInParameterDirtyOnlyUpdateSupported());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsWaveBufferVersion2Supported());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsEffectInfoVersion2Supported());
|
||||||
|
Assert.IsFalse(behaviourInfo.UseMultiTapBiquadFilterProcessing());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsNewEffectChannelMappingSupported());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsBiquadFilterParameterForSplitterEnabled());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsSplitterPrevVolumeResetSupported());
|
||||||
|
|
||||||
|
Assert.AreEqual(0.80f, behaviourInfo.GetAudioRendererProcessingTimeLimit());
|
||||||
|
Assert.AreEqual(2, behaviourInfo.GetCommandProcessingTimeEstimatorVersion());
|
||||||
|
Assert.AreEqual(2, behaviourInfo.GetPerformanceMetricsDataFormat());
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestRevision8()
|
||||||
|
{
|
||||||
|
BehaviourInfo behaviourInfo = new();
|
||||||
|
|
||||||
|
behaviourInfo.SetUserRevision(BehaviourInfo.BaseRevisionMagic + BehaviourInfo.Revision8);
|
||||||
|
|
||||||
|
Assert.IsTrue(behaviourInfo.IsAdpcmLoopContextBugFixed());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsSplitterSupported());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsLongSizePreDelaySupported());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsAudioUsbDeviceOutputSupported());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsFlushVoiceWaveBuffersSupported());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsSplitterBugFixed());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsElapsedFrameCountSupported());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsDecodingBehaviourFlagSupported());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsBiquadFilterEffectStateClearBugFixed());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsMixInParameterDirtyOnlyUpdateSupported());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsWaveBufferVersion2Supported());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsEffectInfoVersion2Supported());
|
||||||
|
Assert.IsFalse(behaviourInfo.UseMultiTapBiquadFilterProcessing());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsNewEffectChannelMappingSupported());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsBiquadFilterParameterForSplitterEnabled());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsSplitterPrevVolumeResetSupported());
|
||||||
|
|
||||||
|
Assert.AreEqual(0.80f, behaviourInfo.GetAudioRendererProcessingTimeLimit());
|
||||||
|
Assert.AreEqual(3, behaviourInfo.GetCommandProcessingTimeEstimatorVersion());
|
||||||
|
Assert.AreEqual(2, behaviourInfo.GetPerformanceMetricsDataFormat());
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestRevision9()
|
||||||
|
{
|
||||||
|
BehaviourInfo behaviourInfo = new();
|
||||||
|
|
||||||
|
behaviourInfo.SetUserRevision(BehaviourInfo.BaseRevisionMagic + BehaviourInfo.Revision9);
|
||||||
|
|
||||||
|
Assert.IsTrue(behaviourInfo.IsAdpcmLoopContextBugFixed());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsSplitterSupported());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsLongSizePreDelaySupported());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsAudioUsbDeviceOutputSupported());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsFlushVoiceWaveBuffersSupported());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsSplitterBugFixed());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsElapsedFrameCountSupported());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsDecodingBehaviourFlagSupported());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsBiquadFilterEffectStateClearBugFixed());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsMixInParameterDirtyOnlyUpdateSupported());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsWaveBufferVersion2Supported());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsEffectInfoVersion2Supported());
|
||||||
|
Assert.IsFalse(behaviourInfo.UseMultiTapBiquadFilterProcessing());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsNewEffectChannelMappingSupported());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsBiquadFilterParameterForSplitterEnabled());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsSplitterPrevVolumeResetSupported());
|
||||||
|
|
||||||
|
Assert.AreEqual(0.80f, behaviourInfo.GetAudioRendererProcessingTimeLimit());
|
||||||
|
Assert.AreEqual(3, behaviourInfo.GetCommandProcessingTimeEstimatorVersion());
|
||||||
|
Assert.AreEqual(2, behaviourInfo.GetPerformanceMetricsDataFormat());
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestRevision10()
|
||||||
|
{
|
||||||
|
BehaviourInfo behaviourInfo = new();
|
||||||
|
|
||||||
|
behaviourInfo.SetUserRevision(BehaviourInfo.BaseRevisionMagic + BehaviourInfo.Revision10);
|
||||||
|
|
||||||
|
Assert.IsTrue(behaviourInfo.IsAdpcmLoopContextBugFixed());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsSplitterSupported());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsLongSizePreDelaySupported());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsAudioUsbDeviceOutputSupported());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsFlushVoiceWaveBuffersSupported());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsSplitterBugFixed());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsElapsedFrameCountSupported());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsDecodingBehaviourFlagSupported());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsBiquadFilterEffectStateClearBugFixed());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsMixInParameterDirtyOnlyUpdateSupported());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsWaveBufferVersion2Supported());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsEffectInfoVersion2Supported());
|
||||||
|
Assert.IsTrue(behaviourInfo.UseMultiTapBiquadFilterProcessing());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsNewEffectChannelMappingSupported());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsBiquadFilterParameterForSplitterEnabled());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsSplitterPrevVolumeResetSupported());
|
||||||
|
|
||||||
|
Assert.AreEqual(0.80f, behaviourInfo.GetAudioRendererProcessingTimeLimit());
|
||||||
|
Assert.AreEqual(4, behaviourInfo.GetCommandProcessingTimeEstimatorVersion());
|
||||||
|
Assert.AreEqual(2, behaviourInfo.GetPerformanceMetricsDataFormat());
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestRevision11()
|
||||||
|
{
|
||||||
|
BehaviourInfo behaviourInfo = new();
|
||||||
|
|
||||||
|
behaviourInfo.SetUserRevision(BehaviourInfo.BaseRevisionMagic + BehaviourInfo.Revision11);
|
||||||
|
|
||||||
|
Assert.IsTrue(behaviourInfo.IsAdpcmLoopContextBugFixed());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsSplitterSupported());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsLongSizePreDelaySupported());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsAudioUsbDeviceOutputSupported());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsFlushVoiceWaveBuffersSupported());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsSplitterBugFixed());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsElapsedFrameCountSupported());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsDecodingBehaviourFlagSupported());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsBiquadFilterEffectStateClearBugFixed());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsMixInParameterDirtyOnlyUpdateSupported());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsWaveBufferVersion2Supported());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsEffectInfoVersion2Supported());
|
||||||
|
Assert.IsTrue(behaviourInfo.UseMultiTapBiquadFilterProcessing());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsNewEffectChannelMappingSupported());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsBiquadFilterParameterForSplitterEnabled());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsSplitterPrevVolumeResetSupported());
|
||||||
|
|
||||||
|
Assert.AreEqual(0.80f, behaviourInfo.GetAudioRendererProcessingTimeLimit());
|
||||||
|
Assert.AreEqual(5, behaviourInfo.GetCommandProcessingTimeEstimatorVersion());
|
||||||
|
Assert.AreEqual(2, behaviourInfo.GetPerformanceMetricsDataFormat());
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestRevision12()
|
||||||
|
{
|
||||||
|
BehaviourInfo behaviourInfo = new();
|
||||||
|
|
||||||
|
behaviourInfo.SetUserRevision(BehaviourInfo.BaseRevisionMagic + BehaviourInfo.Revision12);
|
||||||
|
|
||||||
|
Assert.IsTrue(behaviourInfo.IsAdpcmLoopContextBugFixed());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsSplitterSupported());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsLongSizePreDelaySupported());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsAudioUsbDeviceOutputSupported());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsFlushVoiceWaveBuffersSupported());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsSplitterBugFixed());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsElapsedFrameCountSupported());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsDecodingBehaviourFlagSupported());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsBiquadFilterEffectStateClearBugFixed());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsMixInParameterDirtyOnlyUpdateSupported());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsWaveBufferVersion2Supported());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsEffectInfoVersion2Supported());
|
||||||
|
Assert.IsTrue(behaviourInfo.UseMultiTapBiquadFilterProcessing());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsNewEffectChannelMappingSupported());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsBiquadFilterParameterForSplitterEnabled());
|
||||||
|
Assert.IsFalse(behaviourInfo.IsSplitterPrevVolumeResetSupported());
|
||||||
|
|
||||||
|
Assert.AreEqual(0.80f, behaviourInfo.GetAudioRendererProcessingTimeLimit());
|
||||||
|
Assert.AreEqual(5, behaviourInfo.GetCommandProcessingTimeEstimatorVersion());
|
||||||
|
Assert.AreEqual(2, behaviourInfo.GetPerformanceMetricsDataFormat());
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestRevision13()
|
||||||
|
{
|
||||||
|
BehaviourInfo behaviourInfo = new();
|
||||||
|
|
||||||
|
behaviourInfo.SetUserRevision(BehaviourInfo.BaseRevisionMagic + BehaviourInfo.Revision13);
|
||||||
|
|
||||||
|
Assert.IsTrue(behaviourInfo.IsAdpcmLoopContextBugFixed());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsSplitterSupported());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsLongSizePreDelaySupported());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsAudioUsbDeviceOutputSupported());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsFlushVoiceWaveBuffersSupported());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsSplitterBugFixed());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsElapsedFrameCountSupported());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsDecodingBehaviourFlagSupported());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsBiquadFilterEffectStateClearBugFixed());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsMixInParameterDirtyOnlyUpdateSupported());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsWaveBufferVersion2Supported());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsEffectInfoVersion2Supported());
|
||||||
|
Assert.IsTrue(behaviourInfo.UseMultiTapBiquadFilterProcessing());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsNewEffectChannelMappingSupported());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsBiquadFilterParameterForSplitterEnabled());
|
||||||
|
Assert.IsTrue(behaviourInfo.IsSplitterPrevVolumeResetSupported());
|
||||||
|
|
||||||
|
Assert.AreEqual(0.80f, behaviourInfo.GetAudioRendererProcessingTimeLimit());
|
||||||
|
Assert.AreEqual(5, behaviourInfo.GetCommandProcessingTimeEstimatorVersion());
|
||||||
|
Assert.AreEqual(2, behaviourInfo.GetPerformanceMetricsDataFormat());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,18 +4,18 @@ using System.Runtime.CompilerServices;
|
|||||||
|
|
||||||
namespace Ryujinx.Tests.Audio.Renderer.Server
|
namespace Ryujinx.Tests.Audio.Renderer.Server
|
||||||
{
|
{
|
||||||
class MemoryPoolStateTests
|
class MemoryPoolInfoTests
|
||||||
{
|
{
|
||||||
[Test]
|
[Test]
|
||||||
public void EnsureTypeSize()
|
public void EnsureTypeSize()
|
||||||
{
|
{
|
||||||
Assert.AreEqual(Unsafe.SizeOf<MemoryPoolState>(), 0x20);
|
Assert.AreEqual(Unsafe.SizeOf<MemoryPoolInfo>(), 0x20);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestContains()
|
public void TestContains()
|
||||||
{
|
{
|
||||||
MemoryPoolState memoryPool = MemoryPoolState.Create(MemoryPoolState.LocationType.Cpu);
|
MemoryPoolInfo memoryPool = MemoryPoolInfo.Create(MemoryPoolInfo.LocationType.Cpu);
|
||||||
|
|
||||||
memoryPool.SetCpuAddress(0x1000000, 0x1000);
|
memoryPool.SetCpuAddress(0x1000000, 0x1000);
|
||||||
|
|
||||||
@@ -32,7 +32,7 @@ namespace Ryujinx.Tests.Audio.Renderer.Server
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestTranslate()
|
public void TestTranslate()
|
||||||
{
|
{
|
||||||
MemoryPoolState memoryPool = MemoryPoolState.Create(MemoryPoolState.LocationType.Cpu);
|
MemoryPoolInfo memoryPool = MemoryPoolInfo.Create(MemoryPoolInfo.LocationType.Cpu);
|
||||||
|
|
||||||
memoryPool.SetCpuAddress(0x1000000, 0x1000);
|
memoryPool.SetCpuAddress(0x1000000, 0x1000);
|
||||||
|
|
||||||
@@ -48,7 +48,7 @@ namespace Ryujinx.Tests.Audio.Renderer.Server
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestIsMapped()
|
public void TestIsMapped()
|
||||||
{
|
{
|
||||||
MemoryPoolState memoryPool = MemoryPoolState.Create(MemoryPoolState.LocationType.Cpu);
|
MemoryPoolInfo memoryPool = MemoryPoolInfo.Create(MemoryPoolInfo.LocationType.Cpu);
|
||||||
|
|
||||||
memoryPool.SetCpuAddress(0x1000000, 0x1000);
|
memoryPool.SetCpuAddress(0x1000000, 0x1000);
|
||||||
|
|
||||||
@@ -4,12 +4,12 @@ using System.Runtime.CompilerServices;
|
|||||||
|
|
||||||
namespace Ryujinx.Tests.Audio.Renderer.Server
|
namespace Ryujinx.Tests.Audio.Renderer.Server
|
||||||
{
|
{
|
||||||
class MixStateTests
|
class MixInfoTests
|
||||||
{
|
{
|
||||||
[Test]
|
[Test]
|
||||||
public void EnsureTypeSize()
|
public void EnsureTypeSize()
|
||||||
{
|
{
|
||||||
Assert.AreEqual(0x940, Unsafe.SizeOf<MixState>());
|
Assert.AreEqual(0x940, Unsafe.SizeOf<MixInfo>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -16,8 +16,8 @@ namespace Ryujinx.Tests.Audio.Renderer.Server
|
|||||||
public void TestInitializeSystemPool()
|
public void TestInitializeSystemPool()
|
||||||
{
|
{
|
||||||
PoolMapper poolMapper = new(DummyProcessHandle, true);
|
PoolMapper poolMapper = new(DummyProcessHandle, true);
|
||||||
MemoryPoolState memoryPoolDsp = MemoryPoolState.Create(MemoryPoolState.LocationType.Dsp);
|
MemoryPoolInfo memoryPoolDsp = MemoryPoolInfo.Create(MemoryPoolInfo.LocationType.Dsp);
|
||||||
MemoryPoolState memoryPoolCpu = MemoryPoolState.Create(MemoryPoolState.LocationType.Cpu);
|
MemoryPoolInfo memoryPoolCpu = MemoryPoolInfo.Create(MemoryPoolInfo.LocationType.Cpu);
|
||||||
|
|
||||||
const CpuAddress CpuAddress = 0x20000;
|
const CpuAddress CpuAddress = 0x20000;
|
||||||
const DspAddress DspAddress = CpuAddress; // TODO: DSP LLE
|
const DspAddress DspAddress = CpuAddress; // TODO: DSP LLE
|
||||||
@@ -35,8 +35,8 @@ namespace Ryujinx.Tests.Audio.Renderer.Server
|
|||||||
public void TestGetProcessHandle()
|
public void TestGetProcessHandle()
|
||||||
{
|
{
|
||||||
PoolMapper poolMapper = new(DummyProcessHandle, true);
|
PoolMapper poolMapper = new(DummyProcessHandle, true);
|
||||||
MemoryPoolState memoryPoolDsp = MemoryPoolState.Create(MemoryPoolState.LocationType.Dsp);
|
MemoryPoolInfo memoryPoolDsp = MemoryPoolInfo.Create(MemoryPoolInfo.LocationType.Dsp);
|
||||||
MemoryPoolState memoryPoolCpu = MemoryPoolState.Create(MemoryPoolState.LocationType.Cpu);
|
MemoryPoolInfo memoryPoolCpu = MemoryPoolInfo.Create(MemoryPoolInfo.LocationType.Cpu);
|
||||||
|
|
||||||
Assert.AreEqual(0xFFFF8001, poolMapper.GetProcessHandle(ref memoryPoolCpu));
|
Assert.AreEqual(0xFFFF8001, poolMapper.GetProcessHandle(ref memoryPoolCpu));
|
||||||
Assert.AreEqual(DummyProcessHandle, poolMapper.GetProcessHandle(ref memoryPoolDsp));
|
Assert.AreEqual(DummyProcessHandle, poolMapper.GetProcessHandle(ref memoryPoolDsp));
|
||||||
@@ -46,8 +46,8 @@ namespace Ryujinx.Tests.Audio.Renderer.Server
|
|||||||
public void TestMappings()
|
public void TestMappings()
|
||||||
{
|
{
|
||||||
PoolMapper poolMapper = new(DummyProcessHandle, true);
|
PoolMapper poolMapper = new(DummyProcessHandle, true);
|
||||||
MemoryPoolState memoryPoolDsp = MemoryPoolState.Create(MemoryPoolState.LocationType.Dsp);
|
MemoryPoolInfo memoryPoolDsp = MemoryPoolInfo.Create(MemoryPoolInfo.LocationType.Dsp);
|
||||||
MemoryPoolState memoryPoolCpu = MemoryPoolState.Create(MemoryPoolState.LocationType.Cpu);
|
MemoryPoolInfo memoryPoolCpu = MemoryPoolInfo.Create(MemoryPoolInfo.LocationType.Cpu);
|
||||||
|
|
||||||
const CpuAddress CpuAddress = 0x20000;
|
const CpuAddress CpuAddress = 0x20000;
|
||||||
const DspAddress DspAddress = CpuAddress; // TODO: DSP LLE
|
const DspAddress DspAddress = CpuAddress; // TODO: DSP LLE
|
||||||
@@ -77,11 +77,11 @@ namespace Ryujinx.Tests.Audio.Renderer.Server
|
|||||||
const int MemoryPoolStateArraySize = 0x10;
|
const int MemoryPoolStateArraySize = 0x10;
|
||||||
const CpuAddress CpuAddressRegionEnding = CpuAddress * MemoryPoolStateArraySize;
|
const CpuAddress CpuAddressRegionEnding = CpuAddress * MemoryPoolStateArraySize;
|
||||||
|
|
||||||
MemoryPoolState[] memoryPoolStateArray = new MemoryPoolState[MemoryPoolStateArraySize];
|
MemoryPoolInfo[] memoryPoolStateArray = new MemoryPoolInfo[MemoryPoolStateArraySize];
|
||||||
|
|
||||||
for (int i = 0; i < memoryPoolStateArray.Length; i++)
|
for (int i = 0; i < memoryPoolStateArray.Length; i++)
|
||||||
{
|
{
|
||||||
memoryPoolStateArray[i] = MemoryPoolState.Create(MemoryPoolState.LocationType.Cpu);
|
memoryPoolStateArray[i] = MemoryPoolInfo.Create(MemoryPoolInfo.LocationType.Cpu);
|
||||||
memoryPoolStateArray[i].SetCpuAddress(CpuAddress + (ulong)i * CpuSize, CpuSize);
|
memoryPoolStateArray[i].SetCpuAddress(CpuAddress + (ulong)i * CpuSize, CpuSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ namespace Ryujinx.Tests.Audio.Renderer.Server
|
|||||||
public void EnsureTypeSize()
|
public void EnsureTypeSize()
|
||||||
{
|
{
|
||||||
Assert.AreEqual(0xE0, Unsafe.SizeOf<SplitterDestinationVersion1>());
|
Assert.AreEqual(0xE0, Unsafe.SizeOf<SplitterDestinationVersion1>());
|
||||||
Assert.AreEqual(0x110, Unsafe.SizeOf<SplitterDestinationVersion2>());
|
Assert.AreEqual(0x128, Unsafe.SizeOf<SplitterDestinationVersion2>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,12 +4,12 @@ using System.Runtime.CompilerServices;
|
|||||||
|
|
||||||
namespace Ryujinx.Tests.Audio.Renderer.Server
|
namespace Ryujinx.Tests.Audio.Renderer.Server
|
||||||
{
|
{
|
||||||
class VoiceStateTests
|
class VoiceInfoTests
|
||||||
{
|
{
|
||||||
[Test]
|
[Test]
|
||||||
public void EnsureTypeSize()
|
public void EnsureTypeSize()
|
||||||
{
|
{
|
||||||
Assert.LessOrEqual(Unsafe.SizeOf<VoiceState>(), 0x220);
|
Assert.LessOrEqual(Unsafe.SizeOf<VoiceInfo>(), 0x238);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -9,7 +9,8 @@ namespace Ryujinx.Tests.Audio.Renderer
|
|||||||
[Test]
|
[Test]
|
||||||
public void EnsureTypeSize()
|
public void EnsureTypeSize()
|
||||||
{
|
{
|
||||||
Assert.AreEqual(0x170, Unsafe.SizeOf<VoiceInParameter>());
|
Assert.AreEqual(0x170, Unsafe.SizeOf<VoiceInParameter1>());
|
||||||
|
Assert.AreEqual(0x188, Unsafe.SizeOf<VoiceInParameter2>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -226,7 +226,7 @@ namespace Ryujinx.Tests.Memory
|
|||||||
|
|
||||||
ref PartialUnmapState state = ref PartialUnmapState.GetRef();
|
ref PartialUnmapState state = ref PartialUnmapState.GetRef();
|
||||||
|
|
||||||
// Create some state to be used for managing the native writing loop.
|
// Create some info to be used for managing the native writing loop.
|
||||||
int stateSize = Unsafe.SizeOf<NativeWriteLoopState>();
|
int stateSize = Unsafe.SizeOf<NativeWriteLoopState>();
|
||||||
IntPtr statePtr = Marshal.AllocHGlobal(stateSize);
|
IntPtr statePtr = Marshal.AllocHGlobal(stateSize);
|
||||||
Unsafe.InitBlockUnaligned((void*)statePtr, 0, (uint)stateSize);
|
Unsafe.InitBlockUnaligned((void*)statePtr, 0, (uint)stateSize);
|
||||||
|
|||||||
Reference in New Issue
Block a user