using System;
namespace Ryujinx.Audio.Renderer.Server.Upsampler
{
/// <summary>
/// Server state for a upsampling.
/// </summary>
public class UpsamplerState
/// The output buffer containing the target samples.
public Memory<float> OutputBuffer { get; }
/// The target sample count.
public uint SampleCount { get; }
/// The index of the <see cref="UpsamplerState"/>. (used to free it)
private int _index;
/// The <see cref="UpsamplerManager"/>.
private UpsamplerManager _manager;
/// The source sample count.
public uint SourceSampleCount;
/// The input buffer indices of the buffers holding the samples that need upsampling.
public ushort[] InputBufferIndices;
/// State of each input buffer index kept across invocations of the upsampler.
public UpsamplerBufferState[] BufferStates;
/// Create a new <see cref="UpsamplerState"/>.
/// <param name="manager">The upsampler manager.</param>
/// <param name="index">The index of the <see cref="UpsamplerState"/>. (used to free it)</param>
/// <param name="outputBuffer">The output buffer used to contain the target samples.</param>
/// <param name="sampleCount">The target sample count.</param>
public UpsamplerState(UpsamplerManager manager, int index, Memory<float> outputBuffer, uint sampleCount)
_manager = manager;
_index = index;
OutputBuffer = outputBuffer;
SampleCount = sampleCount;
}
/// Release the <see cref="UpsamplerState"/>.
public void Release()
_manager.Free(_index);