EffectInParameterVersion2.cs 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. using Ryujinx.Audio.Renderer.Common;
  2. using Ryujinx.Common.Utilities;
  3. using System;
  4. using System.Runtime.InteropServices;
  5. namespace Ryujinx.Audio.Renderer.Parameter
  6. {
  7. /// <summary>
  8. /// Input information for an effect version 2. (added with REV9)
  9. /// </summary>
  10. [StructLayout(LayoutKind.Sequential, Pack = 1)]
  11. public struct EffectInParameterVersion2 : IEffectInParameter
  12. {
  13. /// <summary>
  14. /// Type of the effect.
  15. /// </summary>
  16. public EffectType Type;
  17. /// <summary>
  18. /// Set to true if the effect is new.
  19. /// </summary>
  20. [MarshalAs(UnmanagedType.I1)]
  21. public bool IsNew;
  22. /// <summary>
  23. /// Set to true if the effect must be active.
  24. /// </summary>
  25. [MarshalAs(UnmanagedType.I1)]
  26. public bool IsEnabled;
  27. /// <summary>
  28. /// Reserved/padding.
  29. /// </summary>
  30. private byte _reserved1;
  31. /// <summary>
  32. /// The target mix id of the effect.
  33. /// </summary>
  34. public int MixId;
  35. /// <summary>
  36. /// Address of the processing workbuffer.
  37. /// </summary>
  38. /// <remarks>This is additional data that could be required by the effect processing.</remarks>
  39. public ulong BufferBase;
  40. /// <summary>
  41. /// Size of the processing workbuffer.
  42. /// </summary>
  43. /// <remarks>This is additional data that could be required by the effect processing.</remarks>
  44. public ulong BufferSize;
  45. /// <summary>
  46. /// Position of the effect while processing effects.
  47. /// </summary>
  48. public uint ProcessingOrder;
  49. /// <summary>
  50. /// Reserved/padding.
  51. /// </summary>
  52. private uint _reserved2;
  53. /// <summary>
  54. /// Specific data storage.
  55. /// </summary>
  56. private SpecificDataStruct _specificDataStart;
  57. [StructLayout(LayoutKind.Sequential, Size = 0xA0, Pack = 1)]
  58. private struct SpecificDataStruct { }
  59. public Span<byte> SpecificData => SpanHelpers.AsSpan<SpecificDataStruct, byte>(ref _specificDataStart);
  60. EffectType IEffectInParameter.Type => Type;
  61. bool IEffectInParameter.IsNew => IsNew;
  62. bool IEffectInParameter.IsEnabled => IsEnabled;
  63. int IEffectInParameter.MixId => MixId;
  64. ulong IEffectInParameter.BufferBase => BufferBase;
  65. ulong IEffectInParameter.BufferSize => BufferSize;
  66. uint IEffectInParameter.ProcessingOrder => ProcessingOrder;
  67. /// <summary>
  68. /// Check if the given channel count is valid.
  69. /// </summary>
  70. /// <param name="channelCount">The channel count to check</param>
  71. /// <returns>Returns true if the channel count is valid.</returns>
  72. public static bool IsChannelCountValid(int channelCount)
  73. {
  74. return channelCount == 1 || channelCount == 2 || channelCount == 4 || channelCount == 6;
  75. }
  76. }
  77. }