From f556c80d0230056335632b60c71f1567e177239e Mon Sep 17 00:00:00 2001 From: Mary Date: Fri, 26 Feb 2021 01:11:56 +0100 Subject: 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 --- .../Parameter/AudioRendererConfiguration.cs | 116 ------- .../Parameter/BehaviourErrorInfoOutStatus.cs | 47 --- .../Parameter/BiquadFilterParameter.cs | 51 --- .../Parameter/Effect/AuxiliaryBufferParameter.cs | 100 ------ .../Effect/BiquadFilterEffectParameter.cs | 61 ---- .../Parameter/Effect/BufferMixerParameter.cs | 49 --- .../Parameter/Effect/DelayParameter.cs | 118 ------- .../Parameter/Effect/Reverb3dParameter.cs | 144 --------- .../Parameter/Effect/ReverbParameter.cs | 136 -------- .../Parameter/EffectInParameter.cs | 103 ------ .../Parameter/EffectOutStatus.cs | 55 ---- .../Parameter/MemoryPoolInParameter.cs | 50 --- .../Parameter/MemoryPoolOutStatus.cs | 39 --- .../Parameter/MixInParameterDirtyOnlyUpdate.cs | 44 --- Ryujinx.Audio.Renderer/Parameter/MixParameter.cs | 112 ------- .../Performance/PerformanceInParameter.cs | 38 --- .../Parameter/Performance/PerformanceOutStatus.cs | 38 --- .../Parameter/RendererInfoOutStatus.cs | 38 --- .../Parameter/Sink/CircularBufferParameter.cs | 78 ----- .../Parameter/Sink/DeviceParameter.cs | 75 ----- .../Parameter/SinkInParameter.cs | 70 ---- Ryujinx.Audio.Renderer/Parameter/SinkOutStatus.cs | 43 --- .../Parameter/SplitterDestinationInParameter.cs | 84 ----- .../Parameter/SplitterInParameter.cs | 63 ---- .../Parameter/SplitterInParameterHeader.cs | 62 ---- .../Parameter/VoiceChannelResourceInParameter.cs | 45 --- .../Parameter/VoiceInParameter.cs | 360 --------------------- Ryujinx.Audio.Renderer/Parameter/VoiceOutStatus.cs | 52 --- 28 files changed, 2271 deletions(-) delete mode 100644 Ryujinx.Audio.Renderer/Parameter/AudioRendererConfiguration.cs delete mode 100644 Ryujinx.Audio.Renderer/Parameter/BehaviourErrorInfoOutStatus.cs delete mode 100644 Ryujinx.Audio.Renderer/Parameter/BiquadFilterParameter.cs delete mode 100644 Ryujinx.Audio.Renderer/Parameter/Effect/AuxiliaryBufferParameter.cs delete mode 100644 Ryujinx.Audio.Renderer/Parameter/Effect/BiquadFilterEffectParameter.cs delete mode 100644 Ryujinx.Audio.Renderer/Parameter/Effect/BufferMixerParameter.cs delete mode 100644 Ryujinx.Audio.Renderer/Parameter/Effect/DelayParameter.cs delete mode 100644 Ryujinx.Audio.Renderer/Parameter/Effect/Reverb3dParameter.cs delete mode 100644 Ryujinx.Audio.Renderer/Parameter/Effect/ReverbParameter.cs delete mode 100644 Ryujinx.Audio.Renderer/Parameter/EffectInParameter.cs delete mode 100644 Ryujinx.Audio.Renderer/Parameter/EffectOutStatus.cs delete mode 100644 Ryujinx.Audio.Renderer/Parameter/MemoryPoolInParameter.cs delete mode 100644 Ryujinx.Audio.Renderer/Parameter/MemoryPoolOutStatus.cs delete mode 100644 Ryujinx.Audio.Renderer/Parameter/MixInParameterDirtyOnlyUpdate.cs delete mode 100644 Ryujinx.Audio.Renderer/Parameter/MixParameter.cs delete mode 100644 Ryujinx.Audio.Renderer/Parameter/Performance/PerformanceInParameter.cs delete mode 100644 Ryujinx.Audio.Renderer/Parameter/Performance/PerformanceOutStatus.cs delete mode 100644 Ryujinx.Audio.Renderer/Parameter/RendererInfoOutStatus.cs delete mode 100644 Ryujinx.Audio.Renderer/Parameter/Sink/CircularBufferParameter.cs delete mode 100644 Ryujinx.Audio.Renderer/Parameter/Sink/DeviceParameter.cs delete mode 100644 Ryujinx.Audio.Renderer/Parameter/SinkInParameter.cs delete mode 100644 Ryujinx.Audio.Renderer/Parameter/SinkOutStatus.cs delete mode 100644 Ryujinx.Audio.Renderer/Parameter/SplitterDestinationInParameter.cs delete mode 100644 Ryujinx.Audio.Renderer/Parameter/SplitterInParameter.cs delete mode 100644 Ryujinx.Audio.Renderer/Parameter/SplitterInParameterHeader.cs delete mode 100644 Ryujinx.Audio.Renderer/Parameter/VoiceChannelResourceInParameter.cs delete mode 100644 Ryujinx.Audio.Renderer/Parameter/VoiceInParameter.cs delete mode 100644 Ryujinx.Audio.Renderer/Parameter/VoiceOutStatus.cs (limited to 'Ryujinx.Audio.Renderer/Parameter') diff --git a/Ryujinx.Audio.Renderer/Parameter/AudioRendererConfiguration.cs b/Ryujinx.Audio.Renderer/Parameter/AudioRendererConfiguration.cs deleted file mode 100644 index 047aa279..00000000 --- a/Ryujinx.Audio.Renderer/Parameter/AudioRendererConfiguration.cs +++ /dev/null @@ -1,116 +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 . -// - -using Ryujinx.Audio.Renderer.Server.Types; -using System.Runtime.InteropServices; - -namespace Ryujinx.Audio.Renderer.Parameter -{ - /// - /// Audio Renderer user configuration. - /// - [StructLayout(LayoutKind.Sequential, Pack = 1)] - public struct AudioRendererConfiguration - { - /// - /// The target sample rate of the user. - /// - /// Only 32000Hz and 48000Hz are considered valid, other sample rates will cause undefined behaviour. - public uint SampleRate; - - /// - /// The target sample count per updates. - /// - public uint SampleCount; - - /// - /// The maximum mix buffer count. - /// - public uint MixBufferCount; - - /// - /// The maximum amount of sub mixes that could be used by the user. - /// - public uint SubMixBufferCount; - - /// - /// The maximum amount of voices that could be used by the user. - /// - public uint VoiceCount; - - /// - /// The maximum amount of sinks that could be used by the user. - /// - public uint SinkCount; - - /// - /// The maximum amount of effects that could be used by the user. - /// - public uint EffectCount; - - /// - /// The maximum amount of performance metric frames that could be used by the user. - /// - public uint PerformanceMetricFramesCount; - - /// - /// Set to true if the user allows the to drop voices. - /// - /// - [MarshalAs(UnmanagedType.I1)] - public bool VoiceDropEnabled; - - /// - /// Reserved/unused - /// - private byte _reserved; - - /// - /// The target rendering device. - /// - /// Must be - public AudioRendererRenderingDevice RenderingDevice; - - /// - /// The target execution mode. - /// - /// Must be - public AudioRendererExecutionMode ExecutionMode; - - /// - /// The maximum amount of splitters that could be used by the user. - /// - public uint SplitterCount; - - /// - /// The maximum amount of splitters destinations that could be used by the user. - /// - public uint SplitterDestinationCount; - - /// - /// The size of the external context. - /// - /// This is a leftover of the old "codec" interface system that was present between 1.0.0 and 3.0.0. This was entirely removed from the server side with REV8. - public uint ExternalContextSize; - - /// - /// The user audio revision - /// - /// - public int Revision; - } -} diff --git a/Ryujinx.Audio.Renderer/Parameter/BehaviourErrorInfoOutStatus.cs b/Ryujinx.Audio.Renderer/Parameter/BehaviourErrorInfoOutStatus.cs deleted file mode 100644 index e5312f04..00000000 --- a/Ryujinx.Audio.Renderer/Parameter/BehaviourErrorInfoOutStatus.cs +++ /dev/null @@ -1,47 +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 . -// - -using Ryujinx.Common.Memory; -using System; -using System.Runtime.InteropServices; -using static Ryujinx.Audio.Renderer.Common.BehaviourParameter; - -namespace Ryujinx.Audio.Renderer.Parameter -{ - /// - /// Output information for behaviour. - /// - /// This is used to report errors to the user during processing. - [StructLayout(LayoutKind.Sequential, Pack = 1)] - public struct BehaviourErrorInfoOutStatus - { - /// - /// The reported errors. - /// - public Array10 ErrorInfos; - - /// - /// The amount of error that got reported. - /// - public uint ErrorInfosCount; - - /// - /// Reserved/unused. - /// - private unsafe fixed uint _reserved[3]; - } -} diff --git a/Ryujinx.Audio.Renderer/Parameter/BiquadFilterParameter.cs b/Ryujinx.Audio.Renderer/Parameter/BiquadFilterParameter.cs deleted file mode 100644 index de6b9577..00000000 --- a/Ryujinx.Audio.Renderer/Parameter/BiquadFilterParameter.cs +++ /dev/null @@ -1,51 +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 . -// - -using Ryujinx.Common.Memory; -using System.Runtime.InteropServices; - -namespace Ryujinx.Audio.Renderer.Parameter -{ - /// - /// Biquad filter parameters. - /// - [StructLayout(LayoutKind.Sequential, Size = 0xC, Pack = 1)] - public struct BiquadFilterParameter - { - /// - /// Set to true if the biquad filter is active. - /// - [MarshalAs(UnmanagedType.I1)] - public bool Enable; - - /// - /// Reserved/padding. - /// - private byte _reserved; - - /// - /// Biquad filter numerator (b0, b1, b2). - /// - public Array3 Numerator; - - /// - /// Biquad filter denominator (a1, a2). - /// - /// a0 = 1 - public Array2 Denominator; - } -} 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 . -// - -using Ryujinx.Common.Memory; -using System.Runtime.InteropServices; - -namespace Ryujinx.Audio.Renderer.Parameter.Effect -{ - /// - /// for . - /// - [StructLayout(LayoutKind.Sequential, Pack = 1)] - public struct AuxiliaryBufferParameter - { - /// - /// The input channel indices that will be used by the to write data to . - /// - public Array24 Input; - - /// - /// The output channel indices that will be used by the to read data from . - /// - public Array24 Output; - - /// - /// The total channel count used. - /// - public uint ChannelCount; - - /// - /// The target sample rate. - /// - public uint SampleRate; - - /// - /// The buffer storage total size. - /// - public uint BufferStorageSize; - - /// - /// The maximum number of channels supported. - /// - /// This is unused. - public uint ChannelCountMax; - - /// - /// The address of the start of the region containing two followed by the data that will be written by the . - /// - public ulong SendBufferInfoAddress; - - /// - /// The address of the start of the region containling data that will be written by the . - /// - /// This is unused. - public ulong SendBufferStorageAddress; - - /// - /// The address of the start of the region containing two followed by the data that will be read by the . - /// - public ulong ReturnBufferInfoAddress; - - /// - /// The address of the start of the region containling data that will be read by the . - /// - /// This is unused. - public ulong ReturnBufferStorageAddress; - - /// - /// Size of a sample of the mix buffer. - /// - /// This is unused. - public uint MixBufferSampleSize; - - /// - /// The total count of sample that can be stored. - /// - /// This is unused. - public uint TotalSampleCount; - - /// - /// The count of sample of the mix buffer. - /// - /// This is unused. - 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 . -// - -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 BiquadFilterEffectParameter - { - /// - /// 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; - - /// - /// Biquad filter numerator (b0, b1, b2). - /// - public Array3 Numerator; - - /// - /// Biquad filter denominator (a1, a2). - /// - /// a0 = 1 - public Array2 Denominator; - - /// - /// The total channel count used. - /// - public byte ChannelCount; - - /// - /// The current usage status of the effect on the client side. - /// - 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 . -// - -using Ryujinx.Common.Memory; -using System.Runtime.InteropServices; - -namespace Ryujinx.Audio.Renderer.Parameter.Effect -{ - /// - /// for . - /// - [StructLayout(LayoutKind.Sequential, Pack = 1)] - public struct BufferMixParameter - { - /// - /// The input channel indices that will be used by the . - /// - public Array24 Input; - - /// - /// The output channel indices that will be used by the . - /// - public Array24 Output; - - /// - /// The output volumes of the mixes. - /// - public Array24 Volumes; - - /// - /// The total count of mixes used. - /// - 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 . -// - -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 DelayParameter - { - /// - /// 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 maximum delay time in milliseconds. - /// - public uint DelayTimeMax; - - /// - /// The delay time in milliseconds. - /// - public uint DelayTime; - - /// - /// The target sample rate. (Q15) - /// - public uint SampleRate; - - /// - /// The input gain. (Q15) - /// - public uint InGain; - - /// - /// The feedback gain. (Q15) - /// - public uint FeedbackGain; - - /// - /// The output gain. (Q15) - /// - public uint OutGain; - - /// - /// The dry gain. (Q15) - /// - public uint DryGain; - - /// - /// The channel spread of the . (Q15) - /// - public uint ChannelSpread; - - /// - /// The low pass amount. (Q15) - /// - public uint LowPassAmount; - - /// - /// The current usage status of the effect on the client side. - /// - public UsageState Status; - - /// - /// Check if the is valid. - /// - /// Returns true if the is valid. - public bool IsChannelCountValid() - { - return EffectInParameter.IsChannelCountValid(ChannelCount); - } - - /// - /// Check if the is valid. - /// - /// Returns true if the is valid. - 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 . -// - -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 Reverb3dParameter - { - /// - /// 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; - - /// - /// Reserved/unused. - /// - private uint _reserved; - - /// - /// The target sample rate. - /// - /// This is in kHz. - 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 . - /// - public float ReflectionsGain; - - /// - /// Gain of the late reverberation relative to . - /// - 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; - - /// - /// Modal density in the late reverberation decay. - /// - 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 is valid. - /// - /// Returns true if the is valid. - public bool IsChannelCountValid() - { - return EffectInParameter.IsChannelCountValid(ChannelCount); - } - - /// - /// Check if the is valid. - /// - /// Returns true if the is valid. - 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 . -// - -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 -{ - /// - /// for . - /// - [StructLayout(LayoutKind.Sequential, Pack = 1)] - public struct ReverbParameter - { - /// - /// 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. (Q15) - /// - /// This is in kHz. - public int SampleRate; - - /// - /// The early mode to use. - /// - public ReverbEarlyMode EarlyMode; - - /// - /// The gain to apply to the result of the early reflection. (Q15) - /// - public int EarlyGain; - - /// - /// The pre-delay time in milliseconds. (Q15) - /// - public int PreDelayTime; - - /// - /// The late mode to use. - /// - public ReverbLateMode LateMode; - - /// - /// The gain to apply to the result of the late reflection. (Q15) - /// - public int LateGain; - - /// - /// The decay time. (Q15) - /// - public int DecayTime; - - /// - /// The high frequency decay ratio. (Q15) - /// - /// If >= 0.995f, it is considered disabled. - public int HighFrequencyDecayRatio; - - /// - /// The coloration of the decay. (Q15) - /// - public int Coloration; - - /// - /// The reverb gain. (Q15) - /// - public int ReverbGain; - - /// - /// The output gain. (Q15) - /// - public int OutGain; - - /// - /// The dry gain. (Q15) - /// - public int DryGain; - - /// - /// The current usage status of the effect on the client side. - /// - public UsageState Status; - - /// - /// Check if the is valid. - /// - /// Returns true if the is valid. - public bool IsChannelCountValid() - { - return EffectInParameter.IsChannelCountValid(ChannelCount); - } - - /// - /// Check if the is valid. - /// - /// Returns true if the is valid. - public bool IsChannelCountMaxValid() - { - return EffectInParameter.IsChannelCountValid(ChannelCountMax); - } - } -} diff --git a/Ryujinx.Audio.Renderer/Parameter/EffectInParameter.cs b/Ryujinx.Audio.Renderer/Parameter/EffectInParameter.cs deleted file mode 100644 index af8edeff..00000000 --- a/Ryujinx.Audio.Renderer/Parameter/EffectInParameter.cs +++ /dev/null @@ -1,103 +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 . -// - -using Ryujinx.Audio.Renderer.Common; -using Ryujinx.Common.Utilities; -using System; -using System.Runtime.InteropServices; - -namespace Ryujinx.Audio.Renderer.Parameter -{ - /// - /// Input information for an effect. - /// - [StructLayout(LayoutKind.Sequential, Pack = 1)] - public struct EffectInParameter - { - /// - /// Type of the effect. - /// - public EffectType Type; - - /// - /// Set to true if the effect is new. - /// - [MarshalAs(UnmanagedType.I1)] - public bool IsNew; - - /// - /// Set to true if the effect must be active. - /// - [MarshalAs(UnmanagedType.I1)] - public bool IsEnabled; - - /// - /// Reserved/padding. - /// - private byte _reserved1; - - /// - /// The target mix id of the effect. - /// - public int MixId; - - /// - /// Address of the processing workbuffer. - /// - /// This is additional data that could be required by the effect processing. - public ulong BufferBase; - - /// - /// Size of the processing workbuffer. - /// - /// This is additional data that could be required by the effect processing. - public ulong BufferSize; - - /// - /// Position of the effect while processing effects. - /// - public uint ProcessingOrder; - - /// - /// Reserved/padding. - /// - private uint _reserved2; - - /// - /// Specific data storage. - /// - private SpecificDataStruct _specificDataStart; - - [StructLayout(LayoutKind.Sequential, Size = 0xA0, Pack = 1)] - private struct SpecificDataStruct { } - - /// - /// Specific data changing depending of the . See also the namespace. - /// - public Span SpecificData => SpanHelpers.AsSpan(ref _specificDataStart); - - /// - /// Check if the given channel count is valid. - /// - /// The channel count to check - /// Returns true if the channel count is valid. - public static bool IsChannelCountValid(int channelCount) - { - return channelCount == 1 || channelCount == 2 || channelCount == 4 || channelCount == 6; - } - } -} diff --git a/Ryujinx.Audio.Renderer/Parameter/EffectOutStatus.cs b/Ryujinx.Audio.Renderer/Parameter/EffectOutStatus.cs deleted file mode 100644 index 7ed2c7ba..00000000 --- a/Ryujinx.Audio.Renderer/Parameter/EffectOutStatus.cs +++ /dev/null @@ -1,55 +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 . -// - -using System.Runtime.InteropServices; - -namespace Ryujinx.Audio.Renderer.Parameter -{ - /// - /// Output information for an effect. - /// - [StructLayout(LayoutKind.Sequential, Pack = 1)] - public struct EffectOutStatus - { - /// - /// The state of an effect. - /// - public enum EffectState : byte - { - /// - /// The effect is enabled. - /// - Enabled = 3, - - /// - /// The effect is disabled. - /// - Disabled = 4 - } - - /// - /// Current effect state. - /// - // TODO: enum? - public EffectState State; - - /// - /// Unused/Reserved. - /// - private unsafe fixed byte _reserved[15]; - } -} diff --git a/Ryujinx.Audio.Renderer/Parameter/MemoryPoolInParameter.cs b/Ryujinx.Audio.Renderer/Parameter/MemoryPoolInParameter.cs deleted file mode 100644 index 15498cca..00000000 --- a/Ryujinx.Audio.Renderer/Parameter/MemoryPoolInParameter.cs +++ /dev/null @@ -1,50 +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 . -// - -using Ryujinx.Audio.Renderer.Common; -using System.Runtime.InteropServices; -using CpuAddress = System.UInt64; - -namespace Ryujinx.Audio.Renderer.Parameter -{ - /// - /// Input information for a memory pool. - /// - [StructLayout(LayoutKind.Sequential, Pack = 1)] - public struct MemoryPoolInParameter - { - /// - /// The CPU address used by the memory pool. - /// - public CpuAddress CpuAddress; - - /// - /// The size used by the memory pool. - /// - public ulong Size; - - /// - /// The target state the user wants. - /// - public MemoryPoolUserState State; - - /// - /// Reserved/unused. - /// - private unsafe fixed uint _reserved[3]; - } -} diff --git a/Ryujinx.Audio.Renderer/Parameter/MemoryPoolOutStatus.cs b/Ryujinx.Audio.Renderer/Parameter/MemoryPoolOutStatus.cs deleted file mode 100644 index c125cb8b..00000000 --- a/Ryujinx.Audio.Renderer/Parameter/MemoryPoolOutStatus.cs +++ /dev/null @@ -1,39 +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 . -// - -using Ryujinx.Audio.Renderer.Common; -using System.Runtime.InteropServices; - -namespace Ryujinx.Audio.Renderer.Parameter -{ - /// - /// Output information for a memory pool. - /// - [StructLayout(LayoutKind.Sequential, Pack = 1)] - public struct MemoryPoolOutStatus - { - /// - /// The current server memory pool state. - /// - public MemoryPoolUserState State; - - /// - /// Reserved/unused. - /// - private unsafe fixed uint _reserved[3]; - } -} diff --git a/Ryujinx.Audio.Renderer/Parameter/MixInParameterDirtyOnlyUpdate.cs b/Ryujinx.Audio.Renderer/Parameter/MixInParameterDirtyOnlyUpdate.cs deleted file mode 100644 index cdbd5871..00000000 --- a/Ryujinx.Audio.Renderer/Parameter/MixInParameterDirtyOnlyUpdate.cs +++ /dev/null @@ -1,44 +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 . -// - -using System.Runtime.InteropServices; - -namespace Ryujinx.Audio.Renderer.Parameter -{ - /// - /// Input information header for mix updates on REV7 and later - /// - [StructLayout(LayoutKind.Sequential, Pack = 1)] - public struct MixInParameterDirtyOnlyUpdate - { - /// - /// Magic of the header - /// - /// Never checked on hardware. - public uint Magic; - - /// - /// The count of following this header. - /// - public uint MixCount; - - /// - /// Reserved/unused. - /// - private unsafe fixed byte _reserved[24]; - } -} diff --git a/Ryujinx.Audio.Renderer/Parameter/MixParameter.cs b/Ryujinx.Audio.Renderer/Parameter/MixParameter.cs deleted file mode 100644 index 7f45bca6..00000000 --- a/Ryujinx.Audio.Renderer/Parameter/MixParameter.cs +++ /dev/null @@ -1,112 +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 . -// - -using Ryujinx.Common.Utilities; -using System; -using System.Runtime.InteropServices; - -namespace Ryujinx.Audio.Renderer.Parameter -{ - /// - /// Input information for a mix. - /// - /// Also used on the client side for mix tracking. - [StructLayout(LayoutKind.Sequential, Pack = 1)] - public struct MixParameter - { - /// - /// Base volume of the mix. - /// - public float Volume; - - /// - /// Target sample rate of the mix. - /// - public uint SampleRate; - - /// - /// Target buffer count. - /// - public uint BufferCount; - - /// - /// Set to true if in use. - /// - [MarshalAs(UnmanagedType.I1)] - public bool IsUsed; - - /// - /// Set to true if it was changed. - /// - [MarshalAs(UnmanagedType.I1)] - public bool IsDirty; - - /// - /// Reserved/padding. - /// - private ushort _reserved1; - - /// - /// The id of the mix. - /// - public int MixId; - - /// - /// The effect count. (client side) - /// - public uint EffectCount; - - /// - /// The mix node id. - /// - public int NodeId; - - /// - /// Reserved/padding. - /// - private ulong _reserved2; - - /// - /// Mix buffer volumes storage. - /// - private MixVolumeArray _mixBufferVolumeArray; - - /// - /// The mix to output the result of this mix. - /// - public int DestinationMixId; - - /// - /// The splitter to output the result of this mix. - /// - public uint DestinationSplitterId; - - /// - /// Reserved/padding. - /// - private uint _reserved3; - - [StructLayout(LayoutKind.Sequential, Size = 4 * RendererConstants.MixBufferCountMax * RendererConstants.MixBufferCountMax, Pack = 1)] - private struct MixVolumeArray { } - - /// - /// Mix buffer volumes. - /// - /// Used when no splitter id is specified. - public Span MixBufferVolume => SpanHelpers.AsSpan(ref _mixBufferVolumeArray); - } -} diff --git a/Ryujinx.Audio.Renderer/Parameter/Performance/PerformanceInParameter.cs b/Ryujinx.Audio.Renderer/Parameter/Performance/PerformanceInParameter.cs deleted file mode 100644 index 929f006b..00000000 --- a/Ryujinx.Audio.Renderer/Parameter/Performance/PerformanceInParameter.cs +++ /dev/null @@ -1,38 +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 . -// - -using System.Runtime.InteropServices; - -namespace Ryujinx.Audio.Renderer.Parameter.Performance -{ - /// - /// Input information for performance monitoring. - /// - [StructLayout(LayoutKind.Sequential, Pack = 1)] - public struct PerformanceInParameter - { - /// - /// The target node id to monitor performance on. - /// - public int TargetNodeId; - - /// - /// Reserved/unused. - /// - private unsafe fixed uint _reserved[3]; - } -} diff --git a/Ryujinx.Audio.Renderer/Parameter/Performance/PerformanceOutStatus.cs b/Ryujinx.Audio.Renderer/Parameter/Performance/PerformanceOutStatus.cs deleted file mode 100644 index 9263362c..00000000 --- a/Ryujinx.Audio.Renderer/Parameter/Performance/PerformanceOutStatus.cs +++ /dev/null @@ -1,38 +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 . -// - -using System.Runtime.InteropServices; - -namespace Ryujinx.Audio.Renderer.Parameter.Performance -{ - /// - /// Output information for performance monitoring. - /// - [StructLayout(LayoutKind.Sequential, Pack = 1)] - public struct PerformanceOutStatus - { - /// - /// Indicates the total size output to the performance buffer. - /// - public uint HistorySize; - - /// - /// Reserved/unused. - /// - private unsafe fixed uint _reserved[3]; - } -} diff --git a/Ryujinx.Audio.Renderer/Parameter/RendererInfoOutStatus.cs b/Ryujinx.Audio.Renderer/Parameter/RendererInfoOutStatus.cs deleted file mode 100644 index 315f0968..00000000 --- a/Ryujinx.Audio.Renderer/Parameter/RendererInfoOutStatus.cs +++ /dev/null @@ -1,38 +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 . -// - -using System.Runtime.InteropServices; - -namespace Ryujinx.Audio.Renderer.Parameter -{ - /// - /// Renderer output information on REV5 and later. - /// - [StructLayout(LayoutKind.Sequential, Pack = 1)] - public struct RendererInfoOutStatus - { - /// - /// The count of updates sent to the . - /// - public ulong ElapsedFrameCount; - - /// - /// Reserved/Unused. - /// - private ulong _reserved; - } -} diff --git a/Ryujinx.Audio.Renderer/Parameter/Sink/CircularBufferParameter.cs b/Ryujinx.Audio.Renderer/Parameter/Sink/CircularBufferParameter.cs deleted file mode 100644 index d688529a..00000000 --- a/Ryujinx.Audio.Renderer/Parameter/Sink/CircularBufferParameter.cs +++ /dev/null @@ -1,78 +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 . -// - -using Ryujinx.Audio.Renderer.Common; -using Ryujinx.Common.Memory; -using System.Runtime.InteropServices; - -using CpuAddress = System.UInt64; - -namespace Ryujinx.Audio.Renderer.Parameter.Sink -{ - /// - /// for . - /// - [StructLayout(LayoutKind.Sequential, Pack = 1)] - public struct CircularBufferParameter - { - /// - /// The CPU address of the user circular buffer. - /// - public CpuAddress BufferAddress; - - /// - /// The size of the user circular buffer. - /// - public uint BufferSize; - - /// - /// The total count of channels to output to the circular buffer. - /// - public uint InputCount; - - /// - /// The target sample count to output per update in the circular buffer. - /// - public uint SampleCount; - - /// - /// Last read offset on the CPU side. - /// - public uint LastReadOffset; - - /// - /// The target . - /// - /// Only is supported. - public SampleFormat SampleFormat; - - /// - /// Reserved/padding. - /// - private unsafe fixed byte _reserved1[3]; - - /// - /// The input channels index that will be used. - /// - public Array6 Input; - - /// - /// Reserved/padding. - /// - private ushort _reserved2; - } -} diff --git a/Ryujinx.Audio.Renderer/Parameter/Sink/DeviceParameter.cs b/Ryujinx.Audio.Renderer/Parameter/Sink/DeviceParameter.cs deleted file mode 100644 index 591b4945..00000000 --- a/Ryujinx.Audio.Renderer/Parameter/Sink/DeviceParameter.cs +++ /dev/null @@ -1,75 +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 . -// - -using Ryujinx.Common.Memory; -using Ryujinx.Common.Utilities; -using System; -using System.Runtime.InteropServices; - -namespace Ryujinx.Audio.Renderer.Parameter.Sink -{ - /// - /// for . - /// - [StructLayout(LayoutKind.Sequential, Pack = 1)] - public struct DeviceParameter - { - /// - /// Device name storage. - /// - private DeviceNameStruct _deviceName; - - /// - /// Reserved/padding. - /// - private byte _padding; - - /// - /// The total count of channels to output to the device. - /// - public uint InputCount; - - /// - /// The input channels index that will be used. - /// - public Array6 Input; - - /// - /// Reserved/padding. - /// - private byte _reserved; - - /// - /// Set to true if the user controls Surround to Stereo downmixing coefficients. - /// - [MarshalAs(UnmanagedType.I1)] - public bool DownMixParameterEnabled; - - /// - /// The user Surround to Stereo downmixing coefficients. - /// - public Array4 DownMixParameter; - - [StructLayout(LayoutKind.Sequential, Size = 0xFF, Pack = 1)] - private struct DeviceNameStruct { } - - /// - /// The output device name. - /// - public Span DeviceName => SpanHelpers.AsSpan(ref _deviceName); - } -} diff --git a/Ryujinx.Audio.Renderer/Parameter/SinkInParameter.cs b/Ryujinx.Audio.Renderer/Parameter/SinkInParameter.cs deleted file mode 100644 index 0859ef31..00000000 --- a/Ryujinx.Audio.Renderer/Parameter/SinkInParameter.cs +++ /dev/null @@ -1,70 +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 . -// - -using Ryujinx.Audio.Renderer.Common; -using Ryujinx.Common.Utilities; -using System; -using System.Runtime.InteropServices; - -namespace Ryujinx.Audio.Renderer.Parameter -{ - /// - /// Input information for a sink. - /// - [StructLayout(LayoutKind.Sequential, Pack = 1)] - public struct SinkInParameter - { - /// - /// Type of the sink. - /// - public SinkType Type; - - /// - /// Set to true if the sink is used. - /// - [MarshalAs(UnmanagedType.I1)] - public bool IsUsed; - - /// - /// Reserved/padding. - /// - private ushort _reserved1; - - /// - /// The node id of the sink. - /// - public int NodeId; - - /// - /// Reserved/padding. - /// - private unsafe fixed ulong _reserved2[3]; - - /// - /// Specific data storage. - /// - private SpecificDataStruct _specificDataStart; - - [StructLayout(LayoutKind.Sequential, Size = 0x120, Pack = 1)] - private struct SpecificDataStruct { } - - /// - /// Specific data changing depending of the . See also the namespace. - /// - public Span SpecificData => SpanHelpers.AsSpan(ref _specificDataStart); - } -} diff --git a/Ryujinx.Audio.Renderer/Parameter/SinkOutStatus.cs b/Ryujinx.Audio.Renderer/Parameter/SinkOutStatus.cs deleted file mode 100644 index e0cb4942..00000000 --- a/Ryujinx.Audio.Renderer/Parameter/SinkOutStatus.cs +++ /dev/null @@ -1,43 +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 . -// - -using System.Runtime.InteropServices; - -namespace Ryujinx.Audio.Renderer.Parameter -{ - /// - /// Output information for a sink. - /// - [StructLayout(LayoutKind.Sequential, Pack = 1)] - public struct SinkOutStatus - { - /// - /// Last written offset if the sink type is . - /// - public uint LastWrittenOffset; - - /// - /// Reserved/padding. - /// - private uint _padding; - - /// - /// Reserved/padding. - /// - private unsafe fixed ulong _reserved[3]; - } -} diff --git a/Ryujinx.Audio.Renderer/Parameter/SplitterDestinationInParameter.cs b/Ryujinx.Audio.Renderer/Parameter/SplitterDestinationInParameter.cs deleted file mode 100644 index a1c18d57..00000000 --- a/Ryujinx.Audio.Renderer/Parameter/SplitterDestinationInParameter.cs +++ /dev/null @@ -1,84 +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 . -// - -using Ryujinx.Common.Utilities; -using System; -using System.Runtime.InteropServices; - -namespace Ryujinx.Audio.Renderer.Parameter -{ - /// - /// Input header for a splitter destination update. - /// - [StructLayout(LayoutKind.Sequential, Pack = 1)] - public struct SplitterDestinationInParameter - { - /// - /// Magic of the input header. - /// - public uint Magic; - - /// - /// Target splitter destination data id. - /// - public int Id; - - /// - /// Mix buffer volumes storage. - /// - private MixArray _mixBufferVolume; - - /// - /// The mix to output the result of the splitter. - /// - public int DestinationId; - - /// - /// Set to true if in use. - /// - [MarshalAs(UnmanagedType.I1)] - public bool IsUsed; - - /// - /// Reserved/padding. - /// - private unsafe fixed byte _reserved[3]; - - [StructLayout(LayoutKind.Sequential, Size = 4 * RendererConstants.MixBufferCountMax, Pack = 1)] - private struct MixArray { } - - /// - /// Mix buffer volumes. - /// - /// Used when a splitter id is specified in the mix. - public Span MixBufferVolume => SpanHelpers.AsSpan(ref _mixBufferVolume); - - /// - /// The expected constant of any input header. - /// - private const uint ValidMagic = 0x44444E53; - - /// - /// Check if the magic is valid. - /// - /// Returns true if the magic is valid. - public bool IsMagicValid() - { - return Magic == ValidMagic; - } - } -} diff --git a/Ryujinx.Audio.Renderer/Parameter/SplitterInParameter.cs b/Ryujinx.Audio.Renderer/Parameter/SplitterInParameter.cs deleted file mode 100644 index a829abf9..00000000 --- a/Ryujinx.Audio.Renderer/Parameter/SplitterInParameter.cs +++ /dev/null @@ -1,63 +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 . -// - -using System.Runtime.InteropServices; - -namespace Ryujinx.Audio.Renderer.Parameter -{ - /// - /// Input header for a splitter state update. - /// - [StructLayout(LayoutKind.Sequential, Pack = 1)] - public struct SplitterInParameter - { - /// - /// Magic of the input header. - /// - public uint Magic; - - /// - /// Target splitter id. - /// - public int Id; - - /// - /// Target sample rate to use on the splitter. - /// - public uint SampleRate; - - /// - /// Count of splitter destinations. - /// - /// Splitter destination ids are defined right after this header. - public int DestinationCount; - - /// - /// The expected constant of any input header. - /// - private const uint ValidMagic = 0x49444E53; - - /// - /// Check if the magic is valid. - /// - /// Returns true if the magic is valid. - public bool IsMagicValid() - { - return Magic == ValidMagic; - } - } -} diff --git a/Ryujinx.Audio.Renderer/Parameter/SplitterInParameterHeader.cs b/Ryujinx.Audio.Renderer/Parameter/SplitterInParameterHeader.cs deleted file mode 100644 index 746d59b7..00000000 --- a/Ryujinx.Audio.Renderer/Parameter/SplitterInParameterHeader.cs +++ /dev/null @@ -1,62 +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 . -// - -using System.Runtime.InteropServices; - -namespace Ryujinx.Audio.Renderer.Parameter -{ - /// - /// Input header for splitter update. - /// - [StructLayout(LayoutKind.Sequential, Pack = 1)] - public struct SplitterInParameterHeader - { - /// - /// Magic of the input header. - /// - public uint Magic; - - /// - /// The count of after the header. - /// - public uint SplitterCount; - - /// - /// The count of splitter destinations after the header and splitter info. - /// - public uint SplitterDestinationCount; - - /// - /// Reserved/unused. - /// - private unsafe fixed uint _reserved[5]; - - /// - /// The expected constant of any input splitter header. - /// - private const uint ValidMagic = 0x48444E53; - - /// - /// Check if the magic is valid. - /// - /// Returns true if the magic is valid. - public bool IsMagicValid() - { - return Magic == ValidMagic; - } - } -} diff --git a/Ryujinx.Audio.Renderer/Parameter/VoiceChannelResourceInParameter.cs b/Ryujinx.Audio.Renderer/Parameter/VoiceChannelResourceInParameter.cs deleted file mode 100644 index 73ad2bfd..00000000 --- a/Ryujinx.Audio.Renderer/Parameter/VoiceChannelResourceInParameter.cs +++ /dev/null @@ -1,45 +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 . -// - -using Ryujinx.Common.Memory; -using System.Runtime.InteropServices; - -namespace Ryujinx.Audio.Renderer.Parameter -{ - /// - /// Input information for a voice channel resources. - /// - [StructLayout(LayoutKind.Sequential, Size = 0x70, Pack = 1)] - public struct VoiceChannelResourceInParameter - { - /// - /// The id of the voice channel resource. - /// - public uint Id; - - /// - /// Mix volumes for the voice channel resource. - /// - public Array24 Mix; - - /// - /// Indicate if the voice channel resource is used. - /// - [MarshalAs(UnmanagedType.I1)] - public bool IsUsed; - } -} diff --git a/Ryujinx.Audio.Renderer/Parameter/VoiceInParameter.cs b/Ryujinx.Audio.Renderer/Parameter/VoiceInParameter.cs deleted file mode 100644 index 9a18a95a..00000000 --- a/Ryujinx.Audio.Renderer/Parameter/VoiceInParameter.cs +++ /dev/null @@ -1,360 +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 . -// - -using Ryujinx.Audio.Renderer.Common; -using Ryujinx.Audio.Renderer.Dsp; -using Ryujinx.Common.Memory; -using System; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -namespace Ryujinx.Audio.Renderer.Parameter -{ - /// - /// Input information for a voice. - /// - [StructLayout(LayoutKind.Sequential, Size = 0x170, Pack = 1)] - public struct VoiceInParameter - { - /// - /// Id of the voice. - /// - public int Id; - - /// - /// Node id of the voice. - /// - public int NodeId; - - /// - /// Set to true if the voice is new. - /// - [MarshalAs(UnmanagedType.I1)] - public bool IsNew; - - /// - /// Set to true if the voice is used. - /// - [MarshalAs(UnmanagedType.I1)] - public bool InUse; - - /// - /// The voice wanted by the user. - /// - public PlayState PlayState; - - /// - /// The of the voice. - /// - public SampleFormat SampleFormat; - - /// - /// The sample rate of the voice. - /// - public uint SampleRate; - - /// - /// The priority of the voice. - /// - public uint Priority; - - /// - /// Target sorting position of the voice. (Used to sort voices with the same ) - /// - public uint SortingOrder; - - /// - /// The total channel count used. - /// - public uint ChannelCount; - - /// - /// The pitch used on the voice. - /// - public float Pitch; - - /// - /// The output volume of the voice. - /// - public float Volume; - - /// - /// Biquad filters to apply to the output of the voice. - /// - public Array2 BiquadFilters; - - /// - /// Total count of of the voice. - /// - public uint WaveBuffersCount; - - /// - /// Current playing of the voice. - /// - public uint WaveBuffersIndex; - - /// - /// Reserved/unused. - /// - private uint _reserved1; - - /// - /// User state address required by the data source. - /// - /// Only used for as the address of the GC-ADPCM coefficients. - public ulong DataSourceStateAddress; - - /// - /// User state size required by the data source. - /// - /// Only used for as the size of the GC-ADPCM coefficients. - public ulong DataSourceStateSize; - - /// - /// The target mix id of the voice. - /// - public int MixId; - - /// - /// The target splitter id of the voice. - /// - public uint SplitterId; - - /// - /// The wavebuffer parameters of this voice. - /// - public Array4 WaveBuffers; - - /// - /// The channel resource ids associated to the voice. - /// - public Array6 ChannelResourceIds; - - /// - /// Reset the voice drop flag during voice server update. - /// - [MarshalAs(UnmanagedType.I1)] - public bool ResetVoiceDropFlag; - - /// - /// Flush the amount of wavebuffer specified. This will result in the wavebuffer being skipped and marked played. - /// - /// This was added on REV5. - public byte FlushWaveBufferCount; - - /// - /// Reserved/unused. - /// - private ushort _reserved2; - - /// - /// Change the behaviour of the voice. - /// - /// This was added on REV5. - public DecodingBehaviour DecodingBehaviourFlags; - - /// - /// Change the Sample Rate Conversion (SRC) quality of the voice. - /// - /// This was added on REV8. - public SampleRateConversionQuality SrcQuality; - - /// - /// This was previously used for opus codec support on the Audio Renderer and was removed on REV3. - /// - public uint ExternalContext; - - /// - /// This was previously used for opus codec support on the Audio Renderer and was removed on REV3. - /// - public uint ExternalContextSize; - - /// - /// Reserved/unused. - /// - private unsafe fixed uint _reserved3[2]; - - /// - /// Input information for a voice wavebuffer. - /// - [StructLayout(LayoutKind.Sequential, Size = 0x38, Pack = 1)] - public struct WaveBufferInternal - { - /// - /// Address of the wavebuffer data. - /// - public ulong Address; - - /// - /// Size of the wavebuffer data. - /// - public ulong Size; - - /// - /// Offset of the first sample to play. - /// - public uint StartSampleOffset; - - /// - /// Offset of the last sample to play. - /// - public uint EndSampleOffset; - - /// - /// If set to true, the wavebuffer will loop when reaching . - /// - /// - /// Starting with REV8, you can specify how many times to loop the wavebuffer () and where it should start and end when looping ( and ) - /// - [MarshalAs(UnmanagedType.I1)] - public bool ShouldLoop; - - /// - /// Indicates that this is the last wavebuffer to play of the voice. - /// - [MarshalAs(UnmanagedType.I1)] - public bool IsEndOfStream; - - /// - /// Indicates if the server should update its internal state. - /// - [MarshalAs(UnmanagedType.I1)] - public bool SentToServer; - - /// - /// Reserved/unused. - /// - private byte _reserved; - - /// - /// If set to anything other than 0, specifies how many times to loop the wavebuffer. - /// - /// This was added in REV8. - public int LoopCount; - - /// - /// Address of the context used by the sample decoder. - /// - /// This is only currently used by . - public ulong ContextAddress; - - /// - /// Size of the context used by the sample decoder. - /// - /// This is only currently used by . - public ulong ContextSize; - - /// - /// If set to anything other than 0, specifies the offset of the first sample to play when looping. - /// - /// This was added in REV8. - public uint LoopFirstSampleOffset; - - /// - /// If set to anything other than 0, specifies the offset of the last sample to play when looping. - /// - /// This was added in REV8. - public uint LoopLastSampleOffset; - - /// - /// Check if the sample offsets are in a valid range for generic PCM. - /// - /// The PCM sample type - /// Returns true if the sample offset are in range of the size. - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private bool IsSampleOffsetInRangeForPcm() where T : unmanaged - { - uint dataTypeSize = (uint)Unsafe.SizeOf(); - - return StartSampleOffset * dataTypeSize <= Size && - EndSampleOffset * dataTypeSize <= Size; - } - - /// - /// Check if the sample offsets are in a valid range for the given . - /// - /// The target - /// Returns true if the sample offset are in range of the size. - public bool IsSampleOffsetValid(SampleFormat format) - { - bool result; - - switch (format) - { - case SampleFormat.PcmInt16: - result = IsSampleOffsetInRangeForPcm(); - break; - case SampleFormat.PcmFloat: - result = IsSampleOffsetInRangeForPcm(); - break; - case SampleFormat.Adpcm: - result = AdpcmHelper.GetAdpcmDataSize((int)StartSampleOffset) <= Size && - AdpcmHelper.GetAdpcmDataSize((int)EndSampleOffset) <= Size; - break; - default: - throw new NotImplementedException($"{format} not implemented!"); - } - - return result; - } - } - - /// - /// Flag altering the behaviour of wavebuffer decoding. - /// - [Flags] - public enum DecodingBehaviour : ushort - { - /// - /// Default decoding behaviour. - /// - Default = 0, - - /// - /// Reset the played samples accumulator when looping. - /// - PlayedSampleCountResetWhenLooping = 1, - - /// - /// Skip pitch and Sample Rate Conversion (SRC). - /// - SkipPitchAndSampleRateConversion = 2 - } - - /// - /// Specify the quality to use during Sample Rate Conversion (SRC) and pitch handling. - /// - /// This was added in REV8. - public enum SampleRateConversionQuality : byte - { - /// - /// Resample interpolating 4 samples per output sample. - /// - Default, - - /// - /// Resample interpolating 8 samples per output sample. - /// - High, - - /// - /// Resample interpolating 1 samples per output sample. - /// - Low - } - } -} diff --git a/Ryujinx.Audio.Renderer/Parameter/VoiceOutStatus.cs b/Ryujinx.Audio.Renderer/Parameter/VoiceOutStatus.cs deleted file mode 100644 index 62d17a5a..00000000 --- a/Ryujinx.Audio.Renderer/Parameter/VoiceOutStatus.cs +++ /dev/null @@ -1,52 +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 . -// - -using System.Runtime.InteropServices; - -namespace Ryujinx.Audio.Renderer.Parameter -{ - /// - /// Output information about a voice. - /// - /// See - [StructLayout(LayoutKind.Sequential, Pack = 1)] - public struct VoiceOutStatus - { - /// - /// The total amount of samples that was played. - /// - /// This is reset to 0 when a finishes playing and is set. - /// This is reset to 0 when looping while is set. - public ulong PlayedSampleCount; - - /// - /// The total amount of consumed. - /// - public uint PlayedWaveBuffersCount; - - /// - /// If set to true, the voice was dropped. - /// - [MarshalAs(UnmanagedType.I1)] - public bool VoiceDropFlag; - - /// - /// Reserved/unused. - /// - private unsafe fixed byte _reserved[3]; - } -} -- cgit v1.2.3