2020-08-18 03:49:37 +02:00
|
|
|
using System;
|
|
|
|
|
|
|
|
namespace Ryujinx.Audio.Renderer.Server.Upsampler
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// Server state for a upsampling.
|
|
|
|
/// </summary>
|
|
|
|
public class UpsamplerState
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// The output buffer containing the target samples.
|
|
|
|
/// </summary>
|
|
|
|
public Memory<float> OutputBuffer { get; }
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// The target sample count.
|
|
|
|
/// </summary>
|
|
|
|
public uint SampleCount { get; }
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// The index of the <see cref="UpsamplerState"/>. (used to free it)
|
|
|
|
/// </summary>
|
|
|
|
private int _index;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// The <see cref="UpsamplerManager"/>.
|
|
|
|
/// </summary>
|
|
|
|
private UpsamplerManager _manager;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// The source sample count.
|
|
|
|
/// </summary>
|
|
|
|
public uint SourceSampleCount;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// The input buffer indices of the buffers holding the samples that need upsampling.
|
|
|
|
/// </summary>
|
|
|
|
public ushort[] InputBufferIndices;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Create a new <see cref="UpsamplerState"/>.
|
|
|
|
/// </summary>
|
|
|
|
/// <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;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Release the <see cref="UpsamplerState"/>.
|
|
|
|
/// </summary>
|
|
|
|
public void Release()
|
|
|
|
{
|
|
|
|
_manager.Free(_index);
|
|
|
|
}
|
|
|
|
}
|
2022-07-25 20:46:33 +02:00
|
|
|
}
|