Reverb3dParameter.cs 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. //
  2. // Copyright (c) 2019-2021 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.Server.Effect;
  18. using Ryujinx.Common.Memory;
  19. using System.Runtime.InteropServices;
  20. namespace Ryujinx.Audio.Renderer.Parameter.Effect
  21. {
  22. /// <summary>
  23. /// <see cref="IEffectInParameter.SpecificData"/> for <see cref="Common.EffectType.Reverb3d"/>.
  24. /// </summary>
  25. [StructLayout(LayoutKind.Sequential, Pack = 1)]
  26. public struct Reverb3dParameter
  27. {
  28. /// <summary>
  29. /// The input channel indices that will be used by the <see cref="Dsp.AudioProcessor"/>.
  30. /// </summary>
  31. public Array6<byte> Input;
  32. /// <summary>
  33. /// The output channel indices that will be used by the <see cref="Dsp.AudioProcessor"/>.
  34. /// </summary>
  35. public Array6<byte> Output;
  36. /// <summary>
  37. /// The maximum number of channels supported.
  38. /// </summary>
  39. public ushort ChannelCountMax;
  40. /// <summary>
  41. /// The total channel count used.
  42. /// </summary>
  43. public ushort ChannelCount;
  44. /// <summary>
  45. /// Reserved/unused.
  46. /// </summary>
  47. private uint _reserved;
  48. /// <summary>
  49. /// The target sample rate.
  50. /// </summary>
  51. /// <remarks>This is in kHz.</remarks>
  52. public uint SampleRate;
  53. /// <summary>
  54. /// Gain of the room high-frequency effect.
  55. /// </summary>
  56. public float RoomHf;
  57. /// <summary>
  58. /// Reference high frequency.
  59. /// </summary>
  60. public float HfReference;
  61. /// <summary>
  62. /// Reverberation decay time at low frequencies.
  63. /// </summary>
  64. public float DecayTime;
  65. /// <summary>
  66. /// Ratio of the decay time at high frequencies to the decay time at low frequencies.
  67. /// </summary>
  68. public float HfDecayRatio;
  69. /// <summary>
  70. /// Gain of the room effect.
  71. /// </summary>
  72. public float RoomGain;
  73. /// <summary>
  74. /// Gain of the early reflections relative to <see cref="RoomGain"/>.
  75. /// </summary>
  76. public float ReflectionsGain;
  77. /// <summary>
  78. /// Gain of the late reverberation relative to <see cref="RoomGain"/>.
  79. /// </summary>
  80. public float ReverbGain;
  81. /// <summary>
  82. /// Echo density in the late reverberation decay.
  83. /// </summary>
  84. public float Diffusion;
  85. /// <summary>
  86. /// Modal density in the late reverberation decay.
  87. /// </summary>
  88. public float ReflectionDelay;
  89. /// <summary>
  90. /// Time limit between the early reflections and the late reverberation relative to the time of the first reflection.
  91. /// </summary>
  92. public float ReverbDelayTime;
  93. /// <summary>
  94. /// Modal density in the late reverberation decay.
  95. /// </summary>
  96. public float Density;
  97. /// <summary>
  98. /// The dry gain.
  99. /// </summary>
  100. public float DryGain;
  101. /// <summary>
  102. /// The current usage status of the effect on the client side.
  103. /// </summary>
  104. public UsageState ParameterStatus;
  105. /// <summary>
  106. /// Check if the <see cref="ChannelCount"/> is valid.
  107. /// </summary>
  108. /// <returns>Returns true if the <see cref="ChannelCount"/> is valid.</returns>
  109. public bool IsChannelCountValid()
  110. {
  111. return EffectInParameterVersion1.IsChannelCountValid(ChannelCount);
  112. }
  113. /// <summary>
  114. /// Check if the <see cref="ChannelCountMax"/> is valid.
  115. /// </summary>
  116. /// <returns>Returns true if the <see cref="ChannelCountMax"/> is valid.</returns>
  117. public bool IsChannelCountMaxValid()
  118. {
  119. return EffectInParameterVersion1.IsChannelCountValid(ChannelCountMax);
  120. }
  121. }
  122. }