diff options
| author | gdkchan <gab.dark.100@gmail.com> | 2024-10-01 07:30:57 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-01 11:30:57 +0100 |
| commit | a2c003501371463fd1f98d2e5a7602ae19c21d7c (patch) | |
| tree | 3943fb3d7396e4db9bb9758787533ede381d2f2e /src/Ryujinx.Audio/Renderer/Parameter/Effect | |
| parent | 7d158acc3b5826a08941d6e8d50d3a3897021bcd (diff) | |
Update audio renderer to REV13: Add support for compressor statistics and volume reset (#7372)HEADmaster
* Update audio renderer to REV13: Add support for compressor statistics and volume reset
* XML docs
* Disable stats reset
* Wrong comment
* Fix more XML docs
* PR feedback
Diffstat (limited to 'src/Ryujinx.Audio/Renderer/Parameter/Effect')
| -rw-r--r-- | src/Ryujinx.Audio/Renderer/Parameter/Effect/CompressorParameter.cs | 11 | ||||
| -rw-r--r-- | src/Ryujinx.Audio/Renderer/Parameter/Effect/CompressorStatistics.cs | 38 |
2 files changed, 47 insertions, 2 deletions
diff --git a/src/Ryujinx.Audio/Renderer/Parameter/Effect/CompressorParameter.cs b/src/Ryujinx.Audio/Renderer/Parameter/Effect/CompressorParameter.cs index b403f137..c00118e4 100644 --- a/src/Ryujinx.Audio/Renderer/Parameter/Effect/CompressorParameter.cs +++ b/src/Ryujinx.Audio/Renderer/Parameter/Effect/CompressorParameter.cs @@ -90,9 +90,16 @@ namespace Ryujinx.Audio.Renderer.Parameter.Effect public bool MakeupGainEnabled; /// <summary> - /// Reserved/padding. + /// Indicate if the compressor effect should output statistics. /// </summary> - private Array2<byte> _reserved; + [MarshalAs(UnmanagedType.I1)] + public bool StatisticsEnabled; + + /// <summary> + /// Indicate to the DSP that the user did a statistics reset. + /// </summary> + [MarshalAs(UnmanagedType.I1)] + public bool StatisticsReset; /// <summary> /// Check if the <see cref="ChannelCount"/> is valid. diff --git a/src/Ryujinx.Audio/Renderer/Parameter/Effect/CompressorStatistics.cs b/src/Ryujinx.Audio/Renderer/Parameter/Effect/CompressorStatistics.cs new file mode 100644 index 00000000..65335e2d --- /dev/null +++ b/src/Ryujinx.Audio/Renderer/Parameter/Effect/CompressorStatistics.cs @@ -0,0 +1,38 @@ +using Ryujinx.Common.Memory; +using System.Runtime.InteropServices; + +namespace Ryujinx.Audio.Renderer.Parameter.Effect +{ + /// <summary> + /// Effect result state for <seealso cref="Common.EffectType.Compressor"/>. + /// </summary> + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct CompressorStatistics + { + /// <summary> + /// Maximum input mean value since last reset. + /// </summary> + public float MaximumMean; + + /// <summary> + /// Minimum output gain since last reset. + /// </summary> + public float MinimumGain; + + /// <summary> + /// Last processed input sample, per channel. + /// </summary> + public Array6<float> LastSamples; + + /// <summary> + /// Reset the statistics. + /// </summary> + /// <param name="channelCount">Number of channels to reset.</param> + public void Reset(ushort channelCount) + { + MaximumMean = 0.0f; + MinimumGain = 1.0f; + LastSamples.AsSpan()[..channelCount].Clear(); + } + } +} |
