aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Audio.Renderer/Parameter/Effect
diff options
context:
space:
mode:
Diffstat (limited to 'Ryujinx.Audio.Renderer/Parameter/Effect')
-rw-r--r--Ryujinx.Audio.Renderer/Parameter/Effect/AuxiliaryBufferParameter.cs100
-rw-r--r--Ryujinx.Audio.Renderer/Parameter/Effect/BiquadFilterEffectParameter.cs61
-rw-r--r--Ryujinx.Audio.Renderer/Parameter/Effect/BufferMixerParameter.cs49
-rw-r--r--Ryujinx.Audio.Renderer/Parameter/Effect/DelayParameter.cs118
-rw-r--r--Ryujinx.Audio.Renderer/Parameter/Effect/Reverb3dParameter.cs144
-rw-r--r--Ryujinx.Audio.Renderer/Parameter/Effect/ReverbParameter.cs136
6 files changed, 608 insertions, 0 deletions
diff --git a/Ryujinx.Audio.Renderer/Parameter/Effect/AuxiliaryBufferParameter.cs b/Ryujinx.Audio.Renderer/Parameter/Effect/AuxiliaryBufferParameter.cs
new file mode 100644
index 00000000..e18c05db
--- /dev/null
+++ b/Ryujinx.Audio.Renderer/Parameter/Effect/AuxiliaryBufferParameter.cs
@@ -0,0 +1,100 @@
+//
+// 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 <https://www.gnu.org/licenses/>.
+//
+
+using Ryujinx.Common.Memory;
+using System.Runtime.InteropServices;
+
+namespace Ryujinx.Audio.Renderer.Parameter.Effect
+{
+ /// <summary>
+ /// <see cref="EffectInParameter.SpecificData"/> for <see cref="Common.EffectType.AuxiliaryBuffer"/>.
+ /// </summary>
+ [StructLayout(LayoutKind.Sequential, Pack = 1)]
+ public struct AuxiliaryBufferParameter
+ {
+ /// <summary>
+ /// The input channel indices that will be used by the <see cref="Dsp.AudioProcessor"/> to write data to <see cref="SendBufferInfoAddress"/>.
+ /// </summary>
+ public Array24<byte> Input;
+
+ /// <summary>
+ /// The output channel indices that will be used by the <see cref="Dsp.AudioProcessor"/> to read data from <see cref="ReturnBufferInfoAddress"/>.
+ /// </summary>
+ public Array24<byte> Output;
+
+ /// <summary>
+ /// The total channel count used.
+ /// </summary>
+ public uint ChannelCount;
+
+ /// <summary>
+ /// The target sample rate.
+ /// </summary>
+ public uint SampleRate;
+
+ /// <summary>
+ /// The buffer storage total size.
+ /// </summary>
+ public uint BufferStorageSize;
+
+ /// <summary>
+ /// The maximum number of channels supported.
+ /// </summary>
+ /// <remarks>This is unused.</remarks>
+ public uint ChannelCountMax;
+
+ /// <summary>
+ /// The address of the start of the region containing two <see cref="Dsp.State.AuxiliaryBufferHeader"/> followed by the data that will be written by the <see cref="Dsp.AudioProcessor"/>.
+ /// </summary>
+ public ulong SendBufferInfoAddress;
+
+ /// <summary>
+ /// The address of the start of the region containling data that will be written by the <see cref="Dsp.AudioProcessor"/>.
+ /// </summary>
+ /// <remarks>This is unused.</remarks>
+ public ulong SendBufferStorageAddress;
+
+ /// <summary>
+ /// The address of the start of the region containing two <see cref="Dsp.State.AuxiliaryBufferHeader"/> followed by the data that will be read by the <see cref="Dsp.AudioProcessor"/>.
+ /// </summary>
+ public ulong ReturnBufferInfoAddress;
+
+ /// <summary>
+ /// The address of the start of the region containling data that will be read by the <see cref="Dsp.AudioProcessor"/>.
+ /// </summary>
+ /// <remarks>This is unused.</remarks>
+ public ulong ReturnBufferStorageAddress;
+
+ /// <summary>
+ /// Size of a sample of the mix buffer.
+ /// </summary>
+ /// <remarks>This is unused.</remarks>
+ public uint MixBufferSampleSize;
+
+ /// <summary>
+ /// The total count of sample that can be stored.
+ /// </summary>
+ /// <remarks>This is unused.</remarks>
+ public uint TotalSampleCount;
+
+ /// <summary>
+ /// The count of sample of the mix buffer.
+ /// </summary>
+ /// <remarks>This is unused.</remarks>
+ public uint MixBufferSampleCount;
+ }
+}
diff --git a/Ryujinx.Audio.Renderer/Parameter/Effect/BiquadFilterEffectParameter.cs b/Ryujinx.Audio.Renderer/Parameter/Effect/BiquadFilterEffectParameter.cs
new file mode 100644
index 00000000..26fff310
--- /dev/null
+++ b/Ryujinx.Audio.Renderer/Parameter/Effect/BiquadFilterEffectParameter.cs
@@ -0,0 +1,61 @@
+//
+// 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 <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="EffectInParameter.SpecificData"/> for <see cref="Common.EffectType.BiquadFilter"/>.
+ /// </summary>
+ [StructLayout(LayoutKind.Sequential, Pack = 1)]
+ public struct BiquadFilterEffectParameter
+ {
+ /// <summary>
+ /// The input channel indices that will be used by the <see cref="Dsp.AudioProcessor"/>.
+ /// </summary>
+ public Array6<byte> Input;
+
+ /// <summary>
+ /// The output channel indices that will be used by the <see cref="Dsp.AudioProcessor"/>.
+ /// </summary>
+ public Array6<byte> Output;
+
+ /// <summary>
+ /// Biquad filter numerator (b0, b1, b2).
+ /// </summary>
+ public Array3<short> Numerator;
+
+ /// <summary>
+ /// Biquad filter denominator (a1, a2).
+ /// </summary>
+ /// <remarks>a0 = 1</remarks>
+ public Array2<short> Denominator;
+
+ /// <summary>
+ /// The total channel count used.
+ /// </summary>
+ public byte ChannelCount;
+
+ /// <summary>
+ /// The current usage status of the effect on the client side.
+ /// </summary>
+ public UsageState Status;
+ }
+}
diff --git a/Ryujinx.Audio.Renderer/Parameter/Effect/BufferMixerParameter.cs b/Ryujinx.Audio.Renderer/Parameter/Effect/BufferMixerParameter.cs
new file mode 100644
index 00000000..94f77033
--- /dev/null
+++ b/Ryujinx.Audio.Renderer/Parameter/Effect/BufferMixerParameter.cs
@@ -0,0 +1,49 @@
+//
+// 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 <https://www.gnu.org/licenses/>.
+//
+
+using Ryujinx.Common.Memory;
+using System.Runtime.InteropServices;
+
+namespace Ryujinx.Audio.Renderer.Parameter.Effect
+{
+ /// <summary>
+ /// <see cref="EffectInParameter.SpecificData"/> for <see cref="Common.EffectType.BufferMix"/>.
+ /// </summary>
+ [StructLayout(LayoutKind.Sequential, Pack = 1)]
+ public struct BufferMixParameter
+ {
+ /// <summary>
+ /// The input channel indices that will be used by the <see cref="Dsp.AudioProcessor"/>.
+ /// </summary>
+ public Array24<byte> Input;
+
+ /// <summary>
+ /// The output channel indices that will be used by the <see cref="Dsp.AudioProcessor"/>.
+ /// </summary>
+ public Array24<byte> Output;
+
+ /// <summary>
+ /// The output volumes of the mixes.
+ /// </summary>
+ public Array24<float> Volumes;
+
+ /// <summary>
+ /// The total count of mixes used.
+ /// </summary>
+ public uint MixesCount;
+ }
+}
diff --git a/Ryujinx.Audio.Renderer/Parameter/Effect/DelayParameter.cs b/Ryujinx.Audio.Renderer/Parameter/Effect/DelayParameter.cs
new file mode 100644
index 00000000..2f2c907f
--- /dev/null
+++ b/Ryujinx.Audio.Renderer/Parameter/Effect/DelayParameter.cs
@@ -0,0 +1,118 @@
+//
+// 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 <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="EffectInParameter.SpecificData"/> for <see cref="Common.EffectType.Delay"/>.
+ /// </summary>
+ [StructLayout(LayoutKind.Sequential, Pack = 1)]
+ public struct DelayParameter
+ {
+ /// <summary>
+ /// The input channel indices that will be used by the <see cref="Dsp.AudioProcessor"/>.
+ /// </summary>
+ public Array6<byte> Input;
+
+ /// <summary>
+ /// The output channel indices that will be used by the <see cref="Dsp.AudioProcessor"/>.
+ /// </summary>
+ public Array6<byte> Output;
+
+ /// <summary>
+ /// The maximum number of channels supported.
+ /// </summary>
+ public ushort ChannelCountMax;
+
+ /// <summary>
+ /// The total channel count used.
+ /// </summary>
+ public ushort ChannelCount;
+
+ /// <summary>
+ /// The maximum delay time in milliseconds.
+ /// </summary>
+ public uint DelayTimeMax;
+
+ /// <summary>
+ /// The delay time in milliseconds.
+ /// </summary>
+ public uint DelayTime;
+
+ /// <summary>
+ /// The target sample rate. (Q15)
+ /// </summary>
+ public uint SampleRate;
+
+ /// <summary>
+ /// The input gain. (Q15)
+ /// </summary>
+ public uint InGain;
+
+ /// <summary>
+ /// The feedback gain. (Q15)
+ /// </summary>
+ public uint FeedbackGain;
+
+ /// <summary>
+ /// The output gain. (Q15)
+ /// </summary>
+ public uint OutGain;
+
+ /// <summary>
+ /// The dry gain. (Q15)
+ /// </summary>
+ public uint DryGain;
+
+ /// <summary>
+ /// The channel spread of the <see cref="FeedbackGain"/>. (Q15)
+ /// </summary>
+ public uint ChannelSpread;
+
+ /// <summary>
+ /// The low pass amount. (Q15)
+ /// </summary>
+ public uint LowPassAmount;
+
+ /// <summary>
+ /// The current usage status of the effect on the client side.
+ /// </summary>
+ public UsageState Status;
+
+ /// <summary>
+ /// Check if the <see cref="ChannelCount"/> is valid.
+ /// </summary>
+ /// <returns>Returns true if the <see cref="ChannelCount"/> is valid.</returns>
+ public bool IsChannelCountValid()
+ {
+ return EffectInParameter.IsChannelCountValid(ChannelCount);
+ }
+
+ /// <summary>
+ /// Check if the <see cref="ChannelCountMax"/> is valid.
+ /// </summary>
+ /// <returns>Returns true if the <see cref="ChannelCountMax"/> is valid.</returns>
+ public bool IsChannelCountMaxValid()
+ {
+ return EffectInParameter.IsChannelCountValid(ChannelCountMax);
+ }
+ }
+}
diff --git a/Ryujinx.Audio.Renderer/Parameter/Effect/Reverb3dParameter.cs b/Ryujinx.Audio.Renderer/Parameter/Effect/Reverb3dParameter.cs
new file mode 100644
index 00000000..9f31cd15
--- /dev/null
+++ b/Ryujinx.Audio.Renderer/Parameter/Effect/Reverb3dParameter.cs
@@ -0,0 +1,144 @@
+//
+// 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 <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="EffectInParameter.SpecificData"/> for <see cref="Common.EffectType.Reverb3d"/>.
+ /// </summary>
+ [StructLayout(LayoutKind.Sequential, Pack = 1)]
+ public struct Reverb3dParameter
+ {
+ /// <summary>
+ /// The input channel indices that will be used by the <see cref="Dsp.AudioProcessor"/>.
+ /// </summary>
+ public Array6<byte> Input;
+
+ /// <summary>
+ /// The output channel indices that will be used by the <see cref="Dsp.AudioProcessor"/>.
+ /// </summary>
+ public Array6<byte> Output;
+
+ /// <summary>
+ /// The maximum number of channels supported.
+ /// </summary>
+ public ushort ChannelCountMax;
+
+ /// <summary>
+ /// The total channel count used.
+ /// </summary>
+ public ushort ChannelCount;
+
+ /// <summary>
+ /// Reserved/unused.
+ /// </summary>
+ private uint _reserved;
+
+ /// <summary>
+ /// The target sample rate.
+ /// </summary>
+ /// <remarks>This is in kHz.</remarks>
+ public uint SampleRate;
+
+ /// <summary>
+ /// Gain of the room high-frequency effect.
+ /// </summary>
+ public float RoomHf;
+
+ /// <summary>
+ /// Reference high frequency.
+ /// </summary>
+ public float HfReference;
+
+ /// <summary>
+ /// Reverberation decay time at low frequencies.
+ /// </summary>
+ public float DecayTime;
+
+ /// <summary>
+ /// Ratio of the decay time at high frequencies to the decay time at low frequencies.
+ /// </summary>
+ public float HfDecayRatio;
+
+ /// <summary>
+ /// Gain of the room effect.
+ /// </summary>
+ public float RoomGain;
+
+ /// <summary>
+ /// Gain of the early reflections relative to <see cref="RoomGain"/>.
+ /// </summary>
+ public float ReflectionsGain;
+
+ /// <summary>
+ /// Gain of the late reverberation relative to <see cref="RoomGain"/>.
+ /// </summary>
+ public float ReverbGain;
+
+ /// <summary>
+ /// Echo density in the late reverberation decay.
+ /// </summary>
+ public float Diffusion;
+
+ /// <summary>
+ /// Modal density in the late reverberation decay.
+ /// </summary>
+ public float ReflectionDelay;
+
+ /// <summary>
+ /// Time limit between the early reflections and the late reverberation relative to the time of the first reflection.
+ /// </summary>
+ public float ReverbDelayTime;
+
+ /// <summary>
+ /// Modal density in the late reverberation decay.
+ /// </summary>
+ public float Density;
+
+ /// <summary>
+ /// The dry gain.
+ /// </summary>
+ public float DryGain;
+
+ /// <summary>
+ /// The current usage status of the effect on the client side.
+ /// </summary>
+ public UsageState ParameterStatus;
+
+ /// <summary>
+ /// Check if the <see cref="ChannelCount"/> is valid.
+ /// </summary>
+ /// <returns>Returns true if the <see cref="ChannelCount"/> is valid.</returns>
+ public bool IsChannelCountValid()
+ {
+ return EffectInParameter.IsChannelCountValid(ChannelCount);
+ }
+
+ /// <summary>
+ /// Check if the <see cref="ChannelCountMax"/> is valid.
+ /// </summary>
+ /// <returns>Returns true if the <see cref="ChannelCountMax"/> is valid.</returns>
+ public bool IsChannelCountMaxValid()
+ {
+ return EffectInParameter.IsChannelCountValid(ChannelCountMax);
+ }
+ }
+}
diff --git a/Ryujinx.Audio.Renderer/Parameter/Effect/ReverbParameter.cs b/Ryujinx.Audio.Renderer/Parameter/Effect/ReverbParameter.cs
new file mode 100644
index 00000000..ebe0ffdd
--- /dev/null
+++ b/Ryujinx.Audio.Renderer/Parameter/Effect/ReverbParameter.cs
@@ -0,0 +1,136 @@
+//
+// 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 <https://www.gnu.org/licenses/>.
+//
+
+using Ryujinx.Audio.Renderer.Common;
+using Ryujinx.Audio.Renderer.Server.Effect;
+using Ryujinx.Common.Memory;
+using System.Runtime.InteropServices;
+
+namespace Ryujinx.Audio.Renderer.Parameter.Effect
+{
+ /// <summary>
+ /// <see cref="EffectInParameter.SpecificData"/> for <see cref="Common.EffectType.Reverb"/>.
+ /// </summary>
+ [StructLayout(LayoutKind.Sequential, Pack = 1)]
+ public struct ReverbParameter
+ {
+ /// <summary>
+ /// The input channel indices that will be used by the <see cref="Dsp.AudioProcessor"/>.
+ /// </summary>
+ public Array6<byte> Input;
+
+ /// <summary>
+ /// The output channel indices that will be used by the <see cref="Dsp.AudioProcessor"/>.
+ /// </summary>
+ public Array6<byte> Output;
+
+ /// <summary>
+ /// The maximum number of channels supported.
+ /// </summary>
+ public ushort ChannelCountMax;
+
+ /// <summary>
+ /// The total channel count used.
+ /// </summary>
+ public ushort ChannelCount;
+
+ /// <summary>
+ /// The target sample rate. (Q15)
+ /// </summary>
+ /// <remarks>This is in kHz.</remarks>
+ public int SampleRate;
+
+ /// <summary>
+ /// The early mode to use.
+ /// </summary>
+ public ReverbEarlyMode EarlyMode;
+
+ /// <summary>
+ /// The gain to apply to the result of the early reflection. (Q15)
+ /// </summary>
+ public int EarlyGain;
+
+ /// <summary>
+ /// The pre-delay time in milliseconds. (Q15)
+ /// </summary>
+ public int PreDelayTime;
+
+ /// <summary>
+ /// The late mode to use.
+ /// </summary>
+ public ReverbLateMode LateMode;
+
+ /// <summary>
+ /// The gain to apply to the result of the late reflection. (Q15)
+ /// </summary>
+ public int LateGain;
+
+ /// <summary>
+ /// The decay time. (Q15)
+ /// </summary>
+ public int DecayTime;
+
+ /// <summary>
+ /// The high frequency decay ratio. (Q15)
+ /// </summary>
+ /// <remarks>If <see cref="HighFrequencyDecayRatio"/> >= 0.995f, it is considered disabled.</remarks>
+ public int HighFrequencyDecayRatio;
+
+ /// <summary>
+ /// The coloration of the decay. (Q15)
+ /// </summary>
+ public int Coloration;
+
+ /// <summary>
+ /// The reverb gain. (Q15)
+ /// </summary>
+ public int ReverbGain;
+
+ /// <summary>
+ /// The output gain. (Q15)
+ /// </summary>
+ public int OutGain;
+
+ /// <summary>
+ /// The dry gain. (Q15)
+ /// </summary>
+ public int DryGain;
+
+ /// <summary>
+ /// The current usage status of the effect on the client side.
+ /// </summary>
+ public UsageState Status;
+
+ /// <summary>
+ /// Check if the <see cref="ChannelCount"/> is valid.
+ /// </summary>
+ /// <returns>Returns true if the <see cref="ChannelCount"/> is valid.</returns>
+ public bool IsChannelCountValid()
+ {
+ return EffectInParameter.IsChannelCountValid(ChannelCount);
+ }
+
+ /// <summary>
+ /// Check if the <see cref="ChannelCountMax"/> is valid.
+ /// </summary>
+ /// <returns>Returns true if the <see cref="ChannelCountMax"/> is valid.</returns>
+ public bool IsChannelCountMaxValid()
+ {
+ return EffectInParameter.IsChannelCountValid(ChannelCountMax);
+ }
+ }
+}