//
// 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 <https://www.gnu.org/licenses/>.
using Ryujinx.Audio.Renderer.Server.Effect;
using Ryujinx.Common.Memory;
using System.Runtime.InteropServices;
namespace Ryujinx.Audio.Renderer.Parameter.Effect
{
/// <summary>
/// <see cref="IEffectInParameter.SpecificData"/> for <see cref="Common.EffectType.Reverb3d"/>.
/// </summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct Reverb3dParameter
/// The input channel indices that will be used by the <see cref="Dsp.AudioProcessor"/>.
public Array6<byte> Input;
/// The output channel indices that will be used by the <see cref="Dsp.AudioProcessor"/>.
public Array6<byte> Output;
/// The maximum number of channels supported.
public ushort ChannelCountMax;
/// The total channel count used.
public ushort ChannelCount;
/// Reserved/unused.
private uint _reserved;
/// The target sample rate.
/// <remarks>This is in kHz.</remarks>
public uint SampleRate;
/// Gain of the room high-frequency effect.
public float RoomHf;
/// Reference high frequency.
public float HfReference;
/// Reverberation decay time at low frequencies.
public float DecayTime;
/// Ratio of the decay time at high frequencies to the decay time at low frequencies.
public float HfDecayRatio;
/// Gain of the room effect.
public float RoomGain;
/// Gain of the early reflections relative to <see cref="RoomGain"/>.
public float ReflectionsGain;
/// Gain of the late reverberation relative to <see cref="RoomGain"/>.
public float ReverbGain;
/// Echo density in the late reverberation decay.
public float Diffusion;
/// Modal density in the late reverberation decay.
public float ReflectionDelay;
/// Time limit between the early reflections and the late reverberation relative to the time of the first reflection.
public float ReverbDelayTime;
public float Density;
/// The dry gain.
public float DryGain;
/// The current usage status of the effect on the client side.
public UsageState ParameterStatus;
/// Check if the <see cref="ChannelCount"/> is valid.
/// <returns>Returns true if the <see cref="ChannelCount"/> is valid.</returns>
public bool IsChannelCountValid()
return EffectInParameterVersion1.IsChannelCountValid(ChannelCount);
}
/// Check if the <see cref="ChannelCountMax"/> is valid.
/// <returns>Returns true if the <see cref="ChannelCountMax"/> is valid.</returns>
public bool IsChannelCountMaxValid()
return EffectInParameterVersion1.IsChannelCountValid(ChannelCountMax);