Audio: Add optional artificial audio delay layer

This driver runs ahead by the given duration (measured in samples at 48000hz). For games that rely on buffer release feedback to know when to provide audio frames, this can trick them into running with a higher audio latency on platforms that require it to avoid stuttering.

See `Switch.cs` for the sampleDelay definition. It's currently 0, though in future it could be configurable or switch on automatically for certain configurations.

For audio sources that _do not_ care about sample release timing, such as the current AudioRenderer, this will not change their behaviour.
This commit is contained in:
riperiperi 2024-01-06 20:06:55 +00:00
parent 7ac6b8e742
commit 60442064e4
9 changed files with 274 additions and 9 deletions

View file

@ -65,7 +65,7 @@ namespace Ryujinx.Audio.Backends.OpenAL
{
OpenALAudioBuffer driverBuffer = new()
{
DriverIdentifier = buffer.DataPointer,
DriverIdentifier = buffer.HostTag,
BufferId = AL.GenBuffer(),
SampleCount = GetSampleCount(buffer),
};
@ -131,7 +131,7 @@ namespace Ryujinx.Audio.Backends.OpenAL
return true;
}
return driverBuffer.DriverIdentifier != buffer.DataPointer;
return driverBuffer.DriverIdentifier != buffer.HostTag;
}
}