//
// Copyright (c) 2019-2020 Ryujinx
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see .
//
using System;
namespace Ryujinx.Audio.Renderer.Server.Upsampler
{
///
/// Server state for a upsampling.
///
public class UpsamplerState
{
///
/// The output buffer containing the target samples.
///
public Memory OutputBuffer { get; }
///
/// The target sample count.
///
public uint SampleCount { get; }
///
/// The index of the . (used to free it)
///
private int _index;
///
/// The .
///
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;
///
/// Create a new .
///
/// The upsampler manager.
/// The index of the . (used to free it)
/// The output buffer used to contain the target samples.
/// The target sample count.
public UpsamplerState(UpsamplerManager manager, int index, Memory outputBuffer, uint sampleCount)
{
_manager = manager;
_index = index;
OutputBuffer = outputBuffer;
SampleCount = sampleCount;
}
///
/// Release the .
///
public void Release()
{
_manager.Free(_index);
}
}
}