//
// Copyright (c) 2019-2021 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 Ryujinx.Audio.Renderer.Server.Effect;
using Ryujinx.Common.Memory;
using System.Runtime.InteropServices;
namespace Ryujinx.Audio.Renderer.Parameter.Effect
{
///
/// for .
///
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct LimiterParameter
{
///
/// The input channel indices that will be used by the .
///
public Array6 Input;
///
/// The output channel indices that will be used by the .
///
public Array6 Output;
///
/// The maximum number of channels supported.
///
public ushort ChannelCountMax;
///
/// The total channel count used.
///
public ushort ChannelCount;
///
/// The target sample rate.
///
/// This is in kHz.
public int SampleRate;
///
/// The look ahead max time.
/// This is in microseconds.
///
public int LookAheadTimeMax;
///
/// The attack time.
/// This is in microseconds.
///
public int AttackTime;
///
/// The release time.
/// This is in microseconds.
///
public int ReleaseTime;
///
/// The look ahead time.
/// This is in microseconds.
///
public int LookAheadTime;
///
/// The attack coefficient.
///
public float AttackCoefficient;
///
/// The release coefficient.
///
public float ReleaseCoefficient;
///
/// The threshold.
///
public float Threshold;
///
/// The input gain.
///
public float InputGain;
///
/// The output gain.
///
public float OutputGain;
///
/// The minimum samples stored in the delay buffer.
///
public int DelayBufferSampleCountMin;
///
/// The maximum samples stored in the delay buffer.
///
public int DelayBufferSampleCountMax;
///
/// The current usage status of the effect on the client side.
///
public UsageState Status;
///
/// Indicate if the limiter effect should output statistics.
///
[MarshalAs(UnmanagedType.I1)]
public bool StatisticsEnabled;
///
/// Indicate to the DSP that the user did a statistics reset.
///
[MarshalAs(UnmanagedType.I1)]
public bool StatisticsReset;
///
/// Reserved/padding.
///
private byte _reserved;
///
/// Check if the is valid.
///
/// Returns true if the is valid.
public bool IsChannelCountValid()
{
return EffectInParameterVersion1.IsChannelCountValid(ChannelCount);
}
///
/// Check if the is valid.
///
/// Returns true if the is valid.
public bool IsChannelCountMaxValid()
{
return EffectInParameterVersion1.IsChannelCountValid(ChannelCountMax);
}
}
}