Move solution and projects to src
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
using NUnit.Framework;
|
||||
using Ryujinx.Audio.Renderer.Parameter;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Ryujinx.Tests.Audio.Renderer
|
||||
{
|
||||
class AudioRendererConfigurationTests
|
||||
{
|
||||
[Test]
|
||||
public void EnsureTypeSize()
|
||||
{
|
||||
Assert.AreEqual(0x34, Unsafe.SizeOf<AudioRendererConfiguration>());
|
||||
}
|
||||
}
|
||||
}
|
||||
16
src/Ryujinx.Tests/Audio/Renderer/BehaviourParameterTests.cs
Normal file
16
src/Ryujinx.Tests/Audio/Renderer/BehaviourParameterTests.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using NUnit.Framework;
|
||||
using Ryujinx.Audio.Renderer.Common;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Ryujinx.Tests.Audio.Renderer
|
||||
{
|
||||
class BehaviourParameterTests
|
||||
{
|
||||
[Test]
|
||||
public void EnsureTypeSize()
|
||||
{
|
||||
Assert.AreEqual(0x10, Unsafe.SizeOf<BehaviourParameter>());
|
||||
Assert.AreEqual(0x10, Unsafe.SizeOf<BehaviourParameter.ErrorInfo>());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using NUnit.Framework;
|
||||
using Ryujinx.Audio.Renderer.Parameter;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Ryujinx.Tests.Audio.Renderer
|
||||
{
|
||||
class BiquadFilterParameterTests
|
||||
{
|
||||
[Test]
|
||||
public void EnsureTypeSize()
|
||||
{
|
||||
Assert.AreEqual(0xC, Unsafe.SizeOf<BiquadFilterParameter>());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using NUnit.Framework;
|
||||
using Ryujinx.Audio.Renderer.Common;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Ryujinx.Tests.Audio.Renderer.Common
|
||||
{
|
||||
class UpdateDataHeaderTests
|
||||
{
|
||||
[Test]
|
||||
public void EnsureTypeSize()
|
||||
{
|
||||
Assert.AreEqual(0x40, Unsafe.SizeOf<UpdateDataHeader>());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using NUnit.Framework;
|
||||
using Ryujinx.Audio.Renderer.Common;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Ryujinx.Tests.Audio.Renderer.Common
|
||||
{
|
||||
class VoiceUpdateStateTests
|
||||
{
|
||||
[Test]
|
||||
public void EnsureTypeSize()
|
||||
{
|
||||
Assert.LessOrEqual(Unsafe.SizeOf<VoiceUpdateState>(), 0x100);
|
||||
}
|
||||
}
|
||||
}
|
||||
15
src/Ryujinx.Tests/Audio/Renderer/Common/WaveBufferTests.cs
Normal file
15
src/Ryujinx.Tests/Audio/Renderer/Common/WaveBufferTests.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using NUnit.Framework;
|
||||
using Ryujinx.Audio.Renderer.Common;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Ryujinx.Tests.Audio.Renderer.Common
|
||||
{
|
||||
class WaveBufferTests
|
||||
{
|
||||
[Test]
|
||||
public void EnsureTypeSize()
|
||||
{
|
||||
Assert.AreEqual(0x30, Unsafe.SizeOf<WaveBuffer>());
|
||||
}
|
||||
}
|
||||
}
|
||||
93
src/Ryujinx.Tests/Audio/Renderer/Dsp/ResamplerTests.cs
Normal file
93
src/Ryujinx.Tests/Audio/Renderer/Dsp/ResamplerTests.cs
Normal file
@@ -0,0 +1,93 @@
|
||||
using NUnit.Framework;
|
||||
using Ryujinx.Audio.Renderer.Dsp;
|
||||
using Ryujinx.Audio.Renderer.Parameter;
|
||||
using Ryujinx.Audio.Renderer.Server.Upsampler;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ryujinx.Tests.Audio.Renderer.Dsp
|
||||
{
|
||||
class ResamplerTests
|
||||
{
|
||||
[Test]
|
||||
[TestCase(VoiceInParameter.SampleRateConversionQuality.Low)]
|
||||
[TestCase(VoiceInParameter.SampleRateConversionQuality.Default)]
|
||||
[TestCase(VoiceInParameter.SampleRateConversionQuality.High)]
|
||||
public void TestResamplerConsistencyUpsampling(VoiceInParameter.SampleRateConversionQuality quality)
|
||||
{
|
||||
DoResamplingTest(44100, 48000, quality);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[TestCase(VoiceInParameter.SampleRateConversionQuality.Low)]
|
||||
[TestCase(VoiceInParameter.SampleRateConversionQuality.Default)]
|
||||
[TestCase(VoiceInParameter.SampleRateConversionQuality.High)]
|
||||
public void TestResamplerConsistencyDownsampling(VoiceInParameter.SampleRateConversionQuality quality)
|
||||
{
|
||||
DoResamplingTest(48000, 44100, quality);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generates a 1-second sine wave sample at input rate, resamples it to output rate, and
|
||||
/// ensures that it resampled at the expected rate with no discontinuities
|
||||
/// </summary>
|
||||
/// <param name="inputRate">The input sample rate to test</param>
|
||||
/// <param name="outputRate">The output sample rate to test</param>
|
||||
/// <param name="quality">The resampler quality to use</param>
|
||||
private static void DoResamplingTest(int inputRate, int outputRate, VoiceInParameter.SampleRateConversionQuality quality)
|
||||
{
|
||||
float inputSampleRate = (float)inputRate;
|
||||
float outputSampleRate = (float)outputRate;
|
||||
int inputSampleCount = inputRate;
|
||||
int outputSampleCount = outputRate;
|
||||
short[] inputBuffer = new short[inputSampleCount + 100]; // add some safety buffer at the end
|
||||
float[] outputBuffer = new float[outputSampleCount + 100];
|
||||
for (int sample = 0; sample < inputBuffer.Length; sample++)
|
||||
{
|
||||
// 440 hz sine wave with amplitude = 0.5f at input sample rate
|
||||
inputBuffer[sample] = (short)(32767 * MathF.Sin((440 / inputSampleRate) * (float)sample * MathF.PI * 2f) * 0.5f);
|
||||
}
|
||||
|
||||
float fraction = 0;
|
||||
|
||||
ResamplerHelper.Resample(
|
||||
outputBuffer.AsSpan(),
|
||||
inputBuffer.AsSpan(),
|
||||
inputSampleRate / outputSampleRate,
|
||||
ref fraction,
|
||||
outputSampleCount,
|
||||
quality,
|
||||
false);
|
||||
|
||||
float[] expectedOutput = new float[outputSampleCount];
|
||||
float sumDifference = 0;
|
||||
int delay = quality switch
|
||||
{
|
||||
VoiceInParameter.SampleRateConversionQuality.High => 3,
|
||||
VoiceInParameter.SampleRateConversionQuality.Default => 1,
|
||||
_ => 0
|
||||
};
|
||||
|
||||
for (int sample = 0; sample < outputSampleCount; sample++)
|
||||
{
|
||||
outputBuffer[sample] /= 32767;
|
||||
// 440 hz sine wave with amplitude = 0.5f at output sample rate
|
||||
expectedOutput[sample] = MathF.Sin((440 / outputSampleRate) * (float)(sample + delay) * MathF.PI * 2f) * 0.5f;
|
||||
float thisDelta = Math.Abs(expectedOutput[sample] - outputBuffer[sample]);
|
||||
|
||||
// Ensure no discontinuities
|
||||
Assert.IsTrue(thisDelta < 0.1f);
|
||||
sumDifference += thisDelta;
|
||||
}
|
||||
|
||||
sumDifference = sumDifference / (float)outputSampleCount;
|
||||
// Expect the output to be 99% similar to the expected resampled sine wave
|
||||
Assert.IsTrue(sumDifference < 0.01f);
|
||||
}
|
||||
}
|
||||
}
|
||||
64
src/Ryujinx.Tests/Audio/Renderer/Dsp/UpsamplerTests.cs
Normal file
64
src/Ryujinx.Tests/Audio/Renderer/Dsp/UpsamplerTests.cs
Normal file
@@ -0,0 +1,64 @@
|
||||
using NUnit.Framework;
|
||||
using Ryujinx.Audio.Renderer.Dsp;
|
||||
using Ryujinx.Audio.Renderer.Parameter;
|
||||
using Ryujinx.Audio.Renderer.Server.Upsampler;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ryujinx.Tests.Audio.Renderer.Dsp
|
||||
{
|
||||
class UpsamplerTests
|
||||
{
|
||||
[Test]
|
||||
public void TestUpsamplerConsistency()
|
||||
{
|
||||
UpsamplerBufferState bufferState = new UpsamplerBufferState();
|
||||
int inputBlockSize = 160;
|
||||
int numInputSamples = 32000;
|
||||
int numOutputSamples = 48000;
|
||||
float inputSampleRate = numInputSamples;
|
||||
float outputSampleRate = numOutputSamples;
|
||||
float[] inputBuffer = new float[numInputSamples + 100];
|
||||
float[] outputBuffer = new float[numOutputSamples + 100];
|
||||
for (int sample = 0; sample < inputBuffer.Length; sample++)
|
||||
{
|
||||
// 440 hz sine wave with amplitude = 0.5f at input sample rate
|
||||
inputBuffer[sample] = MathF.Sin((440 / inputSampleRate) * (float)sample * MathF.PI * 2f) * 0.5f;
|
||||
}
|
||||
|
||||
int inputIdx = 0;
|
||||
int outputIdx = 0;
|
||||
while (inputIdx + inputBlockSize < numInputSamples)
|
||||
{
|
||||
int outputBufLength = (int)Math.Round((float)(inputIdx + inputBlockSize) * outputSampleRate / inputSampleRate) - outputIdx;
|
||||
UpsamplerHelper.Upsample(
|
||||
outputBuffer.AsSpan(outputIdx),
|
||||
inputBuffer.AsSpan(inputIdx),
|
||||
outputBufLength,
|
||||
inputBlockSize,
|
||||
ref bufferState);
|
||||
|
||||
inputIdx += inputBlockSize;
|
||||
outputIdx += outputBufLength;
|
||||
}
|
||||
|
||||
float[] expectedOutput = new float[numOutputSamples];
|
||||
float sumDifference = 0;
|
||||
for (int sample = 0; sample < numOutputSamples; sample++)
|
||||
{
|
||||
// 440 hz sine wave with amplitude = 0.5f at output sample rate with an offset of 15
|
||||
expectedOutput[sample] = MathF.Sin((440 / outputSampleRate) * (float)(sample - 15) * MathF.PI * 2f) * 0.5f;
|
||||
sumDifference += Math.Abs(expectedOutput[sample] - outputBuffer[sample]);
|
||||
}
|
||||
|
||||
sumDifference = sumDifference / (float)expectedOutput.Length;
|
||||
// Expect the output to be 98% similar to the expected resampled sine wave
|
||||
Assert.IsTrue(sumDifference < 0.02f);
|
||||
}
|
||||
}
|
||||
}
|
||||
16
src/Ryujinx.Tests/Audio/Renderer/EffectInfoParameterTests.cs
Normal file
16
src/Ryujinx.Tests/Audio/Renderer/EffectInfoParameterTests.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using NUnit.Framework;
|
||||
using Ryujinx.Audio.Renderer.Parameter;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Ryujinx.Tests.Audio.Renderer
|
||||
{
|
||||
class EffectInfoParameterTests
|
||||
{
|
||||
[Test]
|
||||
public void EnsureTypeSize()
|
||||
{
|
||||
Assert.AreEqual(0xC0, Unsafe.SizeOf<EffectInParameterVersion1>());
|
||||
Assert.AreEqual(0xC0, Unsafe.SizeOf<EffectInParameterVersion2>());
|
||||
}
|
||||
}
|
||||
}
|
||||
16
src/Ryujinx.Tests/Audio/Renderer/EffectOutStatusTests.cs
Normal file
16
src/Ryujinx.Tests/Audio/Renderer/EffectOutStatusTests.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using NUnit.Framework;
|
||||
using Ryujinx.Audio.Renderer.Parameter;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Ryujinx.Tests.Audio.Renderer
|
||||
{
|
||||
class EffectOutStatusTests
|
||||
{
|
||||
[Test]
|
||||
public void EnsureTypeSize()
|
||||
{
|
||||
Assert.AreEqual(0x10, Unsafe.SizeOf<EffectOutStatusVersion1>());
|
||||
Assert.AreEqual(0x90, Unsafe.SizeOf<EffectOutStatusVersion2>());
|
||||
}
|
||||
}
|
||||
}
|
||||
16
src/Ryujinx.Tests/Audio/Renderer/MemoryPoolParameterTests.cs
Normal file
16
src/Ryujinx.Tests/Audio/Renderer/MemoryPoolParameterTests.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using NUnit.Framework;
|
||||
using Ryujinx.Audio.Renderer.Parameter;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Ryujinx.Tests.Audio.Renderer
|
||||
{
|
||||
class MemoryPoolParameterTests
|
||||
{
|
||||
[Test]
|
||||
public void EnsureTypeSize()
|
||||
{
|
||||
Assert.AreEqual(0x20, Unsafe.SizeOf<MemoryPoolInParameter>());
|
||||
Assert.AreEqual(0x10, Unsafe.SizeOf<MemoryPoolOutStatus>());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using NUnit.Framework;
|
||||
using Ryujinx.Audio.Renderer.Parameter;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Ryujinx.Tests.Audio.Renderer.Parameter
|
||||
{
|
||||
class BehaviourErrorInfoOutStatusTests
|
||||
{
|
||||
[Test]
|
||||
public void EnsureTypeSize()
|
||||
{
|
||||
Assert.AreEqual(0xB0, Unsafe.SizeOf<BehaviourErrorInfoOutStatus>());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using NUnit.Framework;
|
||||
using Ryujinx.Audio.Renderer.Parameter.Effect;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Ryujinx.Tests.Audio.Renderer.Parameter.Effect
|
||||
{
|
||||
class AuxParameterTests
|
||||
{
|
||||
[Test]
|
||||
public void EnsureTypeSize()
|
||||
{
|
||||
Assert.AreEqual(0x6C, Unsafe.SizeOf<AuxiliaryBufferParameter>());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using NUnit.Framework;
|
||||
using Ryujinx.Audio.Renderer.Parameter.Effect;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Ryujinx.Tests.Audio.Renderer.Parameter.Effect
|
||||
{
|
||||
class BiquadFilterEffectParameterTests
|
||||
{
|
||||
[Test]
|
||||
public void EnsureTypeSize()
|
||||
{
|
||||
Assert.AreEqual(0x18, Unsafe.SizeOf<BiquadFilterEffectParameter>());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using NUnit.Framework;
|
||||
using Ryujinx.Audio.Renderer.Parameter.Effect;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Ryujinx.Tests.Audio.Renderer.Parameter.Effect
|
||||
{
|
||||
class BufferMixerParameterTests
|
||||
{
|
||||
[Test]
|
||||
public void EnsureTypeSize()
|
||||
{
|
||||
Assert.AreEqual(0x94, Unsafe.SizeOf<BufferMixParameter>());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using NUnit.Framework;
|
||||
using Ryujinx.Audio.Renderer.Parameter.Effect;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Ryujinx.Tests.Audio.Renderer.Parameter.Effect
|
||||
{
|
||||
class CompressorParameterTests
|
||||
{
|
||||
[Test]
|
||||
public void EnsureTypeSize()
|
||||
{
|
||||
Assert.AreEqual(0x38, Unsafe.SizeOf<CompressorParameter>());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
using NUnit.Framework;
|
||||
using Ryujinx.Audio.Renderer.Parameter.Effect;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Ryujinx.Tests.Audio.Renderer.Parameter.Effect
|
||||
{
|
||||
class DelayParameterTests
|
||||
{
|
||||
[Test]
|
||||
public void EnsureTypeSize()
|
||||
{
|
||||
Assert.AreEqual(0x35, Unsafe.SizeOf<DelayParameter>());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using NUnit.Framework;
|
||||
using Ryujinx.Audio.Renderer.Parameter.Effect;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Ryujinx.Tests.Audio.Renderer.Parameter.Effect
|
||||
{
|
||||
class LimiterParameterTests
|
||||
{
|
||||
[Test]
|
||||
public void EnsureTypeSize()
|
||||
{
|
||||
Assert.AreEqual(0x44, Unsafe.SizeOf<LimiterParameter>());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
using NUnit.Framework;
|
||||
using Ryujinx.Audio.Renderer.Parameter.Effect;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Ryujinx.Tests.Audio.Renderer.Parameter.Effect
|
||||
{
|
||||
class LimiterStatisticsTests
|
||||
{
|
||||
[Test]
|
||||
public void EnsureTypeSize()
|
||||
{
|
||||
Assert.AreEqual(0x30, Unsafe.SizeOf<LimiterStatistics>());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
using NUnit.Framework;
|
||||
using Ryujinx.Audio.Renderer.Parameter.Effect;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Ryujinx.Tests.Audio.Renderer.Parameter.Effect
|
||||
{
|
||||
class Reverb3dParameterTests
|
||||
{
|
||||
[Test]
|
||||
public void EnsureTypeSize()
|
||||
{
|
||||
Assert.AreEqual(0x49, Unsafe.SizeOf<Reverb3dParameter>());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using NUnit.Framework;
|
||||
using Ryujinx.Audio.Renderer.Parameter.Effect;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Ryujinx.Tests.Audio.Renderer.Parameter.Effect
|
||||
{
|
||||
class ReverbParameterTests
|
||||
{
|
||||
[Test]
|
||||
public void EnsureTypeSize()
|
||||
{
|
||||
Assert.AreEqual(0x41, Unsafe.SizeOf<ReverbParameter>());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using NUnit.Framework;
|
||||
using Ryujinx.Audio.Renderer.Parameter;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Ryujinx.Tests.Audio.Renderer.Parameter
|
||||
{
|
||||
class MixInParameterDirtyOnlyUpdateTests
|
||||
{
|
||||
[Test]
|
||||
public void EnsureTypeSize()
|
||||
{
|
||||
Assert.AreEqual(0x20, Unsafe.SizeOf<MixInParameterDirtyOnlyUpdate>());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using NUnit.Framework;
|
||||
using Ryujinx.Audio.Renderer.Parameter;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Ryujinx.Tests.Audio.Renderer.Parameter
|
||||
{
|
||||
class MixParameterTests
|
||||
{
|
||||
[Test]
|
||||
public void EnsureTypeSize()
|
||||
{
|
||||
Assert.AreEqual(0x930, Unsafe.SizeOf<MixParameter>());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using NUnit.Framework;
|
||||
using Ryujinx.Audio.Renderer.Parameter.Performance;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Ryujinx.Tests.Audio.Renderer.Parameter
|
||||
{
|
||||
class PerformanceInParameterTests
|
||||
{
|
||||
[Test]
|
||||
public void EnsureTypeSize()
|
||||
{
|
||||
Assert.AreEqual(0x10, Unsafe.SizeOf<PerformanceInParameter>());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using NUnit.Framework;
|
||||
using Ryujinx.Audio.Renderer.Parameter.Performance;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Ryujinx.Tests.Audio.Renderer.Parameter
|
||||
{
|
||||
class PerformanceOutStatusTests
|
||||
{
|
||||
[Test]
|
||||
public void EnsureTypeSize()
|
||||
{
|
||||
Assert.AreEqual(0x10, Unsafe.SizeOf<PerformanceOutStatus>());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using NUnit.Framework;
|
||||
using Ryujinx.Audio.Renderer.Parameter;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Ryujinx.Tests.Audio.Renderer.Parameter
|
||||
{
|
||||
class RendererInfoOutStatusTests
|
||||
{
|
||||
[Test]
|
||||
public void EnsureTypeSize()
|
||||
{
|
||||
Assert.AreEqual(0x10, Unsafe.SizeOf<RendererInfoOutStatus>());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using NUnit.Framework;
|
||||
using Ryujinx.Audio.Renderer.Parameter.Sink;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Ryujinx.Tests.Audio.Renderer.Parameter.Sink
|
||||
{
|
||||
class CircularBufferParameterTests
|
||||
{
|
||||
[Test]
|
||||
public void EnsureTypeSize()
|
||||
{
|
||||
Assert.AreEqual(0x24, Unsafe.SizeOf<CircularBufferParameter>());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using NUnit.Framework;
|
||||
using Ryujinx.Audio.Renderer.Parameter.Sink;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Ryujinx.Tests.Audio.Renderer.Parameter.Sink
|
||||
{
|
||||
class DeviceParameterTests
|
||||
{
|
||||
[Test]
|
||||
public void EnsureTypeSize()
|
||||
{
|
||||
Assert.AreEqual(0x11C, Unsafe.SizeOf<DeviceParameter>());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using NUnit.Framework;
|
||||
using Ryujinx.Audio.Renderer.Parameter;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Ryujinx.Tests.Audio.Renderer.Parameter
|
||||
{
|
||||
class SinkInParameterTests
|
||||
{
|
||||
[Test]
|
||||
public void EnsureTypeSize()
|
||||
{
|
||||
Assert.AreEqual(0x140, Unsafe.SizeOf<SinkInParameter>());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using NUnit.Framework;
|
||||
using Ryujinx.Audio.Renderer.Parameter;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Ryujinx.Tests.Audio.Renderer.Parameter
|
||||
{
|
||||
class SinkOutStatusTests
|
||||
{
|
||||
[Test]
|
||||
public void EnsureTypeSize()
|
||||
{
|
||||
Assert.AreEqual(0x20, Unsafe.SizeOf<SinkOutStatus>());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using NUnit.Framework;
|
||||
using Ryujinx.Audio.Renderer.Parameter;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Ryujinx.Tests.Audio.Renderer.Parameter
|
||||
{
|
||||
class SplitterInParamHeaderTests
|
||||
{
|
||||
[Test]
|
||||
public void EnsureTypeSize()
|
||||
{
|
||||
Assert.AreEqual(0x20, Unsafe.SizeOf<SplitterInParameterHeader>());
|
||||
}
|
||||
}
|
||||
}
|
||||
35
src/Ryujinx.Tests/Audio/Renderer/Server/AddressInfoTests.cs
Normal file
35
src/Ryujinx.Tests/Audio/Renderer/Server/AddressInfoTests.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using NUnit.Framework;
|
||||
using Ryujinx.Audio.Renderer.Server.MemoryPool;
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Ryujinx.Tests.Audio.Renderer.Server
|
||||
{
|
||||
class AddressInfoTests
|
||||
{
|
||||
[Test]
|
||||
public void EnsureTypeSize()
|
||||
{
|
||||
Assert.AreEqual(0x20, Unsafe.SizeOf<AddressInfo>());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetReference()
|
||||
{
|
||||
MemoryPoolState[] memoryPoolState = new MemoryPoolState[1];
|
||||
memoryPoolState[0] = MemoryPoolState.Create(MemoryPoolState.LocationType.Cpu);
|
||||
memoryPoolState[0].SetCpuAddress(0x1000000, 0x10000);
|
||||
memoryPoolState[0].DspAddress = 0x4000000;
|
||||
|
||||
AddressInfo addressInfo = AddressInfo.Create(0x1000000, 0x1000);
|
||||
|
||||
addressInfo.ForceMappedDspAddress = 0x2000000;
|
||||
|
||||
Assert.AreEqual(0x2000000, addressInfo.GetReference(true));
|
||||
|
||||
addressInfo.SetupMemoryPool(memoryPoolState.AsSpan());
|
||||
|
||||
Assert.AreEqual(0x4000000, addressInfo.GetReference(true));
|
||||
}
|
||||
}
|
||||
}
|
||||
296
src/Ryujinx.Tests/Audio/Renderer/Server/BehaviourContextTests.cs
Normal file
296
src/Ryujinx.Tests/Audio/Renderer/Server/BehaviourContextTests.cs
Normal file
@@ -0,0 +1,296 @@
|
||||
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();
|
||||
|
||||
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();
|
||||
|
||||
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.IsBiquadFilterGroupedOptimizationSupported());
|
||||
|
||||
Assert.AreEqual(0.70f, behaviourContext.GetAudioRendererProcessingTimeLimit());
|
||||
Assert.AreEqual(1, behaviourContext.GetCommandProcessingTimeEstimatorVersion());
|
||||
Assert.AreEqual(1, behaviourContext.GetPerformanceMetricsDataFormat());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRevision2()
|
||||
{
|
||||
BehaviourContext behaviourContext = new BehaviourContext();
|
||||
|
||||
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.IsBiquadFilterGroupedOptimizationSupported());
|
||||
|
||||
Assert.AreEqual(0.70f, behaviourContext.GetAudioRendererProcessingTimeLimit());
|
||||
Assert.AreEqual(1, behaviourContext.GetCommandProcessingTimeEstimatorVersion());
|
||||
Assert.AreEqual(1, behaviourContext.GetPerformanceMetricsDataFormat());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRevision3()
|
||||
{
|
||||
BehaviourContext behaviourContext = new BehaviourContext();
|
||||
|
||||
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.IsBiquadFilterGroupedOptimizationSupported());
|
||||
|
||||
Assert.AreEqual(0.70f, behaviourContext.GetAudioRendererProcessingTimeLimit());
|
||||
Assert.AreEqual(1, behaviourContext.GetCommandProcessingTimeEstimatorVersion());
|
||||
Assert.AreEqual(1, behaviourContext.GetPerformanceMetricsDataFormat());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRevision4()
|
||||
{
|
||||
BehaviourContext behaviourContext = new BehaviourContext();
|
||||
|
||||
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.IsBiquadFilterGroupedOptimizationSupported());
|
||||
|
||||
Assert.AreEqual(0.75f, behaviourContext.GetAudioRendererProcessingTimeLimit());
|
||||
Assert.AreEqual(1, behaviourContext.GetCommandProcessingTimeEstimatorVersion());
|
||||
Assert.AreEqual(1, behaviourContext.GetPerformanceMetricsDataFormat());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRevision5()
|
||||
{
|
||||
BehaviourContext behaviourContext = new BehaviourContext();
|
||||
|
||||
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.IsBiquadFilterGroupedOptimizationSupported());
|
||||
|
||||
Assert.AreEqual(0.80f, behaviourContext.GetAudioRendererProcessingTimeLimit());
|
||||
Assert.AreEqual(2, behaviourContext.GetCommandProcessingTimeEstimatorVersion());
|
||||
Assert.AreEqual(2, behaviourContext.GetPerformanceMetricsDataFormat());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRevision6()
|
||||
{
|
||||
BehaviourContext behaviourContext = new BehaviourContext();
|
||||
|
||||
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.IsBiquadFilterGroupedOptimizationSupported());
|
||||
|
||||
Assert.AreEqual(0.80f, behaviourContext.GetAudioRendererProcessingTimeLimit());
|
||||
Assert.AreEqual(2, behaviourContext.GetCommandProcessingTimeEstimatorVersion());
|
||||
Assert.AreEqual(2, behaviourContext.GetPerformanceMetricsDataFormat());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRevision7()
|
||||
{
|
||||
BehaviourContext behaviourContext = new BehaviourContext();
|
||||
|
||||
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.IsBiquadFilterGroupedOptimizationSupported());
|
||||
|
||||
Assert.AreEqual(0.80f, behaviourContext.GetAudioRendererProcessingTimeLimit());
|
||||
Assert.AreEqual(2, behaviourContext.GetCommandProcessingTimeEstimatorVersion());
|
||||
Assert.AreEqual(2, behaviourContext.GetPerformanceMetricsDataFormat());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRevision8()
|
||||
{
|
||||
BehaviourContext behaviourContext = new BehaviourContext();
|
||||
|
||||
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.IsBiquadFilterGroupedOptimizationSupported());
|
||||
|
||||
Assert.AreEqual(0.80f, behaviourContext.GetAudioRendererProcessingTimeLimit());
|
||||
Assert.AreEqual(3, behaviourContext.GetCommandProcessingTimeEstimatorVersion());
|
||||
Assert.AreEqual(2, behaviourContext.GetPerformanceMetricsDataFormat());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRevision9()
|
||||
{
|
||||
BehaviourContext behaviourContext = new BehaviourContext();
|
||||
|
||||
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.IsBiquadFilterGroupedOptimizationSupported());
|
||||
|
||||
Assert.AreEqual(0.80f, behaviourContext.GetAudioRendererProcessingTimeLimit());
|
||||
Assert.AreEqual(3, behaviourContext.GetCommandProcessingTimeEstimatorVersion());
|
||||
Assert.AreEqual(2, behaviourContext.GetPerformanceMetricsDataFormat());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRevision10()
|
||||
{
|
||||
BehaviourContext behaviourContext = new BehaviourContext();
|
||||
|
||||
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.IsBiquadFilterGroupedOptimizationSupported());
|
||||
|
||||
Assert.AreEqual(0.80f, behaviourContext.GetAudioRendererProcessingTimeLimit());
|
||||
Assert.AreEqual(4, behaviourContext.GetCommandProcessingTimeEstimatorVersion());
|
||||
Assert.AreEqual(2, behaviourContext.GetPerformanceMetricsDataFormat());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
using NUnit.Framework;
|
||||
using Ryujinx.Audio.Renderer.Server.MemoryPool;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Ryujinx.Tests.Audio.Renderer.Server
|
||||
{
|
||||
class MemoryPoolStateTests
|
||||
{
|
||||
[Test]
|
||||
public void EnsureTypeSize()
|
||||
{
|
||||
Assert.AreEqual(Unsafe.SizeOf<MemoryPoolState>(), 0x20);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestContains()
|
||||
{
|
||||
MemoryPoolState memoryPool = MemoryPoolState.Create(MemoryPoolState.LocationType.Cpu);
|
||||
|
||||
memoryPool.SetCpuAddress(0x1000000, 0x1000);
|
||||
|
||||
memoryPool.DspAddress = 0x2000000;
|
||||
|
||||
Assert.IsTrue(memoryPool.Contains(0x1000000, 0x10));
|
||||
Assert.IsTrue(memoryPool.Contains(0x1000FE0, 0x10));
|
||||
Assert.IsTrue(memoryPool.Contains(0x1000FFF, 0x1));
|
||||
Assert.IsFalse(memoryPool.Contains(0x1000FFF, 0x2));
|
||||
Assert.IsFalse(memoryPool.Contains(0x1001000, 0x10));
|
||||
Assert.IsFalse(memoryPool.Contains(0x2000000, 0x10));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestTranslate()
|
||||
{
|
||||
MemoryPoolState memoryPool = MemoryPoolState.Create(MemoryPoolState.LocationType.Cpu);
|
||||
|
||||
memoryPool.SetCpuAddress(0x1000000, 0x1000);
|
||||
|
||||
memoryPool.DspAddress = 0x2000000;
|
||||
|
||||
Assert.AreEqual(0x2000FE0, memoryPool.Translate(0x1000FE0, 0x10));
|
||||
Assert.AreEqual(0x2000FFF, memoryPool.Translate(0x1000FFF, 0x1));
|
||||
Assert.AreEqual(0x0, memoryPool.Translate(0x1000FFF, 0x2));
|
||||
Assert.AreEqual(0x0, memoryPool.Translate(0x1001000, 0x10));
|
||||
Assert.AreEqual(0x0, memoryPool.Translate(0x2000000, 0x10));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestIsMapped()
|
||||
{
|
||||
MemoryPoolState memoryPool = MemoryPoolState.Create(MemoryPoolState.LocationType.Cpu);
|
||||
|
||||
memoryPool.SetCpuAddress(0x1000000, 0x1000);
|
||||
|
||||
Assert.IsFalse(memoryPool.IsMapped());
|
||||
|
||||
memoryPool.DspAddress = 0x2000000;
|
||||
|
||||
Assert.IsTrue(memoryPool.IsMapped());
|
||||
}
|
||||
}
|
||||
}
|
||||
15
src/Ryujinx.Tests/Audio/Renderer/Server/MixStateTests.cs
Normal file
15
src/Ryujinx.Tests/Audio/Renderer/Server/MixStateTests.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using NUnit.Framework;
|
||||
using Ryujinx.Audio.Renderer.Server.Mix;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Ryujinx.Tests.Audio.Renderer.Server
|
||||
{
|
||||
class MixStateTests
|
||||
{
|
||||
[Test]
|
||||
public void EnsureTypeSize()
|
||||
{
|
||||
Assert.AreEqual(0x940, Unsafe.SizeOf<MixState>());
|
||||
}
|
||||
}
|
||||
}
|
||||
135
src/Ryujinx.Tests/Audio/Renderer/Server/PoolMapperTests.cs
Normal file
135
src/Ryujinx.Tests/Audio/Renderer/Server/PoolMapperTests.cs
Normal file
@@ -0,0 +1,135 @@
|
||||
using NUnit.Framework;
|
||||
using Ryujinx.Audio;
|
||||
using Ryujinx.Audio.Renderer.Server.MemoryPool;
|
||||
using System;
|
||||
using static Ryujinx.Audio.Renderer.Common.BehaviourParameter;
|
||||
using CpuAddress = System.UInt64;
|
||||
using DspAddress = System.UInt64;
|
||||
|
||||
namespace Ryujinx.Tests.Audio.Renderer.Server
|
||||
{
|
||||
class PoolMapperTests
|
||||
{
|
||||
private const uint DummyProcessHandle = 0xCAFEBABE;
|
||||
|
||||
[Test]
|
||||
public void TestInitializeSystemPool()
|
||||
{
|
||||
PoolMapper poolMapper = new PoolMapper(DummyProcessHandle, true);
|
||||
MemoryPoolState memoryPoolDsp = MemoryPoolState.Create(MemoryPoolState.LocationType.Dsp);
|
||||
MemoryPoolState memoryPoolCpu = MemoryPoolState.Create(MemoryPoolState.LocationType.Cpu);
|
||||
|
||||
const CpuAddress CpuAddress = 0x20000;
|
||||
const DspAddress DspAddress = CpuAddress; // TODO: DSP LLE
|
||||
const ulong CpuSize = 0x1000;
|
||||
|
||||
Assert.IsFalse(poolMapper.InitializeSystemPool(ref memoryPoolCpu, CpuAddress, CpuSize));
|
||||
Assert.IsTrue(poolMapper.InitializeSystemPool(ref memoryPoolDsp, CpuAddress, CpuSize));
|
||||
|
||||
Assert.AreEqual(CpuAddress, memoryPoolDsp.CpuAddress);
|
||||
Assert.AreEqual(CpuSize, memoryPoolDsp.Size);
|
||||
Assert.AreEqual(DspAddress, memoryPoolDsp.DspAddress);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetProcessHandle()
|
||||
{
|
||||
PoolMapper poolMapper = new PoolMapper(DummyProcessHandle, true);
|
||||
MemoryPoolState memoryPoolDsp = MemoryPoolState.Create(MemoryPoolState.LocationType.Dsp);
|
||||
MemoryPoolState memoryPoolCpu = MemoryPoolState.Create(MemoryPoolState.LocationType.Cpu);
|
||||
|
||||
Assert.AreEqual(0xFFFF8001, poolMapper.GetProcessHandle(ref memoryPoolCpu));
|
||||
Assert.AreEqual(DummyProcessHandle, poolMapper.GetProcessHandle(ref memoryPoolDsp));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestMappings()
|
||||
{
|
||||
PoolMapper poolMapper = new PoolMapper(DummyProcessHandle, true);
|
||||
MemoryPoolState memoryPoolDsp = MemoryPoolState.Create(MemoryPoolState.LocationType.Dsp);
|
||||
MemoryPoolState memoryPoolCpu = MemoryPoolState.Create(MemoryPoolState.LocationType.Cpu);
|
||||
|
||||
const CpuAddress CpuAddress = 0x20000;
|
||||
const DspAddress DspAddress = CpuAddress; // TODO: DSP LLE
|
||||
const ulong CpuSize = 0x1000;
|
||||
|
||||
memoryPoolDsp.SetCpuAddress(CpuAddress, CpuSize);
|
||||
memoryPoolCpu.SetCpuAddress(CpuAddress, CpuSize);
|
||||
|
||||
Assert.AreEqual(DspAddress, poolMapper.Map(ref memoryPoolCpu));
|
||||
Assert.AreEqual(DspAddress, poolMapper.Map(ref memoryPoolDsp));
|
||||
Assert.AreEqual(DspAddress, memoryPoolDsp.DspAddress);
|
||||
Assert.IsTrue(poolMapper.Unmap(ref memoryPoolCpu));
|
||||
|
||||
memoryPoolDsp.IsUsed = true;
|
||||
Assert.IsFalse(poolMapper.Unmap(ref memoryPoolDsp));
|
||||
memoryPoolDsp.IsUsed = false;
|
||||
Assert.IsTrue(poolMapper.Unmap(ref memoryPoolDsp));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestTryAttachBuffer()
|
||||
{
|
||||
const CpuAddress CpuAddress = 0x20000;
|
||||
const DspAddress DspAddress = CpuAddress; // TODO: DSP LLE
|
||||
const ulong CpuSize = 0x1000;
|
||||
|
||||
const int MemoryPoolStateArraySize = 0x10;
|
||||
const CpuAddress CpuAddressRegionEnding = CpuAddress * MemoryPoolStateArraySize;
|
||||
|
||||
MemoryPoolState[] memoryPoolStateArray = new MemoryPoolState[MemoryPoolStateArraySize];
|
||||
|
||||
for (int i = 0; i < memoryPoolStateArray.Length; i++)
|
||||
{
|
||||
memoryPoolStateArray[i] = MemoryPoolState.Create(MemoryPoolState.LocationType.Cpu);
|
||||
memoryPoolStateArray[i].SetCpuAddress(CpuAddress + (ulong)i * CpuSize, CpuSize);
|
||||
}
|
||||
|
||||
ErrorInfo errorInfo;
|
||||
|
||||
AddressInfo addressInfo = AddressInfo.Create();
|
||||
|
||||
PoolMapper poolMapper = new PoolMapper(DummyProcessHandle, true);
|
||||
|
||||
Assert.IsTrue(poolMapper.TryAttachBuffer(out errorInfo, ref addressInfo, 0, 0));
|
||||
|
||||
Assert.AreEqual(ResultCode.InvalidAddressInfo, errorInfo.ErrorCode);
|
||||
Assert.AreEqual(0, errorInfo.ExtraErrorInfo);
|
||||
Assert.AreEqual(0, addressInfo.ForceMappedDspAddress);
|
||||
|
||||
Assert.IsTrue(poolMapper.TryAttachBuffer(out errorInfo, ref addressInfo, CpuAddress, CpuSize));
|
||||
|
||||
Assert.AreEqual(ResultCode.InvalidAddressInfo, errorInfo.ErrorCode);
|
||||
Assert.AreEqual(CpuAddress, errorInfo.ExtraErrorInfo);
|
||||
Assert.AreEqual(DspAddress, addressInfo.ForceMappedDspAddress);
|
||||
|
||||
poolMapper = new PoolMapper(DummyProcessHandle, false);
|
||||
|
||||
Assert.IsFalse(poolMapper.TryAttachBuffer(out errorInfo, ref addressInfo, 0, 0));
|
||||
|
||||
addressInfo.ForceMappedDspAddress = 0;
|
||||
|
||||
Assert.IsFalse(poolMapper.TryAttachBuffer(out errorInfo, ref addressInfo, CpuAddress, CpuSize));
|
||||
|
||||
Assert.AreEqual(ResultCode.InvalidAddressInfo, errorInfo.ErrorCode);
|
||||
Assert.AreEqual(CpuAddress, errorInfo.ExtraErrorInfo);
|
||||
Assert.AreEqual(0, addressInfo.ForceMappedDspAddress);
|
||||
|
||||
poolMapper = new PoolMapper(DummyProcessHandle, memoryPoolStateArray.AsMemory(), false);
|
||||
|
||||
Assert.IsFalse(poolMapper.TryAttachBuffer(out errorInfo, ref addressInfo, CpuAddressRegionEnding, CpuSize));
|
||||
|
||||
Assert.AreEqual(ResultCode.InvalidAddressInfo, errorInfo.ErrorCode);
|
||||
Assert.AreEqual(CpuAddressRegionEnding, errorInfo.ExtraErrorInfo);
|
||||
Assert.AreEqual(0, addressInfo.ForceMappedDspAddress);
|
||||
Assert.IsFalse(addressInfo.HasMemoryPoolState);
|
||||
|
||||
Assert.IsTrue(poolMapper.TryAttachBuffer(out errorInfo, ref addressInfo, CpuAddress, CpuSize));
|
||||
|
||||
Assert.AreEqual(ResultCode.Success, errorInfo.ErrorCode);
|
||||
Assert.AreEqual(0, errorInfo.ExtraErrorInfo);
|
||||
Assert.AreEqual(0, addressInfo.ForceMappedDspAddress);
|
||||
Assert.IsTrue(addressInfo.HasMemoryPoolState);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using NUnit.Framework;
|
||||
using Ryujinx.Audio.Renderer.Server.Splitter;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Ryujinx.Tests.Audio.Renderer.Server
|
||||
{
|
||||
class SplitterDestinationTests
|
||||
{
|
||||
[Test]
|
||||
public void EnsureTypeSize()
|
||||
{
|
||||
Assert.AreEqual(0xE0, Unsafe.SizeOf<SplitterDestination>());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using NUnit.Framework;
|
||||
using Ryujinx.Audio.Renderer.Server.Splitter;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Ryujinx.Tests.Audio.Renderer.Server
|
||||
{
|
||||
class SplitterStateTests
|
||||
{
|
||||
[Test]
|
||||
public void EnsureTypeSize()
|
||||
{
|
||||
Assert.AreEqual(0x20, Unsafe.SizeOf<SplitterState>());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using NUnit.Framework;
|
||||
using Ryujinx.Audio.Renderer.Server.Voice;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Ryujinx.Tests.Audio.Renderer.Server
|
||||
{
|
||||
class VoiceChannelResourceTests
|
||||
{
|
||||
[Test]
|
||||
public void EnsureTypeSize()
|
||||
{
|
||||
Assert.AreEqual(0xD0, Unsafe.SizeOf<VoiceChannelResource>());
|
||||
}
|
||||
}
|
||||
}
|
||||
15
src/Ryujinx.Tests/Audio/Renderer/Server/VoiceStateTests.cs
Normal file
15
src/Ryujinx.Tests/Audio/Renderer/Server/VoiceStateTests.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using NUnit.Framework;
|
||||
using Ryujinx.Audio.Renderer.Server.Voice;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Ryujinx.Tests.Audio.Renderer.Server
|
||||
{
|
||||
class VoiceStateTests
|
||||
{
|
||||
[Test]
|
||||
public void EnsureTypeSize()
|
||||
{
|
||||
Assert.LessOrEqual(Unsafe.SizeOf<VoiceState>(), 0x220);
|
||||
}
|
||||
}
|
||||
}
|
||||
15
src/Ryujinx.Tests/Audio/Renderer/Server/WaveBufferTests.cs
Normal file
15
src/Ryujinx.Tests/Audio/Renderer/Server/WaveBufferTests.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using NUnit.Framework;
|
||||
using Ryujinx.Audio.Renderer.Server.Voice;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Ryujinx.Tests.Audio.Renderer.Server
|
||||
{
|
||||
class WaveBufferTests
|
||||
{
|
||||
[Test]
|
||||
public void EnsureTypeSize()
|
||||
{
|
||||
Assert.AreEqual(0x58, Unsafe.SizeOf<WaveBuffer>());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using NUnit.Framework;
|
||||
using Ryujinx.Audio.Renderer.Parameter;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Ryujinx.Tests.Audio.Renderer
|
||||
{
|
||||
class VoiceChannelResourceInParameterTests
|
||||
{
|
||||
[Test]
|
||||
public void EnsureTypeSize()
|
||||
{
|
||||
Assert.AreEqual(0x70, Unsafe.SizeOf<VoiceChannelResourceInParameter>());
|
||||
}
|
||||
}
|
||||
}
|
||||
15
src/Ryujinx.Tests/Audio/Renderer/VoiceInParameterTests.cs
Normal file
15
src/Ryujinx.Tests/Audio/Renderer/VoiceInParameterTests.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using NUnit.Framework;
|
||||
using Ryujinx.Audio.Renderer.Parameter;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Ryujinx.Tests.Audio.Renderer
|
||||
{
|
||||
class VoiceInParameterTests
|
||||
{
|
||||
[Test]
|
||||
public void EnsureTypeSize()
|
||||
{
|
||||
Assert.AreEqual(0x170, Unsafe.SizeOf<VoiceInParameter>());
|
||||
}
|
||||
}
|
||||
}
|
||||
15
src/Ryujinx.Tests/Audio/Renderer/VoiceOutStatusTests.cs
Normal file
15
src/Ryujinx.Tests/Audio/Renderer/VoiceOutStatusTests.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using NUnit.Framework;
|
||||
using Ryujinx.Audio.Renderer.Parameter;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Ryujinx.Tests.Audio.Renderer
|
||||
{
|
||||
class VoiceOutStatusTests
|
||||
{
|
||||
[Test]
|
||||
public void EnsureTypeSize()
|
||||
{
|
||||
Assert.AreEqual(0x10, Unsafe.SizeOf<VoiceOutStatus>());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user