aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Audio.Renderer/Parameter/Effect
diff options
context:
space:
mode:
authorMary <me@thog.eu>2021-02-26 01:11:56 +0100
committerGitHub <noreply@github.com>2021-02-26 01:11:56 +0100
commitf556c80d0230056335632b60c71f1567e177239e (patch)
tree748aa6be62b93a8e941e25dbd83f39e1dbb37035 /Ryujinx.Audio.Renderer/Parameter/Effect
parent1c49089ff00fc87dc4872f135dc6a0d36169a970 (diff)
Haydn: Part 1 (#2007)
* Haydn: Part 1 Based on my reverse of audio 11.0.0. As always, core implementation under LGPLv3 for the same reasons as for Amadeus. This place the bases of a more flexible audio system while making audout & audin accurate. This have the following improvements: - Complete reimplementation of audout and audin. - Audin currently only have a dummy backend. - Dramatically reduce CPU usage by up to 50% in common cases (SoundIO and OpenAL). - Audio Renderer now can output to 5.1 devices when supported. - Audio Renderer init its backend on demand instead of keeping two up all the time. - All backends implementation are now in their own project. - Ryujinx.Audio.Renderer was renamed Ryujinx.Audio and was refactored because of this. As a note, games having issues with OpenAL haven't improved and will not because of OpenAL design (stopping when buffers finish playing causing possible audio "pops" when buffers are very small). * Update for latest hexkyz's edits on Switchbrew * audren: Rollback channel configuration changes * Address gdkchan's comments * Fix typo in OpenAL backend driver * Address last comments * Fix a nit * Address gdkchan's comments
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, 0 insertions, 608 deletions
diff --git a/Ryujinx.Audio.Renderer/Parameter/Effect/AuxiliaryBufferParameter.cs b/Ryujinx.Audio.Renderer/Parameter/Effect/AuxiliaryBufferParameter.cs
deleted file mode 100644
index 5a747922..00000000
--- a/Ryujinx.Audio.Renderer/Parameter/Effect/AuxiliaryBufferParameter.cs
+++ /dev/null
@@ -1,100 +0,0 @@
-//
-// 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.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
deleted file mode 100644
index 7d58d4be..00000000
--- a/Ryujinx.Audio.Renderer/Parameter/Effect/BiquadFilterEffectParameter.cs
+++ /dev/null
@@ -1,61 +0,0 @@
-//
-// 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="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
deleted file mode 100644
index b0c0c337..00000000
--- a/Ryujinx.Audio.Renderer/Parameter/Effect/BufferMixerParameter.cs
+++ /dev/null
@@ -1,49 +0,0 @@
-//
-// 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.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
deleted file mode 100644
index e0dbeb7c..00000000
--- a/Ryujinx.Audio.Renderer/Parameter/Effect/DelayParameter.cs
+++ /dev/null
@@ -1,118 +0,0 @@
-//
-// 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="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
deleted file mode 100644
index 0dbecfb8..00000000
--- a/Ryujinx.Audio.Renderer/Parameter/Effect/Reverb3dParameter.cs
+++ /dev/null
@@ -1,144 +0,0 @@
-//
-// 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="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
deleted file mode 100644
index daa81c51..00000000
--- a/Ryujinx.Audio.Renderer/Parameter/Effect/ReverbParameter.cs
+++ /dev/null
@@ -1,136 +0,0 @@
-//
-// 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.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);
- }
- }
-}