WaveBuffer.cs 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. using System.Runtime.InteropServices;
  2. using DspAddr = System.UInt64;
  3. namespace Ryujinx.Audio.Renderer.Common
  4. {
  5. /// <summary>
  6. /// A wavebuffer used for data source commands.
  7. /// </summary>
  8. [StructLayout(LayoutKind.Sequential, Pack = 1)]
  9. public struct WaveBuffer
  10. {
  11. /// <summary>
  12. /// The DSP address of the sample data of the wavebuffer.
  13. /// </summary>
  14. public DspAddr Buffer;
  15. /// <summary>
  16. /// The DSP address of the context of the wavebuffer.
  17. /// </summary>
  18. /// <remarks>Only used by <see cref="SampleFormat.Adpcm"/>.</remarks>
  19. public DspAddr Context;
  20. /// <summary>
  21. /// The size of the sample buffer data.
  22. /// </summary>
  23. public uint BufferSize;
  24. /// <summary>
  25. /// The size of the context buffer.
  26. /// </summary>
  27. public uint ContextSize;
  28. /// <summary>
  29. /// First sample to play on the wavebuffer.
  30. /// </summary>
  31. public uint StartSampleOffset;
  32. /// <summary>
  33. /// Last sample to play on the wavebuffer.
  34. /// </summary>
  35. public uint EndSampleOffset;
  36. /// <summary>
  37. /// First sample to play when looping the wavebuffer.
  38. /// </summary>
  39. /// <remarks>
  40. /// If <see cref="LoopStartSampleOffset"/> or <see cref="LoopEndSampleOffset"/> is equal to zero,, it will default to <see cref="StartSampleOffset"/> and <see cref="EndSampleOffset"/>.
  41. /// </remarks>
  42. public uint LoopStartSampleOffset;
  43. /// <summary>
  44. /// Last sample to play when looping the wavebuffer.
  45. /// </summary>
  46. /// <remarks>
  47. /// If <see cref="LoopStartSampleOffset"/> or <see cref="LoopEndSampleOffset"/> is equal to zero, it will default to <see cref="StartSampleOffset"/> and <see cref="EndSampleOffset"/>.
  48. /// </remarks>
  49. public uint LoopEndSampleOffset;
  50. /// <summary>
  51. /// The max loop count.
  52. /// </summary>
  53. public int LoopCount;
  54. /// <summary>
  55. /// Set to true if the wavebuffer is looping.
  56. /// </summary>
  57. [MarshalAs(UnmanagedType.I1)]
  58. public bool Looping;
  59. /// <summary>
  60. /// Set to true if the wavebuffer is the end of stream.
  61. /// </summary>
  62. [MarshalAs(UnmanagedType.I1)]
  63. public bool IsEndOfStream;
  64. /// <summary>
  65. /// Padding/Reserved.
  66. /// </summary>
  67. private ushort _padding;
  68. }
  69. }