DelayParameter.cs 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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.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="EffectInParameter.SpecificData"/> for <see cref="Common.EffectType.Delay"/>.
  24. /// </summary>
  25. [StructLayout(LayoutKind.Sequential, Pack = 1)]
  26. public struct DelayParameter
  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. /// The maximum delay time in milliseconds.
  46. /// </summary>
  47. public uint DelayTimeMax;
  48. /// <summary>
  49. /// The delay time in milliseconds.
  50. /// </summary>
  51. public uint DelayTime;
  52. /// <summary>
  53. /// The target sample rate. (Q15)
  54. /// </summary>
  55. public uint SampleRate;
  56. /// <summary>
  57. /// The input gain. (Q15)
  58. /// </summary>
  59. public uint InGain;
  60. /// <summary>
  61. /// The feedback gain. (Q15)
  62. /// </summary>
  63. public uint FeedbackGain;
  64. /// <summary>
  65. /// The output gain. (Q15)
  66. /// </summary>
  67. public uint OutGain;
  68. /// <summary>
  69. /// The dry gain. (Q15)
  70. /// </summary>
  71. public uint DryGain;
  72. /// <summary>
  73. /// The channel spread of the <see cref="FeedbackGain"/>. (Q15)
  74. /// </summary>
  75. public uint ChannelSpread;
  76. /// <summary>
  77. /// The low pass amount. (Q15)
  78. /// </summary>
  79. public uint LowPassAmount;
  80. /// <summary>
  81. /// The current usage status of the effect on the client side.
  82. /// </summary>
  83. public UsageState Status;
  84. /// <summary>
  85. /// Check if the <see cref="ChannelCount"/> is valid.
  86. /// </summary>
  87. /// <returns>Returns true if the <see cref="ChannelCount"/> is valid.</returns>
  88. public bool IsChannelCountValid()
  89. {
  90. return EffectInParameter.IsChannelCountValid(ChannelCount);
  91. }
  92. /// <summary>
  93. /// Check if the <see cref="ChannelCountMax"/> is valid.
  94. /// </summary>
  95. /// <returns>Returns true if the <see cref="ChannelCountMax"/> is valid.</returns>
  96. public bool IsChannelCountMaxValid()
  97. {
  98. return EffectInParameter.IsChannelCountValid(ChannelCountMax);
  99. }
  100. }
  101. }