WAVEFORMATEXTENSIBLE.cs 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. // -----------------------------------------
  2. // SoundScribe (TM) and related software.
  3. //
  4. // Copyright (C) 2007-2011 Vannatech
  5. // http://www.vannatech.com
  6. // All rights reserved.
  7. //
  8. // This source code is subject to the MIT License.
  9. // http://www.opensource.org/licenses/mit-license.php
  10. //
  11. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  12. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  13. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  14. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  15. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  16. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  17. // THE SOFTWARE.
  18. // -----------------------------------------
  19. using System;
  20. using System.Runtime.InteropServices;
  21. namespace CoreAudioTests.Common
  22. {
  23. /// <summary>
  24. /// Defines the format of waveform-audio data for formats having more than two channels.
  25. /// </summary>
  26. /// <remarks>
  27. /// MSDN Reference: http://msdn.microsoft.com/en-us/library/dd757721.aspx
  28. /// </remarks>
  29. [StructLayout(LayoutKind.Explicit)]
  30. public struct WAVEFORMATEXTENSIBLE
  31. {
  32. /// <summary>
  33. /// The <see cref="WAVEFORMATEX"/> structure that specifies the basic format.
  34. /// </summary>
  35. [FieldOffset(0)]
  36. public WAVEFORMATEX Format;
  37. /// <summary>
  38. /// Variant data, which may contain either the valid bits per sample, or samples per block.
  39. /// </summary>
  40. [FieldOffset(18)]
  41. public SamplesUnion Samples;
  42. /// <summary>
  43. /// Bitmask specifying the assignment of channels in the stream to speaker positions.
  44. /// </summary>
  45. [FieldOffset(20)]
  46. public UInt32 dwChannelMask;
  47. /// <summary>
  48. /// Subformat of the data.
  49. /// </summary>
  50. [FieldOffset(24)]
  51. public Guid SubFormat;
  52. /// <summary>
  53. /// Defines possible values of variant data for the <see cref="WAVEFORMATEXTENSIBLE"/> Samples member.
  54. /// </summary>
  55. [StructLayout(LayoutKind.Explicit)]
  56. public struct SamplesUnion
  57. {
  58. /// <summary>
  59. /// The number of bits of precision in the signal.
  60. /// </summary>
  61. [FieldOffset(0)]
  62. public UInt16 wValidBitsPerSample;
  63. /// <summary>
  64. /// The number of samples contained in one compressed block of audio data.
  65. /// </summary>
  66. [FieldOffset(0)]
  67. public UInt16 wSamplesPerBlock;
  68. /// <summary>
  69. /// Reserved for internal use by operating system.
  70. /// </summary>
  71. [FieldOffset(0)]
  72. public UInt16 wReserved;
  73. }
  74. }
  75. }