LimiterParameter.cs 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. using Ryujinx.Audio.Renderer.Server.Effect;
  2. using Ryujinx.Common.Memory;
  3. using System.Runtime.InteropServices;
  4. namespace Ryujinx.Audio.Renderer.Parameter.Effect
  5. {
  6. /// <summary>
  7. /// <see cref="IEffectInParameter.SpecificData"/> for <see cref="Common.EffectType.Limiter"/>.
  8. /// </summary>
  9. [StructLayout(LayoutKind.Sequential, Pack = 1)]
  10. public struct LimiterParameter
  11. {
  12. /// <summary>
  13. /// The input channel indices that will be used by the <see cref="Dsp.AudioProcessor"/>.
  14. /// </summary>
  15. public Array6<byte> Input;
  16. /// <summary>
  17. /// The output channel indices that will be used by the <see cref="Dsp.AudioProcessor"/>.
  18. /// </summary>
  19. public Array6<byte> Output;
  20. /// <summary>
  21. /// The maximum number of channels supported.
  22. /// </summary>
  23. public ushort ChannelCountMax;
  24. /// <summary>
  25. /// The total channel count used.
  26. /// </summary>
  27. public ushort ChannelCount;
  28. /// <summary>
  29. /// The target sample rate.
  30. /// </summary>
  31. /// <remarks>This is in kHz.</remarks>
  32. public int SampleRate;
  33. /// <summary>
  34. /// The look ahead max time.
  35. /// <remarks>This is in microseconds.</remarks>
  36. /// </summary>
  37. public int LookAheadTimeMax;
  38. /// <summary>
  39. /// The attack time.
  40. /// <remarks>This is in microseconds.</remarks>
  41. /// </summary>
  42. public int AttackTime;
  43. /// <summary>
  44. /// The release time.
  45. /// <remarks>This is in microseconds.</remarks>
  46. /// </summary>
  47. public int ReleaseTime;
  48. /// <summary>
  49. /// The look ahead time.
  50. /// <remarks>This is in microseconds.</remarks>
  51. /// </summary>
  52. public int LookAheadTime;
  53. /// <summary>
  54. /// The attack coefficient.
  55. /// </summary>
  56. public float AttackCoefficient;
  57. /// <summary>
  58. /// The release coefficient.
  59. /// </summary>
  60. public float ReleaseCoefficient;
  61. /// <summary>
  62. /// The threshold.
  63. /// </summary>
  64. public float Threshold;
  65. /// <summary>
  66. /// The input gain.
  67. /// </summary>
  68. public float InputGain;
  69. /// <summary>
  70. /// The output gain.
  71. /// </summary>
  72. public float OutputGain;
  73. /// <summary>
  74. /// The minimum samples stored in the delay buffer.
  75. /// </summary>
  76. public int DelayBufferSampleCountMin;
  77. /// <summary>
  78. /// The maximum samples stored in the delay buffer.
  79. /// </summary>
  80. public int DelayBufferSampleCountMax;
  81. /// <summary>
  82. /// The current usage status of the effect on the client side.
  83. /// </summary>
  84. public UsageState Status;
  85. /// <summary>
  86. /// Indicate if the limiter effect should output statistics.
  87. /// </summary>
  88. [MarshalAs(UnmanagedType.I1)]
  89. public bool StatisticsEnabled;
  90. /// <summary>
  91. /// Indicate to the DSP that the user did a statistics reset.
  92. /// </summary>
  93. [MarshalAs(UnmanagedType.I1)]
  94. public bool StatisticsReset;
  95. /// <summary>
  96. /// Reserved/padding.
  97. /// </summary>
  98. private byte _reserved;
  99. /// <summary>
  100. /// Check if the <see cref="ChannelCount"/> is valid.
  101. /// </summary>
  102. /// <returns>Returns true if the <see cref="ChannelCount"/> is valid.</returns>
  103. public bool IsChannelCountValid()
  104. {
  105. return EffectInParameterVersion1.IsChannelCountValid(ChannelCount);
  106. }
  107. /// <summary>
  108. /// Check if the <see cref="ChannelCountMax"/> is valid.
  109. /// </summary>
  110. /// <returns>Returns true if the <see cref="ChannelCountMax"/> is valid.</returns>
  111. public bool IsChannelCountMaxValid()
  112. {
  113. return EffectInParameterVersion1.IsChannelCountValid(ChannelCountMax);
  114. }
  115. }
  116. }