ReverbParameter.cs 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. //
  2. // Copyright (c) 2019-2020 Ryujinx
  3. //
  4. // This program is free software: you can redistribute it and/or modify
  5. // it under the terms of the GNU Lesser General Public License as published by
  6. // the Free Software Foundation, either version 3 of the License, or
  7. // (at your option) any later version.
  8. //
  9. // This program is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. // GNU Lesser General Public License for more details.
  13. //
  14. // You should have received a copy of the GNU Lesser General Public License
  15. // along with this program. If not, see <https://www.gnu.org/licenses/>.
  16. //
  17. using Ryujinx.Audio.Renderer.Common;
  18. using Ryujinx.Audio.Renderer.Server.Effect;
  19. using Ryujinx.Common.Memory;
  20. using System.Runtime.InteropServices;
  21. namespace Ryujinx.Audio.Renderer.Parameter.Effect
  22. {
  23. /// <summary>
  24. /// <see cref="EffectInParameter.SpecificData"/> for <see cref="Common.EffectType.Reverb"/>.
  25. /// </summary>
  26. [StructLayout(LayoutKind.Sequential, Pack = 1)]
  27. public struct ReverbParameter
  28. {
  29. /// <summary>
  30. /// The input channel indices that will be used by the <see cref="Dsp.AudioProcessor"/>.
  31. /// </summary>
  32. public Array6<byte> Input;
  33. /// <summary>
  34. /// The output channel indices that will be used by the <see cref="Dsp.AudioProcessor"/>.
  35. /// </summary>
  36. public Array6<byte> Output;
  37. /// <summary>
  38. /// The maximum number of channels supported.
  39. /// </summary>
  40. public ushort ChannelCountMax;
  41. /// <summary>
  42. /// The total channel count used.
  43. /// </summary>
  44. public ushort ChannelCount;
  45. /// <summary>
  46. /// The target sample rate. (Q15)
  47. /// </summary>
  48. /// <remarks>This is in kHz.</remarks>
  49. public int SampleRate;
  50. /// <summary>
  51. /// The early mode to use.
  52. /// </summary>
  53. public ReverbEarlyMode EarlyMode;
  54. /// <summary>
  55. /// The gain to apply to the result of the early reflection. (Q15)
  56. /// </summary>
  57. public int EarlyGain;
  58. /// <summary>
  59. /// The pre-delay time in milliseconds. (Q15)
  60. /// </summary>
  61. public int PreDelayTime;
  62. /// <summary>
  63. /// The late mode to use.
  64. /// </summary>
  65. public ReverbLateMode LateMode;
  66. /// <summary>
  67. /// The gain to apply to the result of the late reflection. (Q15)
  68. /// </summary>
  69. public int LateGain;
  70. /// <summary>
  71. /// The decay time. (Q15)
  72. /// </summary>
  73. public int DecayTime;
  74. /// <summary>
  75. /// The high frequency decay ratio. (Q15)
  76. /// </summary>
  77. /// <remarks>If <see cref="HighFrequencyDecayRatio"/> >= 0.995f, it is considered disabled.</remarks>
  78. public int HighFrequencyDecayRatio;
  79. /// <summary>
  80. /// The coloration of the decay. (Q15)
  81. /// </summary>
  82. public int Coloration;
  83. /// <summary>
  84. /// The reverb gain. (Q15)
  85. /// </summary>
  86. public int ReverbGain;
  87. /// <summary>
  88. /// The output gain. (Q15)
  89. /// </summary>
  90. public int OutGain;
  91. /// <summary>
  92. /// The dry gain. (Q15)
  93. /// </summary>
  94. public int DryGain;
  95. /// <summary>
  96. /// The current usage status of the effect on the client side.
  97. /// </summary>
  98. public UsageState Status;
  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 EffectInParameter.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 EffectInParameter.IsChannelCountValid(ChannelCountMax);
  114. }
  115. }
  116. }