aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Audio/Renderer/Parameter/Effect
diff options
context:
space:
mode:
Diffstat (limited to 'src/Ryujinx.Audio/Renderer/Parameter/Effect')
-rw-r--r--src/Ryujinx.Audio/Renderer/Parameter/Effect/CompressorParameter.cs11
-rw-r--r--src/Ryujinx.Audio/Renderer/Parameter/Effect/CompressorStatistics.cs38
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();
+ }
+ }
+}