mirror of
https://github.com/GreemDev/Ryujinx
synced 2024-11-29 21:12:33 +01:00
a389dd59bd
* Amadeus: Final Act This is my requiem, I present to you Amadeus, a complete reimplementation of the Audio Renderer! This reimplementation is based on my reversing of every version of the audio system module that I carried for the past 10 months. This supports every revision (at the time of writing REV1 to REV8 included) and all features proposed by the Audio Renderer on real hardware. Because this component could be used outside an emulation context, and to avoid possible "inspirations" not crediting the project, I decided to license the Ryujinx.Audio.Renderer project under LGPLv3. - FE3H voices in videos and chapter intro are not present. - Games that use two audio renderer **at the same time** are probably going to have issues right now **until we rewrite the audio output interface** (Crash Team Racing is the only known game to use two renderer at the same time). - Persona 5 Scrambler now goes ingame but audio is garbage. This is caused by the fact that the game engine is syncing audio and video in a really aggressive way. This will disappears the day this game run at full speed. * Make timing more precise when sleeping on Windows Improve precision to a 1ms resolution on Windows NT based OS. This is used to avoid having totally erratic timings and unify all Windows users to the same resolution. NOTE: This is only active when emulation is running.
228 lines
No EOL
12 KiB
C#
228 lines
No EOL
12 KiB
C#
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.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.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.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.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.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.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.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.AreEqual(0.80f, behaviourContext.GetAudioRendererProcessingTimeLimit());
|
|
Assert.AreEqual(3, behaviourContext.GetCommandProcessingTimeEstimatorVersion());
|
|
Assert.AreEqual(2, behaviourContext.GetPerformanceMetricsDataFormat());
|
|
}
|
|
}
|
|
} |