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 36f2fb4e18
commit f4705f63d6
9 changed files with 274 additions and 9 deletions

View file

@ -54,7 +54,7 @@ namespace Ryujinx.Audio.Backends.SoundIo
public override void QueueBuffer(AudioBuffer buffer)
{
SoundIoAudioBuffer driverBuffer = new(buffer.DataPointer, GetSampleCount(buffer));
SoundIoAudioBuffer driverBuffer = new(buffer.HostTag, GetSampleCount(buffer));
_ringBuffer.Write(buffer.Data, 0, buffer.Data.Length);
@ -90,7 +90,7 @@ namespace Ryujinx.Audio.Backends.SoundIo
return true;
}
return driverBuffer.DriverIdentifier != buffer.DataPointer;
return driverBuffer.DriverIdentifier != buffer.HostTag;
}
private unsafe void Update(int minFrameCount, int maxFrameCount)