PROPVARIANT.cs 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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 Vannatech.CoreAudio.Externals
  22. {
  23. /// <summary>
  24. /// Used by the <see cref="IPropertyStore.GetValue"/> and <see cref="IPropertyStore.SetValue"/> methods
  25. /// of <see cref="IPropertyStore"/> as the primary way to program item properties.
  26. /// </summary>
  27. /// <remarks>
  28. /// MSDN Reference: http://msdn.microsoft.com/en-us/library/aa380072.aspx
  29. /// Note: This item is external to CoreAudio API, and is defined in the Windows Structured Storage API.
  30. /// </remarks>
  31. [StructLayout(LayoutKind.Sequential)]
  32. public struct PROPVARIANT
  33. {
  34. /// <summary>
  35. /// Value type tag.
  36. /// </summary>
  37. public short vt;
  38. /// <summary>
  39. /// Reserved for future use.
  40. /// </summary>
  41. public short wReserved1;
  42. /// <summary>
  43. /// Reserved for future use.
  44. /// </summary>
  45. public short wReserved2;
  46. /// <summary>
  47. /// Reserved for future use.
  48. /// </summary>
  49. public short wReserved3;
  50. /// <summary>
  51. /// Represents the variant data section.
  52. /// </summary>
  53. public VariantData Data;
  54. }
  55. /// <summary>
  56. /// Represents the variant data section of the PROPVARIANT structure.
  57. /// </summary>
  58. /// <remarks>
  59. /// This only provides variants for use within the context of MMDevice properties.
  60. /// </remarks>
  61. [StructLayout(LayoutKind.Explicit)]
  62. public struct VariantData
  63. {
  64. /// <summary>
  65. /// Represents the data as a boolean value.
  66. /// </summary>
  67. [FieldOffset(0)]
  68. public bool AsBoolean;
  69. /// <summary>
  70. /// Represents the data as a unsigned 32-bit integer.
  71. /// </summary>
  72. [FieldOffset(0)]
  73. public UInt32 AsUInt32;
  74. /// <summary>
  75. /// Represents the data as a unicode string pointer.
  76. /// </summary>
  77. [FieldOffset(0)]
  78. public IntPtr AsStringPtr;
  79. /// <summary>
  80. /// Represents the data as a pointer to a WAVEFORMATEX structure.
  81. /// </summary>
  82. [FieldOffset(4)]
  83. public IntPtr AsFormatPtr;
  84. }
  85. }