forked from MeloNX/MeloNX
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.
46 lines
1.2 KiB
C#
46 lines
1.2 KiB
C#
using Ryujinx.Audio.Integration;
|
|
using System.Threading;
|
|
|
|
namespace Ryujinx.Audio.Common
|
|
{
|
|
/// <summary>
|
|
/// Represent an audio buffer that will be used by an <see cref="IHardwareDeviceSession"/>.
|
|
/// </summary>
|
|
public class AudioBuffer
|
|
{
|
|
private static ulong UniqueIdGlobal = 0;
|
|
|
|
/// <summary>
|
|
/// Unique tag of this buffer, from the guest.
|
|
/// </summary>
|
|
/// <remarks>Unique per session</remarks>
|
|
public ulong BufferTag;
|
|
|
|
/// <summary>
|
|
/// Globally unique ID of the buffer on the host.
|
|
/// </summary>
|
|
public ulong HostTag = Interlocked.Increment(ref UniqueIdGlobal);
|
|
|
|
/// <summary>
|
|
/// Pointer to the user samples.
|
|
/// </summary>
|
|
public ulong DataPointer;
|
|
|
|
/// <summary>
|
|
/// Size of the user samples region.
|
|
/// </summary>
|
|
public ulong DataSize;
|
|
|
|
/// <summary>
|
|
/// The timestamp at which the buffer was played.
|
|
/// </summary>
|
|
/// <remarks>Not used but useful for debugging</remarks>
|
|
public ulong PlayedTimestamp;
|
|
|
|
/// <summary>
|
|
/// The user samples.
|
|
/// </summary>
|
|
public byte[] Data;
|
|
}
|
|
}
|