CompressorParameter.cs 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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.Compressor"/>.
  8. /// </summary>
  9. [StructLayout(LayoutKind.Sequential, Pack = 1)]
  10. public struct CompressorParameter
  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 threshold.
  35. /// </summary>
  36. public float Threshold;
  37. /// <summary>
  38. /// The compressor ratio.
  39. /// </summary>
  40. public float Ratio;
  41. /// <summary>
  42. /// The attack time.
  43. /// <remarks>This is in microseconds.</remarks>
  44. /// </summary>
  45. public int AttackTime;
  46. /// <summary>
  47. /// The release time.
  48. /// <remarks>This is in microseconds.</remarks>
  49. /// </summary>
  50. public int ReleaseTime;
  51. /// <summary>
  52. /// The input gain.
  53. /// </summary>
  54. public float InputGain;
  55. /// <summary>
  56. /// The attack coefficient.
  57. /// </summary>
  58. public float AttackCoefficient;
  59. /// <summary>
  60. /// The release coefficient.
  61. /// </summary>
  62. public float ReleaseCoefficient;
  63. /// <summary>
  64. /// The output gain.
  65. /// </summary>
  66. public float OutputGain;
  67. /// <summary>
  68. /// The current usage status of the effect on the client side.
  69. /// </summary>
  70. public UsageState Status;
  71. /// <summary>
  72. /// Indicate if the makeup gain should be used.
  73. /// </summary>
  74. [MarshalAs(UnmanagedType.I1)]
  75. public bool MakeupGainEnabled;
  76. /// <summary>
  77. /// Reserved/padding.
  78. /// </summary>
  79. private Array2<byte> _reserved;
  80. /// <summary>
  81. /// Check if the <see cref="ChannelCount"/> is valid.
  82. /// </summary>
  83. /// <returns>Returns true if the <see cref="ChannelCount"/> is valid.</returns>
  84. public bool IsChannelCountValid()
  85. {
  86. return EffectInParameterVersion1.IsChannelCountValid(ChannelCount);
  87. }
  88. /// <summary>
  89. /// Check if the <see cref="ChannelCountMax"/> is valid.
  90. /// </summary>
  91. /// <returns>Returns true if the <see cref="ChannelCountMax"/> is valid.</returns>
  92. public bool IsChannelCountMaxValid()
  93. {
  94. return EffectInParameterVersion1.IsChannelCountValid(ChannelCountMax);
  95. }
  96. }
  97. }