1 /**
2     Translation Windows of Core Audio interfaces: MMDevice, WASAPI, EndpointVolume API header files.
3 */
4 module wasapi.coreaudio;
5 version(Windows):
6 
7 import core.sys.windows.windows;
8 import core.sys.windows.objidl;
9 import core.sys.windows.wtypes;
10 //import std.string;
11 
12 /// Helper function to create GUID from string.
13 ///
14 /// BCDE0395-E52F-467C-8E3D-C4579291692E -> GUID(0xBCDE0395, 0xE52F, 0x467C, [0x8E, 0x3D, 0xC4, 0x57, 0x92, 0x91, 0x69, 0x2E])
15 GUID makeGuid(string str)()
16 {
17     static assert(str.length==36, "Guid string must be 36 chars long");
18     enum GUIDstring = "GUID(0x" ~ str[0..8] ~ ", 0x" ~ str[9..13] ~ ", 0x" ~ str[14..18] ~
19         ", [0x" ~ str[19..21] ~ ", 0x" ~ str[21..23] ~ ", 0x" ~ str[24..26] ~ ", 0x" ~ str[26..28]
20         ~ ", 0x" ~ str[28..30] ~ ", 0x" ~ str[30..32] ~ ", 0x" ~ str[32..34] ~ ", 0x" ~ str[34..36] ~ "])";
21     return mixin(GUIDstring);
22 }
23 
24 /** WASAPI Constants */
25 
26 uint AUDCLNT_ERR(uint n)() { return n | 0x88890000; }
27 
28 enum AUDCLNT_E_NOT_INITIALIZED              =AUDCLNT_ERR!(0x001);
29 enum AUDCLNT_E_ALREADY_INITIALIZED          =AUDCLNT_ERR!(0x002);
30 enum AUDCLNT_E_WRONG_ENDPOINT_TYPE          =AUDCLNT_ERR!(0x003);
31 enum AUDCLNT_E_DEVICE_INVALIDATED           =AUDCLNT_ERR!(0x004);
32 enum AUDCLNT_E_NOT_STOPPED                  =AUDCLNT_ERR!(0x005);
33 enum AUDCLNT_E_BUFFER_TOO_LARGE             =AUDCLNT_ERR!(0x006);
34 enum AUDCLNT_E_OUT_OF_ORDER                 =AUDCLNT_ERR!(0x007);
35 enum AUDCLNT_E_UNSUPPORTED_FORMAT           =AUDCLNT_ERR!(0x008);
36 enum AUDCLNT_E_INVALID_SIZE                 =AUDCLNT_ERR!(0x009);
37 enum AUDCLNT_E_DEVICE_IN_USE                =AUDCLNT_ERR!(0x00a);
38 enum AUDCLNT_E_BUFFER_OPERATION_PENDING     =AUDCLNT_ERR!(0x00b);
39 enum AUDCLNT_E_THREAD_NOT_REGISTERED        =AUDCLNT_ERR!(0x00c);
40 enum AUDCLNT_E_EXCLUSIVE_MODE_NOT_ALLOWED   =AUDCLNT_ERR!(0x00e);
41 enum AUDCLNT_E_ENDPOINT_CREATE_FAILED       =AUDCLNT_ERR!(0x00f);
42 enum AUDCLNT_E_SERVICE_NOT_RUNNING          =AUDCLNT_ERR!(0x010);
43 enum AUDCLNT_E_EVENTHANDLE_NOT_EXPECTED     =AUDCLNT_ERR!(0x011);
44 enum AUDCLNT_E_EXCLUSIVE_MODE_ONLY          =AUDCLNT_ERR!(0x012);
45 enum AUDCLNT_E_BUFDURATION_PERIOD_NOT_EQUAL =AUDCLNT_ERR!(0x013);
46 enum AUDCLNT_E_EVENTHANDLE_NOT_SET          =AUDCLNT_ERR!(0x014);
47 enum AUDCLNT_E_INCORRECT_BUFFER_SIZE        =AUDCLNT_ERR!(0x015);
48 enum AUDCLNT_E_BUFFER_SIZE_ERROR            =AUDCLNT_ERR!(0x016);
49 enum AUDCLNT_E_CPUUSAGE_EXCEEDED            =AUDCLNT_ERR!(0x017);
50 enum AUDCLNT_E_BUFFER_ERROR                 =AUDCLNT_ERR!(0x018);
51 enum AUDCLNT_E_BUFFER_SIZE_NOT_ALIGNED      =AUDCLNT_ERR!(0x019);
52 enum AUDCLNT_E_INVALID_DEVICE_PERIOD        =AUDCLNT_ERR!(0x020);
53 enum AUDCLNT_E_INVALID_STREAM_FLAG          =AUDCLNT_ERR!(0x021);
54 enum AUDCLNT_E_ENDPOINT_OFFLOAD_NOT_CAPABLE =AUDCLNT_ERR!(0x022);
55 enum AUDCLNT_E_OUT_OF_OFFLOAD_RESOURCES     =AUDCLNT_ERR!(0x023);
56 enum AUDCLNT_E_OFFLOAD_MODE_ONLY            =AUDCLNT_ERR!(0x024);
57 enum AUDCLNT_E_NONOFFLOAD_MODE_ONLY         =AUDCLNT_ERR!(0x025);
58 enum AUDCLNT_E_RESOURCES_INVALIDATED        =AUDCLNT_ERR!(0x026);
59 enum AUDCLNT_E_RAW_MODE_UNSUPPORTED         =AUDCLNT_ERR!(0x027);
60 enum AUDCLNT_E_ENGINE_PERIODICITY_LOCKED    =AUDCLNT_ERR!(0x028);
61 enum AUDCLNT_E_ENGINE_FORMAT_LOCKED         =AUDCLNT_ERR!(0x029);
62 
63 
64 extern (Windows):
65 
66 enum WAVE_FORMAT_UNKNOWN                    =0x0000; /* Microsoft Corporation */
67 enum WAVE_FORMAT_ADPCM                      =0x0002; /* Microsoft Corporation */
68 enum WAVE_FORMAT_IEEE_FLOAT                 =0x0003; /* Microsoft Corporation */
69 enum WAVE_FORMAT_VSELP                      =0x0004; /* Compaq Computer Corp. */
70 enum WAVE_FORMAT_IBM_CVSD                   =0x0005; /* IBM Corporation */
71 enum WAVE_FORMAT_ALAW                       =0x0006; /* Microsoft Corporation */
72 enum WAVE_FORMAT_MULAW                      =0x0007; /* Microsoft Corporation */
73 enum WAVE_FORMAT_DTS                        =0x0008; /* Microsoft Corporation */
74 enum WAVE_FORMAT_DRM                        =0x0009; /* Microsoft Corporation */
75 enum WAVE_FORMAT_WMAVOICE9                  =0x000A; /* Microsoft Corporation */
76 enum WAVE_FORMAT_WMAVOICE10                 =0x000B; /* Microsoft Corporation */
77 enum WAVE_FORMAT_OKI_ADPCM                  =0x0010; /* OKI */
78 enum WAVE_FORMAT_DVI_ADPCM                  =0x0011; /* Intel Corporation */
79 enum WAVE_FORMAT_IMA_ADPCM                  =(WAVE_FORMAT_DVI_ADPCM); /*  Intel Corporation */
80 enum WAVE_FORMAT_MEDIASPACE_ADPCM           =0x0012; /* Videologic */
81 enum WAVE_FORMAT_SIERRA_ADPCM               =0x0013; /* Sierra Semiconductor Corp */
82 enum WAVE_FORMAT_G723_ADPCM                 =0x0014; /* Antex Electronics Corporation */
83 enum WAVE_FORMAT_DIGISTD                    =0x0015; /* DSP Solutions, Inc. */
84 enum WAVE_FORMAT_DIGIFIX                    =0x0016; /* DSP Solutions, Inc. */
85 enum WAVE_FORMAT_DIALOGIC_OKI_ADPCM         =0x0017; /* Dialogic Corporation */
86 enum WAVE_FORMAT_MEDIAVISION_ADPCM          =0x0018; /* Media Vision, Inc. */
87 enum WAVE_FORMAT_CU_CODEC                   =0x0019; /* Hewlett-Packard Company */
88 enum WAVE_FORMAT_YAMAHA_ADPCM               =0x0020; /* Yamaha Corporation of America */
89 enum WAVE_FORMAT_SONARC                     =0x0021; /* Speech Compression */
90 enum WAVE_FORMAT_DSPGROUP_TRUESPEECH        =0x0022; /* DSP Group, Inc */
91 enum WAVE_FORMAT_ECHOSC1                    =0x0023; /* Echo Speech Corporation */
92 enum WAVE_FORMAT_AUDIOFILE_AF36             =0x0024; /* Virtual Music, Inc. */
93 enum WAVE_FORMAT_APTX                       =0x0025; /* Audio Processing Technology */
94 enum WAVE_FORMAT_AUDIOFILE_AF10             =0x0026; /* Virtual Music, Inc. */
95 enum WAVE_FORMAT_PROSODY_1612               =0x0027; /* Aculab plc */
96 enum WAVE_FORMAT_LRC                        =0x0028; /* Merging Technologies S.A. */
97 enum WAVE_FORMAT_DOLBY_AC2                  =0x0030; /* Dolby Laboratories */
98 enum WAVE_FORMAT_GSM610                     =0x0031; /* Microsoft Corporation */
99 enum WAVE_FORMAT_MSNAUDIO                   =0x0032; /* Microsoft Corporation */
100 enum WAVE_FORMAT_ANTEX_ADPCME               =0x0033; /* Antex Electronics Corporation */
101 enum WAVE_FORMAT_CONTROL_RES_VQLPC          =0x0034; /* Control Resources Limited */
102 enum WAVE_FORMAT_DIGIREAL                   =0x0035; /* DSP Solutions, Inc. */
103 enum WAVE_FORMAT_DIGIADPCM                  =0x0036; /* DSP Solutions, Inc. */
104 enum WAVE_FORMAT_CONTROL_RES_CR10           =0x0037; /* Control Resources Limited */
105 enum WAVE_FORMAT_NMS_VBXADPCM               =0x0038; /* Natural MicroSystems */
106 enum WAVE_FORMAT_CS_IMAADPCM                =0x0039; /* Crystal Semiconductor IMA ADPCM */
107 enum WAVE_FORMAT_ECHOSC3                    =0x003A; /* Echo Speech Corporation */
108 enum WAVE_FORMAT_ROCKWELL_ADPCM             =0x003B; /* Rockwell International */
109 enum WAVE_FORMAT_ROCKWELL_DIGITALK          =0x003C; /* Rockwell International */
110 enum WAVE_FORMAT_XEBEC                      =0x003D; /* Xebec Multimedia Solutions Limited */
111 enum WAVE_FORMAT_G721_ADPCM                 =0x0040; /* Antex Electronics Corporation */
112 enum WAVE_FORMAT_G728_CELP                  =0x0041; /* Antex Electronics Corporation */
113 enum WAVE_FORMAT_MSG723                     =0x0042; /* Microsoft Corporation */
114 enum WAVE_FORMAT_MPEG                       =0x0050; /* Microsoft Corporation */
115 enum WAVE_FORMAT_RT24                       =0x0052; /* InSoft, Inc. */
116 enum WAVE_FORMAT_PAC                        =0x0053; /* InSoft, Inc. */
117 enum WAVE_FORMAT_MPEGLAYER3                 =0x0055; /* ISO/MPEG Layer3 Format Tag */
118 enum WAVE_FORMAT_LUCENT_G723                =0x0059; /* Lucent Technologies */
119 enum WAVE_FORMAT_CIRRUS                     =0x0060; /* Cirrus Logic */
120 enum WAVE_FORMAT_ESPCM                      =0x0061; /* ESS Technology */
121 enum WAVE_FORMAT_VOXWARE                    =0x0062; /* Voxware Inc */
122 enum WAVE_FORMAT_CANOPUS_ATRAC              =0x0063; /* Canopus, co., Ltd. */
123 enum WAVE_FORMAT_G726_ADPCM                 =0x0064; /* APICOM */
124 enum WAVE_FORMAT_G722_ADPCM                 =0x0065; /* APICOM */
125 enum WAVE_FORMAT_DSAT_DISPLAY               =0x0067; /* Microsoft Corporation */
126 enum WAVE_FORMAT_VOXWARE_BYTE_ALIGNED       =0x0069; /* Voxware Inc */
127 enum WAVE_FORMAT_VOXWARE_AC8                =0x0070; /* Voxware Inc */
128 enum WAVE_FORMAT_VOXWARE_AC10               =0x0071; /* Voxware Inc */
129 enum WAVE_FORMAT_VOXWARE_AC16               =0x0072; /* Voxware Inc */
130 enum WAVE_FORMAT_VOXWARE_AC20               =0x0073; /* Voxware Inc */
131 enum WAVE_FORMAT_VOXWARE_RT24               =0x0074; /* Voxware Inc */
132 enum WAVE_FORMAT_VOXWARE_RT29               =0x0075; /* Voxware Inc */
133 enum WAVE_FORMAT_VOXWARE_RT29HW             =0x0076; /* Voxware Inc */
134 enum WAVE_FORMAT_VOXWARE_VR12               =0x0077; /* Voxware Inc */
135 enum WAVE_FORMAT_VOXWARE_VR18               =0x0078; /* Voxware Inc */
136 enum WAVE_FORMAT_VOXWARE_TQ40               =0x0079; /* Voxware Inc */
137 enum WAVE_FORMAT_SOFTSOUND                  =0x0080; /* Softsound, Ltd. */
138 enum WAVE_FORMAT_VOXWARE_TQ60               =0x0081; /* Voxware Inc */
139 enum WAVE_FORMAT_MSRT24                     =0x0082; /* Microsoft Corporation */
140 enum WAVE_FORMAT_G729A                      =0x0083; /* AT&T Labs, Inc. */
141 enum WAVE_FORMAT_MVI_MVI2                   =0x0084; /* Motion Pixels */
142 enum WAVE_FORMAT_DF_G726                    =0x0085; /* DataFusion Systems (Pty) (Ltd) */
143 enum WAVE_FORMAT_DF_GSM610                  =0x0086; /* DataFusion Systems (Pty) (Ltd) */
144 enum WAVE_FORMAT_ISIAUDIO                   =0x0088; /* Iterated Systems, Inc. */
145 enum WAVE_FORMAT_ONLIVE                     =0x0089; /* OnLive! Technologies, Inc. */
146 enum WAVE_FORMAT_SBC24                      =0x0091; /* Siemens Business Communications Sys */
147 enum WAVE_FORMAT_DOLBY_AC3_SPDIF            =0x0092; /* Sonic Foundry */
148 enum WAVE_FORMAT_MEDIASONIC_G723            =0x0093; /* MediaSonic */
149 enum WAVE_FORMAT_PROSODY_8KBPS              =0x0094; /* Aculab plc */
150 enum WAVE_FORMAT_ZYXEL_ADPCM                =0x0097; /* ZyXEL Communications, Inc. */
151 enum WAVE_FORMAT_PHILIPS_LPCBB              =0x0098; /* Philips Speech Processing */
152 enum WAVE_FORMAT_PACKED                     =0x0099; /* Studer Professional Audio AG */
153 enum WAVE_FORMAT_MALDEN_PHONYTALK           =0x00A0; /* Malden Electronics Ltd. */
154 enum WAVE_FORMAT_RAW_AAC1                   =0x00FF; /* For Raw AAC, with format block AudioSpecificConfig() (as defined by MPEG-4), that follows WAVEFORMATEX */
155 enum WAVE_FORMAT_RHETOREX_ADPCM             =0x0100; /* Rhetorex Inc. */
156 enum WAVE_FORMAT_IRAT                       =0x0101; /* BeCubed Software Inc. */
157 enum WAVE_FORMAT_VIVO_G723                  =0x0111; /* Vivo Software */
158 enum WAVE_FORMAT_VIVO_SIREN                 =0x0112; /* Vivo Software */
159 enum WAVE_FORMAT_DIGITAL_G723               =0x0123; /* Digital Equipment Corporation */
160 enum WAVE_FORMAT_SANYO_LD_ADPCM             =0x0125; /* Sanyo Electric Co., Ltd. */
161 enum WAVE_FORMAT_SIPROLAB_ACEPLNET          =0x0130; /* Sipro Lab Telecom Inc. */
162 enum WAVE_FORMAT_SIPROLAB_ACELP4800         =0x0131; /* Sipro Lab Telecom Inc. */
163 enum WAVE_FORMAT_SIPROLAB_ACELP8V3          =0x0132; /* Sipro Lab Telecom Inc. */
164 enum WAVE_FORMAT_SIPROLAB_G729              =0x0133; /* Sipro Lab Telecom Inc. */
165 enum WAVE_FORMAT_SIPROLAB_G729A             =0x0134; /* Sipro Lab Telecom Inc. */
166 enum WAVE_FORMAT_SIPROLAB_KELVIN            =0x0135; /* Sipro Lab Telecom Inc. */
167 enum WAVE_FORMAT_G726ADPCM                  =0x0140; /* Dictaphone Corporation */
168 enum WAVE_FORMAT_QUALCOMM_PUREVOICE         =0x0150; /* Qualcomm, Inc. */
169 enum WAVE_FORMAT_QUALCOMM_HALFRATE          =0x0151; /* Qualcomm, Inc. */
170 enum WAVE_FORMAT_TUBGSM                     =0x0155; /* Ring Zero Systems, Inc. */
171 enum WAVE_FORMAT_MSAUDIO1                   =0x0160; /* Microsoft Corporation */
172 enum WAVE_FORMAT_WMAUDIO2                   =0x0161; /* Microsoft Corporation */
173 enum WAVE_FORMAT_WMAUDIO3                   =0x0162; /* Microsoft Corporation */
174 enum WAVE_FORMAT_WMAUDIO_LOSSLESS           =0x0163; /* Microsoft Corporation */
175 enum WAVE_FORMAT_WMASPDIF                   =0x0164; /* Microsoft Corporation */
176 enum WAVE_FORMAT_UNISYS_NAP_ADPCM           =0x0170; /* Unisys Corp. */
177 enum WAVE_FORMAT_UNISYS_NAP_ULAW            =0x0171; /* Unisys Corp. */
178 enum WAVE_FORMAT_UNISYS_NAP_ALAW            =0x0172; /* Unisys Corp. */
179 enum WAVE_FORMAT_UNISYS_NAP_16K             =0x0173; /* Unisys Corp. */
180 enum WAVE_FORMAT_CREATIVE_ADPCM             =0x0200; /* Creative Labs, Inc */
181 enum WAVE_FORMAT_CREATIVE_FASTSPEECH8       =0x0202; /* Creative Labs, Inc */
182 enum WAVE_FORMAT_CREATIVE_FASTSPEECH10      =0x0203; /* Creative Labs, Inc */
183 enum WAVE_FORMAT_UHER_ADPCM                 =0x0210; /* UHER informatic GmbH */
184 enum WAVE_FORMAT_QUARTERDECK                =0x0220; /* Quarterdeck Corporation */
185 enum WAVE_FORMAT_ILINK_VC                   =0x0230; /* I-link Worldwide */
186 enum WAVE_FORMAT_RAW_SPORT                  =0x0240; /* Aureal Semiconductor */
187 enum WAVE_FORMAT_ESST_AC3                   =0x0241; /* ESS Technology, Inc. */
188 enum WAVE_FORMAT_GENERIC_PASSTHRU           =0x0249;
189 enum WAVE_FORMAT_IPI_HSX                    =0x0250; /* Interactive Products, Inc. */
190 enum WAVE_FORMAT_IPI_RPELP                  =0x0251; /* Interactive Products, Inc. */
191 enum WAVE_FORMAT_CS2                        =0x0260; /* Consistent Software */
192 enum WAVE_FORMAT_SONY_SCX                   =0x0270; /* Sony Corp. */
193 enum WAVE_FORMAT_FM_TOWNS_SND               =0x0300; /* Fujitsu Corp. */
194 enum WAVE_FORMAT_BTV_DIGITAL                =0x0400; /* Brooktree Corporation */
195 enum WAVE_FORMAT_QDESIGN_MUSIC              =0x0450; /* QDesign Corporation */
196 enum WAVE_FORMAT_VME_VMPCM                  =0x0680; /* AT&T Labs, Inc. */
197 enum WAVE_FORMAT_TPC                        =0x0681; /* AT&T Labs, Inc. */
198 enum WAVE_FORMAT_OLIGSM                     =0x1000; /* Ing C. Olivetti & C., S.p.A. */
199 enum WAVE_FORMAT_OLIADPCM                   =0x1001; /* Ing C. Olivetti & C., S.p.A. */
200 enum WAVE_FORMAT_OLICELP                    =0x1002; /* Ing C. Olivetti & C., S.p.A. */
201 enum WAVE_FORMAT_OLISBC                     =0x1003; /* Ing C. Olivetti & C., S.p.A. */
202 enum WAVE_FORMAT_OLIOPR                     =0x1004; /* Ing C. Olivetti & C., S.p.A. */
203 enum WAVE_FORMAT_LH_CODEC                   =0x1100; /* Lernout & Hauspie */
204 enum WAVE_FORMAT_NORRIS                     =0x1400; /* Norris Communications, Inc. */
205 enum WAVE_FORMAT_SOUNDSPACE_MUSICOMPRESS    =0x1500; /* AT&T Labs, Inc. */
206 enum WAVE_FORMAT_MPEG_ADTS_AAC              =0x1600; /* Microsoft Corporation */
207 enum WAVE_FORMAT_MPEG_RAW_AAC               =0x1601; /* Microsoft Corporation */
208 enum WAVE_FORMAT_MPEG_LOAS                  =0x1602; /* Microsoft Corporation (MPEG-4 Audio Transport Streams (LOAS/LATM) */
209 enum WAVE_FORMAT_NOKIA_MPEG_ADTS_AAC        =0x1608; /* Microsoft Corporation */
210 enum WAVE_FORMAT_NOKIA_MPEG_RAW_AAC         =0x1609; /* Microsoft Corporation */
211 enum WAVE_FORMAT_VODAFONE_MPEG_ADTS_AAC     =0x160A; /* Microsoft Corporation */
212 enum WAVE_FORMAT_VODAFONE_MPEG_RAW_AAC      =0x160B; /* Microsoft Corporation */
213 enum WAVE_FORMAT_MPEG_HEAAC                 =0x1610; /* Microsoft Corporation (MPEG-2 AAC or MPEG-4 HE-AAC v1/v2 streams with any payload (ADTS, ADIF, LOAS/LATM, RAW). Format block includes MP4 AudioSpecificConfig() -- see HEAACWAVEFORMAT below */
214 enum WAVE_FORMAT_DVM                        =0x2000; /* FAST Multimedia AG */
215 enum WAVE_FORMAT_DTS2                       =0x2001;
216 enum WAVE_FORMAT_EXTENSIBLE                 =0xFFFE; /* Microsoft */
217 
218 enum {
219     SPEAKER_FRONT_LEFT = 1,
220     SPEAKER_FRONT_RIGHT = 2,
221 }
222 
223 const GUID MEDIASUBTYPE_IEEE_FLOAT = {0x00000003, 0x0000, 0x0010, [0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71]};
224 const GUID MEDIASUBTYPE_PCM = {0x00000001, 0x0000, 0x0010, [0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71]};
225 
226 struct WAVEFORMATEXTENSIBLE {
227     WAVEFORMATEX    Format;
228     alias Format this;
229     union {
230         WORD wValidBitsPerSample;       /* bits of precision  */
231         WORD wSamplesPerBlock;          /* valid if wBitsPerSample==0 */
232         WORD wReserved;                 /* If neither applies, set to zero. */
233     }
234     DWORD           dwChannelMask;      /* which channels are */
235     /* present in stream  */
236     GUID            SubFormat;
237 }
238 
239 struct PROPERTYKEY
240 {
241     GUID fmtid;
242     DWORD pid;
243 }
244 
245 alias DEVPROPGUID = GUID;
246 alias DEVPROPID = ULONG;
247 
248 alias DEVPROPKEY = PROPERTYKEY;
249 
250 //#define DEFINE_DEVPROPKEY(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8, pid) EXTERN_C const DEVPROPKEY DECLSPEC_SELECTANY name = { { l, w1, w2, { b1, b2,  b3,  b4,  b5,  b6,  b7,  b8 } }, pid }
251 
252 DEVPROPKEY DEFINE_DEVPROPKEY(DWORD l, WORD w1, WORD w2, BYTE b1, BYTE b2, BYTE b3, BYTE b4, BYTE b5, BYTE b6, BYTE b7, BYTE b8, ULONG pid)() {
253     DEVPROPKEY a =
254         { { l, w1, w2, [ b1, b2,  b3,  b4,  b5,  b6,  b7,  b8 ] }, pid };
255     return a;
256 }
257 
258 //
259 // DEVPKEY_NAME
260 // Common DEVPKEY used to retrieve the display name for an object.
261 //
262 const DEVPKEY_NAME = DEFINE_DEVPROPKEY!(0xb725f130, 0x47ef, 0x101a, 0xa5, 0xf1, 0x02, 0x60, 0x8c, 0x9e, 0xeb, 0xac, 10);    // DEVPROP_TYPE_STRING
263 
264 
265 //
266 // Device properties
267 // These DEVPKEYs correspond to the SetupAPI SPDRP_XXX device properties.
268 //
269 const DEVPKEY_Device_DeviceDesc = DEFINE_DEVPROPKEY!(0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 2);     // DEVPROP_TYPE_STRING
270 const DEVPKEY_Device_HardwareIds = DEFINE_DEVPROPKEY!(0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 3);     // DEVPROP_TYPE_STRING_LIST
271 const DEVPKEY_Device_CompatibleIds = DEFINE_DEVPROPKEY!(0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 4);     // DEVPROP_TYPE_STRING_LIST
272 const DEVPKEY_Device_Service = DEFINE_DEVPROPKEY!(0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 6);     // DEVPROP_TYPE_STRING
273 const DEVPKEY_Device_Class = DEFINE_DEVPROPKEY!(0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 9);     // DEVPROP_TYPE_STRING
274 const DEVPKEY_Device_ClassGuid = DEFINE_DEVPROPKEY!(0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 10);    // DEVPROP_TYPE_GUID
275 const DEVPKEY_Device_Driver = DEFINE_DEVPROPKEY!(0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 11);    // DEVPROP_TYPE_STRING
276 const DEVPKEY_Device_ConfigFlags = DEFINE_DEVPROPKEY!(0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 12);    // DEVPROP_TYPE_UINT32
277 const DEVPKEY_Device_Manufacturer = DEFINE_DEVPROPKEY!(0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 13);    // DEVPROP_TYPE_STRING
278 const DEVPKEY_Device_FriendlyName = DEFINE_DEVPROPKEY!(0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 14);    // DEVPROP_TYPE_STRING
279 const DEVPKEY_Device_LocationInfo = DEFINE_DEVPROPKEY!(0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 15);    // DEVPROP_TYPE_STRING
280 const DEVPKEY_Device_PDOName = DEFINE_DEVPROPKEY!(0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 16);    // DEVPROP_TYPE_STRING
281 const DEVPKEY_Device_Capabilities = DEFINE_DEVPROPKEY!(0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 17);    // DEVPROP_TYPE_UNINT32
282 const DEVPKEY_Device_UINumber = DEFINE_DEVPROPKEY!(0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 18);    // DEVPROP_TYPE_STRING
283 const DEVPKEY_Device_UpperFilters = DEFINE_DEVPROPKEY!(0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 19);    // DEVPROP_TYPE_STRING_LIST
284 const DEVPKEY_Device_LowerFilters = DEFINE_DEVPROPKEY!(0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 20);    // DEVPROP_TYPE_STRING_LIST
285 const DEVPKEY_Device_BusTypeGuid = DEFINE_DEVPROPKEY!(0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 21);    // DEVPROP_TYPE_GUID
286 const DEVPKEY_Device_LegacyBusType = DEFINE_DEVPROPKEY!(0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 22);    // DEVPROP_TYPE_UINT32
287 const DEVPKEY_Device_BusNumber = DEFINE_DEVPROPKEY!(0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 23);    // DEVPROP_TYPE_UINT32
288 const DEVPKEY_Device_EnumeratorName = DEFINE_DEVPROPKEY!(0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 24);    // DEVPROP_TYPE_STRING
289 const DEVPKEY_Device_Security = DEFINE_DEVPROPKEY!(0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 25);    // DEVPROP_TYPE_SECURITY_DESCRIPTOR
290 const DEVPKEY_Device_SecuritySDS = DEFINE_DEVPROPKEY!(0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 26);    // DEVPROP_TYPE_SECURITY_DESCRIPTOR_STRING
291 const DEVPKEY_Device_DevType = DEFINE_DEVPROPKEY!(0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 27);    // DEVPROP_TYPE_UINT32
292 const DEVPKEY_Device_Exclusive = DEFINE_DEVPROPKEY!(0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 28);    // DEVPROP_TYPE_BOOLEAN
293 const DEVPKEY_Device_Characteristics = DEFINE_DEVPROPKEY!(0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 29);    // DEVPROP_TYPE_UINT32
294 const DEVPKEY_Device_Address = DEFINE_DEVPROPKEY!(0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 30);    // DEVPROP_TYPE_UINT32
295 const DEVPKEY_Device_UINumberDescFormat = DEFINE_DEVPROPKEY!(0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 31);    // DEVPROP_TYPE_STRING
296 const DEVPKEY_Device_PowerData = DEFINE_DEVPROPKEY!(0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 32);    // DEVPROP_TYPE_BINARY
297 const DEVPKEY_Device_RemovalPolicy = DEFINE_DEVPROPKEY!(0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 33);    // DEVPROP_TYPE_UINT32
298 const DEVPKEY_Device_RemovalPolicyDefault = DEFINE_DEVPROPKEY!(0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 34);    // DEVPROP_TYPE_UINT32
299 const DEVPKEY_Device_RemovalPolicyOverride = DEFINE_DEVPROPKEY!(0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 35);    // DEVPROP_TYPE_UINT32
300 const DEVPKEY_Device_InstallState = DEFINE_DEVPROPKEY!(0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 36);    // DEVPROP_TYPE_UINT32
301 const DEVPKEY_Device_LocationPaths = DEFINE_DEVPROPKEY!(0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 37);    // DEVPROP_TYPE_STRING_LIST
302 const DEVPKEY_Device_BaseContainerId = DEFINE_DEVPROPKEY!(0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 38);    // DEVPROP_TYPE_GUID!
303 
304 //
305 // Device properties
306 // These DEVPKEYs correspond to a device's status and problem code.
307 //
308 const DEVPKEY_Device_DevNodeStatus = DEFINE_DEVPROPKEY!(0x4340a6c5, 0x93fa, 0x4706, 0x97, 0x2c, 0x7b, 0x64, 0x80, 0x08, 0xa5, 0xa7, 2);     // DEVPROP_TYPE_UINT32
309 const DEVPKEY_Device_ProblemCode = DEFINE_DEVPROPKEY!(0x4340a6c5, 0x93fa, 0x4706, 0x97, 0x2c, 0x7b, 0x64, 0x80, 0x08, 0xa5, 0xa7, 3);     // DEVPROP_TYPE_UINT32
310 
311 //
312 // Device properties
313 // These DEVPKEYs correspond to a device's relations.
314 //
315 const DEVPKEY_Device_EjectionRelations = DEFINE_DEVPROPKEY!(0x4340a6c5, 0x93fa, 0x4706, 0x97, 0x2c, 0x7b, 0x64, 0x80, 0x08, 0xa5, 0xa7, 4);     // DEVPROP_TYPE_STRING_LIST
316 const DEVPKEY_Device_RemovalRelations = DEFINE_DEVPROPKEY!(0x4340a6c5, 0x93fa, 0x4706, 0x97, 0x2c, 0x7b, 0x64, 0x80, 0x08, 0xa5, 0xa7, 5);     // DEVPROP_TYPE_STRING_LIST
317 const DEVPKEY_Device_PowerRelations = DEFINE_DEVPROPKEY!(0x4340a6c5, 0x93fa, 0x4706, 0x97, 0x2c, 0x7b, 0x64, 0x80, 0x08, 0xa5, 0xa7, 6);     // DEVPROP_TYPE_STRING_LIST
318 const DEVPKEY_Device_BusRelations = DEFINE_DEVPROPKEY!(0x4340a6c5, 0x93fa, 0x4706, 0x97, 0x2c, 0x7b, 0x64, 0x80, 0x08, 0xa5, 0xa7, 7);     // DEVPROP_TYPE_STRING_LIST
319 const DEVPKEY_Device_Parent = DEFINE_DEVPROPKEY!(0x4340a6c5, 0x93fa, 0x4706, 0x97, 0x2c, 0x7b, 0x64, 0x80, 0x08, 0xa5, 0xa7, 8);     // DEVPROP_TYPE_STRING
320 const DEVPKEY_Device_Children = DEFINE_DEVPROPKEY!(0x4340a6c5, 0x93fa, 0x4706, 0x97, 0x2c, 0x7b, 0x64, 0x80, 0x08, 0xa5, 0xa7, 9);     // DEVPROP_TYPE_STRING_LIST
321 const DEVPKEY_Device_Siblings = DEFINE_DEVPROPKEY!(0x4340a6c5, 0x93fa, 0x4706, 0x97, 0x2c, 0x7b, 0x64, 0x80, 0x08, 0xa5, 0xa7, 10);    // DEVPROP_TYPE_STRING_LIST
322 const DEVPKEY_Device_TransportRelations = DEFINE_DEVPROPKEY!(0x4340a6c5, 0x93fa, 0x4706, 0x97, 0x2c, 0x7b, 0x64, 0x80, 0x08, 0xa5, 0xa7, 11);    // DEVPROP_TYPE_STRING_LIST
323 
324 //
325 // Other Device properties
326 // These DEVPKEYs are set for the corresponding types of root-enumerated devices.     ;comment
327 //
328 const DEVPKEY_Device_Reported = DEFINE_DEVPROPKEY!(0x80497100, 0x8c73, 0x48b9, 0xaa, 0xd9, 0xce, 0x38, 0x7e, 0x19, 0xc5, 0x6e, 2);     // DEVPROP_TYPE_BOOLEAN
329 const DEVPKEY_Device_Legacy = DEFINE_DEVPROPKEY!(0x80497100, 0x8c73, 0x48b9, 0xaa, 0xd9, 0xce, 0x38, 0x7e, 0x19, 0xc5, 0x6e, 3);     // DEVPROP_TYPE_BOOLEAN
330 
331 //
332 // Device Instance Id
333 //
334 const DEVPKEY_Device_InstanceId = DEFINE_DEVPROPKEY!(0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 256);   // DEVPROP_TYPE_STRING
335 
336 //
337 // Device Container Id
338 //
339 const DEVPKEY_Device_ContainerId = DEFINE_DEVPROPKEY!(0x8c7ed206, 0x3f8a, 0x4827, 0xb3, 0xab, 0xae, 0x9e, 0x1f, 0xae, 0xfc, 0x6c, 2);     // DEVPROP_TYPE_GUID
340 
341 //
342 // Device Experience related Keys
343 //
344 const DEVPKEY_Device_ModelId = DEFINE_DEVPROPKEY!(0x80d81ea6, 0x7473, 0x4b0c, 0x82, 0x16, 0xef, 0xc1, 0x1a, 0x2c, 0x4c, 0x8b, 2);     // DEVPROP_TYPE_GUID
345 const DEVPKEY_Device_FriendlyNameAttributes = DEFINE_DEVPROPKEY!(0x80d81ea6, 0x7473, 0x4b0c, 0x82, 0x16, 0xef, 0xc1, 0x1a, 0x2c, 0x4c, 0x8b, 3);     // DEVPROP_TYPE_UINT32
346 const DEVPKEY_Device_ManufacturerAttributes = DEFINE_DEVPROPKEY!(0x80d81ea6, 0x7473, 0x4b0c, 0x82, 0x16, 0xef, 0xc1, 0x1a, 0x2c, 0x4c, 0x8b, 4);     // DEVPROP_TYPE_UINT32
347 const DEVPKEY_Device_PresenceNotForDevice = DEFINE_DEVPROPKEY!(0x80d81ea6, 0x7473, 0x4b0c, 0x82, 0x16, 0xef, 0xc1, 0x1a, 0x2c, 0x4c, 0x8b, 5);     // DEVPROP_TYPE_BOOLEAN
348 
349 //
350 // Other Device properties
351 //
352 const DEVPKEY_Numa_Proximity_Domain = DEFINE_DEVPROPKEY!(0x540b947e, 0x8b40, 0x45bc, 0xa8, 0xa2, 0x6a, 0x0b, 0x89, 0x4c, 0xbd, 0xa2, 1);     // DEVPROP_TYPE_UINT32
353 const DEVPKEY_Device_DHP_Rebalance_Policy = DEFINE_DEVPROPKEY!(0x540b947e, 0x8b40, 0x45bc, 0xa8, 0xa2, 0x6a, 0x0b, 0x89, 0x4c, 0xbd, 0xa2, 2);     // DEVPROP_TYPE_UINT32
354 const DEVPKEY_Device_Numa_Node = DEFINE_DEVPROPKEY!(0x540b947e, 0x8b40, 0x45bc, 0xa8, 0xa2, 0x6a, 0x0b, 0x89, 0x4c, 0xbd, 0xa2, 3);     // DEVPROP_TYPE_UINT32
355 const DEVPKEY_Device_BusReportedDeviceDesc = DEFINE_DEVPROPKEY!(0x540b947e, 0x8b40, 0x45bc, 0xa8, 0xa2, 0x6a, 0x0b, 0x89, 0x4c, 0xbd, 0xa2, 4);     // DEVPROP_TYPE_STRING
356 
357 
358 //
359 // Device Session Id
360 //
361 const DEVPKEY_Device_SessionId = DEFINE_DEVPROPKEY!(0x83da6326, 0x97a6, 0x4088, 0x94, 0x53, 0xa1, 0x92, 0x3f, 0x57, 0x3b, 0x29, 6);     // DEVPROP_TYPE_UINT32
362 
363 //
364 // Device activity timestamp properties
365 //
366 const DEVPKEY_Device_InstallDate = DEFINE_DEVPROPKEY!(0x83da6326, 0x97a6, 0x4088, 0x94, 0x53, 0xa1, 0x92, 0x3f, 0x57, 0x3b, 0x29, 100);   // DEVPROP_TYPE_FILETIME
367 const DEVPKEY_Device_FirstInstallDate = DEFINE_DEVPROPKEY!(0x83da6326, 0x97a6, 0x4088, 0x94, 0x53, 0xa1, 0x92, 0x3f, 0x57, 0x3b, 0x29, 101);   // DEVPROP_TYPE_FILETIME
368 
369 //
370 // Device driver properties
371 //
372 const DEVPKEY_Device_DriverDate = DEFINE_DEVPROPKEY!(0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 2);      // DEVPROP_TYPE_FILETIME
373 const DEVPKEY_Device_DriverVersion = DEFINE_DEVPROPKEY!(0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 3);      // DEVPROP_TYPE_STRING
374 const DEVPKEY_Device_DriverDesc = DEFINE_DEVPROPKEY!(0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 4);      // DEVPROP_TYPE_STRING
375 const DEVPKEY_Device_DriverInfPath = DEFINE_DEVPROPKEY!(0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 5);      // DEVPROP_TYPE_STRING
376 const DEVPKEY_Device_DriverInfSection = DEFINE_DEVPROPKEY!(0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 6);      // DEVPROP_TYPE_STRING
377 const DEVPKEY_Device_DriverInfSectionExt = DEFINE_DEVPROPKEY!(0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 7);      // DEVPROP_TYPE_STRING
378 const DEVPKEY_Device_MatchingDeviceId = DEFINE_DEVPROPKEY!(0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 8);      // DEVPROP_TYPE_STRING
379 const DEVPKEY_Device_DriverProvider = DEFINE_DEVPROPKEY!(0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 9);      // DEVPROP_TYPE_STRING
380 const DEVPKEY_Device_DriverPropPageProvider = DEFINE_DEVPROPKEY!(0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 10);     // DEVPROP_TYPE_STRING
381 const DEVPKEY_Device_DriverCoInstallers = DEFINE_DEVPROPKEY!(0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 11);     // DEVPROP_TYPE_STRING_LIST
382 const DEVPKEY_Device_ResourcePickerTags = DEFINE_DEVPROPKEY!(0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 12);     // DEVPROP_TYPE_STRING
383 const DEVPKEY_Device_ResourcePickerExceptions = DEFINE_DEVPROPKEY!(0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 13);   // DEVPROP_TYPE_STRING
384 const DEVPKEY_Device_DriverRank = DEFINE_DEVPROPKEY!(0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 14);     // DEVPROP_TYPE_UINT32
385 const DEVPKEY_Device_DriverLogoLevel = DEFINE_DEVPROPKEY!(0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 15);     // DEVPROP_TYPE_UINT32
386 
387 //
388 // Device properties
389 // These DEVPKEYs may be set by the driver package installed for a device.
390 //
391 const DEVPKEY_Device_NoConnectSound = DEFINE_DEVPROPKEY!(0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 17);     // DEVPROP_TYPE_BOOLEAN
392 const DEVPKEY_Device_GenericDriverInstalled = DEFINE_DEVPROPKEY!(0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 18);     // DEVPROP_TYPE_BOOLEAN
393 const DEVPKEY_Device_AdditionalSoftwareRequested = DEFINE_DEVPROPKEY!(0xa8b865dd, 0x2e3d, 0x4094, 0xad, 0x97, 0xe5, 0x93, 0xa7, 0xc, 0x75, 0xd6, 19); //DEVPROP_TYPE_BOOLEAN
394 
395 //
396 // Device safe-removal properties
397 //
398 const DEVPKEY_Device_SafeRemovalRequired = DEFINE_DEVPROPKEY!(0xafd97640,  0x86a3, 0x4210, 0xb6, 0x7c, 0x28, 0x9c, 0x41, 0xaa, 0xbe, 0x55, 2);    // DEVPROP_TYPE_BOOLEAN
399 const DEVPKEY_Device_SafeRemovalRequiredOverride = DEFINE_DEVPROPKEY!(0xafd97640,  0x86a3, 0x4210, 0xb6, 0x7c, 0x28, 0x9c, 0x41, 0xaa, 0xbe, 0x55, 3); // DEVPROP_TYPE_BOOLEAN
400 
401 //
402 // Device properties
403 // These DEVPKEYs may be set by the driver package installed for a device.
404 //
405 const DEVPKEY_DrvPkg_Model = DEFINE_DEVPROPKEY!(0xcf73bb51, 0x3abf, 0x44a2, 0x85, 0xe0, 0x9a, 0x3d, 0xc7, 0xa1, 0x21, 0x32, 2);     // DEVPROP_TYPE_STRING
406 const DEVPKEY_DrvPkg_VendorWebSite = DEFINE_DEVPROPKEY!(0xcf73bb51, 0x3abf, 0x44a2, 0x85, 0xe0, 0x9a, 0x3d, 0xc7, 0xa1, 0x21, 0x32, 3);     // DEVPROP_TYPE_STRING
407 const DEVPKEY_DrvPkg_DetailedDescription = DEFINE_DEVPROPKEY!(0xcf73bb51, 0x3abf, 0x44a2, 0x85, 0xe0, 0x9a, 0x3d, 0xc7, 0xa1, 0x21, 0x32, 4);     // DEVPROP_TYPE_STRING
408 const DEVPKEY_DrvPkg_DocumentationLink = DEFINE_DEVPROPKEY!(0xcf73bb51, 0x3abf, 0x44a2, 0x85, 0xe0, 0x9a, 0x3d, 0xc7, 0xa1, 0x21, 0x32, 5);     // DEVPROP_TYPE_STRING
409 const DEVPKEY_DrvPkg_Icon = DEFINE_DEVPROPKEY!(0xcf73bb51, 0x3abf, 0x44a2, 0x85, 0xe0, 0x9a, 0x3d, 0xc7, 0xa1, 0x21, 0x32, 6);     // DEVPROP_TYPE_STRING_LIST
410 const DEVPKEY_DrvPkg_BrandingIcon = DEFINE_DEVPROPKEY!(0xcf73bb51, 0x3abf, 0x44a2, 0x85, 0xe0, 0x9a, 0x3d, 0xc7, 0xa1, 0x21, 0x32, 7);     // DEVPROP_TYPE_STRING_LIST
411 
412 
413 //
414 // Device setup class properties
415 // These DEVPKEYs correspond to the SetupAPI SPCRP_XXX setup class properties.
416 //
417 const DEVPKEY_DeviceClass_UpperFilters = DEFINE_DEVPROPKEY!(0x4321918b, 0xf69e, 0x470d, 0xa5, 0xde, 0x4d, 0x88, 0xc7, 0x5a, 0xd2, 0x4b, 19);    // DEVPROP_TYPE_STRING_LIST
418 const DEVPKEY_DeviceClass_LowerFilters = DEFINE_DEVPROPKEY!(0x4321918b, 0xf69e, 0x470d, 0xa5, 0xde, 0x4d, 0x88, 0xc7, 0x5a, 0xd2, 0x4b, 20);    // DEVPROP_TYPE_STRING_LIST
419 const DEVPKEY_DeviceClass_Security = DEFINE_DEVPROPKEY!(0x4321918b, 0xf69e, 0x470d, 0xa5, 0xde, 0x4d, 0x88, 0xc7, 0x5a, 0xd2, 0x4b, 25);    // DEVPROP_TYPE_SECURITY_DESCRIPTOR
420 const DEVPKEY_DeviceClass_SecuritySDS = DEFINE_DEVPROPKEY!(0x4321918b, 0xf69e, 0x470d, 0xa5, 0xde, 0x4d, 0x88, 0xc7, 0x5a, 0xd2, 0x4b, 26);    // DEVPROP_TYPE_SECURITY_DESCRIPTOR_STRING
421 const DEVPKEY_DeviceClass_DevType = DEFINE_DEVPROPKEY!(0x4321918b, 0xf69e, 0x470d, 0xa5, 0xde, 0x4d, 0x88, 0xc7, 0x5a, 0xd2, 0x4b, 27);    // DEVPROP_TYPE_UINT32
422 const DEVPKEY_DeviceClass_Exclusive = DEFINE_DEVPROPKEY!(0x4321918b, 0xf69e, 0x470d, 0xa5, 0xde, 0x4d, 0x88, 0xc7, 0x5a, 0xd2, 0x4b, 28);    // DEVPROP_TYPE_BOOLEAN
423 const DEVPKEY_DeviceClass_Characteristics = DEFINE_DEVPROPKEY!(0x4321918b, 0xf69e, 0x470d, 0xa5, 0xde, 0x4d, 0x88, 0xc7, 0x5a, 0xd2, 0x4b, 29);    // DEVPROP_TYPE_UINT32
424 
425 //
426 // Device setup class properties
427 //
428 const DEVPKEY_DeviceClass_Name = DEFINE_DEVPROPKEY!(0x259abffc, 0x50a7, 0x47ce, 0xaf, 0x8, 0x68, 0xc9, 0xa7, 0xd7, 0x33, 0x66, 2);      // DEVPROP_TYPE_STRING
429 const DEVPKEY_DeviceClass_ClassName = DEFINE_DEVPROPKEY!(0x259abffc, 0x50a7, 0x47ce, 0xaf, 0x8, 0x68, 0xc9, 0xa7, 0xd7, 0x33, 0x66, 3);      // DEVPROP_TYPE_STRING
430 const DEVPKEY_DeviceClass_Icon = DEFINE_DEVPROPKEY!(0x259abffc, 0x50a7, 0x47ce, 0xaf, 0x8, 0x68, 0xc9, 0xa7, 0xd7, 0x33, 0x66, 4);      // DEVPROP_TYPE_STRING
431 const DEVPKEY_DeviceClass_ClassInstaller = DEFINE_DEVPROPKEY!(0x259abffc, 0x50a7, 0x47ce, 0xaf, 0x8, 0x68, 0xc9, 0xa7, 0xd7, 0x33, 0x66, 5);      // DEVPROP_TYPE_STRING
432 const DEVPKEY_DeviceClass_PropPageProvider = DEFINE_DEVPROPKEY!(0x259abffc, 0x50a7, 0x47ce, 0xaf, 0x8, 0x68, 0xc9, 0xa7, 0xd7, 0x33, 0x66, 6);      // DEVPROP_TYPE_STRING
433 const DEVPKEY_DeviceClass_NoInstallClass = DEFINE_DEVPROPKEY!(0x259abffc, 0x50a7, 0x47ce, 0xaf, 0x8, 0x68, 0xc9, 0xa7, 0xd7, 0x33, 0x66, 7);      // DEVPROP_TYPE_BOOLEAN
434 const DEVPKEY_DeviceClass_NoDisplayClass = DEFINE_DEVPROPKEY!(0x259abffc, 0x50a7, 0x47ce, 0xaf, 0x8, 0x68, 0xc9, 0xa7, 0xd7, 0x33, 0x66, 8);      // DEVPROP_TYPE_BOOLEAN
435 const DEVPKEY_DeviceClass_SilentInstall = DEFINE_DEVPROPKEY!(0x259abffc, 0x50a7, 0x47ce, 0xaf, 0x8, 0x68, 0xc9, 0xa7, 0xd7, 0x33, 0x66, 9);      // DEVPROP_TYPE_BOOLEAN
436 const DEVPKEY_DeviceClass_NoUseClass = DEFINE_DEVPROPKEY!(0x259abffc, 0x50a7, 0x47ce, 0xaf, 0x8, 0x68, 0xc9, 0xa7, 0xd7, 0x33, 0x66, 10);     // DEVPROP_TYPE_BOOLEAN
437 const DEVPKEY_DeviceClass_DefaultService = DEFINE_DEVPROPKEY!(0x259abffc, 0x50a7, 0x47ce, 0xaf, 0x8, 0x68, 0xc9, 0xa7, 0xd7, 0x33, 0x66, 11);     // DEVPROP_TYPE_STRING
438 const DEVPKEY_DeviceClass_IconPath = DEFINE_DEVPROPKEY!(0x259abffc, 0x50a7, 0x47ce, 0xaf, 0x8, 0x68, 0xc9, 0xa7, 0xd7, 0x33, 0x66, 12);     // DEVPROP_TYPE_STRING_LIST
439 
440 const DEVPKEY_DeviceClass_DHPRebalanceOptOut = DEFINE_DEVPROPKEY!(0xd14d3ef3, 0x66cf, 0x4ba2, 0x9d, 0x38, 0x0d, 0xdb, 0x37, 0xab, 0x47, 0x01, 2);    // DEVPROP_TYPE_BOOLEAN
441 
442 //
443 // Other Device setup class properties
444 //
445 const DEVPKEY_DeviceClass_ClassCoInstallers = DEFINE_DEVPROPKEY!(0x713d1703, 0xa2e2, 0x49f5, 0x92, 0x14, 0x56, 0x47, 0x2e, 0xf3, 0xda, 0x5c, 2);     // DEVPROP_TYPE_STRING_LIST
446 
447 
448 //
449 // Device interface properties
450 //
451 const DEVPKEY_DeviceInterface_FriendlyName = DEFINE_DEVPROPKEY!(0x026e516e, 0xb814, 0x414b, 0x83, 0xcd, 0x85, 0x6d, 0x6f, 0xef, 0x48, 0x22, 2);     // DEVPROP_TYPE_STRING
452 const DEVPKEY_DeviceInterface_Enabled = DEFINE_DEVPROPKEY!(0x026e516e, 0xb814, 0x414b, 0x83, 0xcd, 0x85, 0x6d, 0x6f, 0xef, 0x48, 0x22, 3);     // DEVPROP_TYPE_BOOLEAN
453 const DEVPKEY_DeviceInterface_ClassGuid = DEFINE_DEVPROPKEY!(0x026e516e, 0xb814, 0x414b, 0x83, 0xcd, 0x85, 0x6d, 0x6f, 0xef, 0x48, 0x22, 4);     // DEVPROP_TYPE_GUID
454 
455 
456 //
457 // Device interface class properties
458 //
459 const DEVPKEY_DeviceInterfaceClass_DefaultInterface = DEFINE_DEVPROPKEY!(0x14c83a99, 0x0b3f, 0x44b7, 0xbe, 0x4c, 0xa1, 0x78, 0xd3, 0x99, 0x05, 0x64, 2); // DEVPROP_TYPE_STRING
460 
461 //
462 // DeviceDisplay properties that can be set on a devnode
463 //
464 const DEVPKEY_DeviceDisplay_IsShowInDisconnectedState = DEFINE_DEVPROPKEY!(0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 0x44); // DEVPROP_TYPE_BOOLEAN
465 const DEVPKEY_DeviceDisplay_IsNotInterestingForDisplay = DEFINE_DEVPROPKEY!(0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 0x4a); // DEVPROP_TYPE_BOOLEAN
466 const DEVPKEY_DeviceDisplay_Category = DEFINE_DEVPROPKEY!(0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 0x5a); // DEVPROP_TYPE_STRING_LIST
467 const DEVPKEY_DeviceDisplay_UnpairUninstall = DEFINE_DEVPROPKEY!(0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 0x62); // DEVPROP_TYPE_BOOLEAN
468 const DEVPKEY_DeviceDisplay_RequiresUninstallElevation = DEFINE_DEVPROPKEY!(0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 0x63); // DEVPROP_TYPE_BOOLEAN
469 const DEVPKEY_DeviceDisplay_AlwaysShowDeviceAsConnected = DEFINE_DEVPROPKEY!(0x78c34fc8, 0x104a, 0x4aca, 0x9e, 0xa4, 0x52, 0x4d, 0x52, 0x99, 0x6e, 0x57, 0x65); // DEVPROP_TYPE_BOOLEAN
470 
471 alias REFPROPERTYKEY = ref const(PROPERTYKEY);
472 alias REFPROPVARIANT = ref PROPVARIANT;
473 
474 enum ERole //__MIDL___MIDL_itf_mmdeviceapi_0000_0000_0002
475 {	
476     eConsole	= 0,
477     eMultimedia	= ( eConsole + 1 ) ,
478     eCommunications	= ( eMultimedia + 1 ) ,
479     ERole_enum_count	= ( eCommunications + 1 ) 
480 }
481 
482 enum EDataFlow //__MIDL___MIDL_itf_mmdeviceapi_0000_0000_0001
483 {	
484     eRender	= 0,
485     eCapture	= ( eRender + 1 ) ,
486     eAll	= ( eCapture + 1 ) ,
487     EDataFlow_enum_count	= ( eAll + 1 ) 
488 }
489 
490 enum DEVICE_STATE_ACTIVE      = 0x00000001;
491 enum DEVICE_STATE_DISABLED    = 0x00000002;
492 enum DEVICE_STATE_NOTPRESENT  = 0x00000004;
493 enum DEVICE_STATE_UNPLUGGED   = 0x00000008;
494 enum DEVICE_STATEMASK_ALL     = 0x0000000f;
495 
496 
497 /** WASAPI Interfaces */
498 
499 const IID IID_IPropertyStore = makeGuid!"886d8eeb-8cf2-4446-8d02-cdba1dbdcf99";
500 interface IPropertyStore : IUnknown {
501     HRESULT GetCount( 
502             /* [out] */ DWORD *cProps);
503 
504     HRESULT GetAt( 
505             /* [in] */ DWORD iProp,
506             /* [out] */ PROPERTYKEY *pkey);
507 
508     HRESULT GetValue( 
509             /* [in] */ const ref PROPERTYKEY key,
510             /* [out] */ out PROPVARIANT pv);
511 
512     HRESULT SetValue( 
513             /* [in] */ const ref PROPERTYKEY key,
514             /* [in] */ out PROPVARIANT propvar);
515 
516     HRESULT Commit();
517 }
518 
519 const IID IID_IMMDeviceCollection = makeGuid!"0BD7A1BE-7A1A-44DB-8397-CC5392387B5E";
520 interface IMMDeviceCollection : IUnknown {
521     HRESULT GetCount( 
522             /* [out] */ 
523             out UINT pcDevices);
524 
525     HRESULT Item( 
526             /* [in] */ 
527             UINT nDevice,
528             /* [out] */ 
529             out IMMDevice ppDevice);
530 }
531 
532 const IID IID_IMMDevice = makeGuid!"D666063F-1587-4E43-81F1-B948E807363F";
533 interface IMMDevice : IUnknown {
534     HRESULT Activate( 
535             /* [in] */ 
536             const ref IID iid,
537             /* [in] */ 
538             DWORD dwClsCtx,
539             /* [unique][in] */ 
540             PROPVARIANT *pActivationParams,
541             /* [iid_is][out] */ 
542             void ** ppInterface);
543 
544     HRESULT OpenPropertyStore( 
545             /* [in] */ 
546             DWORD stgmAccess,
547             /* [out] */ 
548             out IPropertyStore ppProperties);
549 
550     HRESULT GetId( 
551             /* [out] */ 
552             out LPWSTR ppstrId);
553 
554     HRESULT GetState( 
555             /* [out] */ 
556             out DWORD pdwState);
557 }
558 
559 
560 const IID IID_IMMNotificationClient = makeGuid!"7991EEC9-7E89-4D85-8390-6C703CEC60C0";
561 interface IMMNotificationClient : IUnknown {
562     HRESULT OnDeviceStateChanged( 
563             /* [annotation][in] */ 
564             LPCWSTR pwstrDeviceId,
565             /* [annotation][in] */ 
566             DWORD dwNewState);
567 
568     HRESULT OnDeviceAdded( 
569             /* [annotation][in] */ 
570             LPCWSTR pwstrDeviceId);
571 
572     HRESULT OnDeviceRemoved( 
573             /* [annotation][in] */ 
574             LPCWSTR pwstrDeviceId);
575 
576     HRESULT OnDefaultDeviceChanged( 
577             /* [annotation][in] */ 
578             EDataFlow flow,
579             /* [annotation][in] */ 
580             ERole role,
581             /* [annotation][in] */ 
582             LPCWSTR pwstrDefaultDeviceId);
583 
584     HRESULT OnPropertyValueChanged( 
585             /* [annotation][in] */ 
586             LPCWSTR pwstrDeviceId,
587             /* [annotation][in] */ 
588             const PROPERTYKEY key);
589 }
590 
591 const IID IID_IMMEndpoint = makeGuid!"1BE09788-6894-4089-8586-9A2A6C265AC5";
592 interface IMMEndpoint : IUnknown {
593     HRESULT GetDataFlow( 
594         /* [annotation][out] */ 
595         out EDataFlow pDataFlow);
596 }
597 
598 alias REFERENCE_TIME = long;
599 
600 enum AUDCLNT_SHAREMODE
601 {
602     AUDCLNT_SHAREMODE_SHARED,
603     AUDCLNT_SHAREMODE_EXCLUSIVE
604 }
605 
606 enum AUDCLNT_STREAMFLAGS_CROSSPROCESS             = 0x00010000;
607 enum AUDCLNT_STREAMFLAGS_LOOPBACK                 = 0x00020000;
608 enum AUDCLNT_STREAMFLAGS_EVENTCALLBACK            = 0x00040000;
609 enum AUDCLNT_STREAMFLAGS_NOPERSIST                = 0x00080000;
610 enum AUDCLNT_STREAMFLAGS_RATEADJUST               = 0x00100000;
611 
612 const IID IID_IAudioClient = makeGuid!"1CB9AD4C-DBFA-4c32-B178-C2F568A703B2";
613 interface IAudioClient : IUnknown {
614     HRESULT Initialize( 
615             /* [annotation][in] */ 
616             AUDCLNT_SHAREMODE ShareMode,
617             /* [annotation][in] */ 
618             DWORD StreamFlags,
619             /* [annotation][in] */ 
620             REFERENCE_TIME hnsBufferDuration,
621             /* [annotation][in] */ 
622             REFERENCE_TIME hnsPeriodicity,
623             /* [annotation][in] */ 
624             const WAVEFORMATEX *pFormat,
625             /* [annotation][in] */ 
626             LPCGUID AudioSessionGuid);
627 
628     HRESULT GetBufferSize( 
629             /* [annotation][out] */ 
630             out UINT32 pNumBufferFrames);
631 
632     HRESULT GetStreamLatency( 
633             /* [annotation][out] */ 
634             out REFERENCE_TIME phnsLatency);
635 
636     HRESULT GetCurrentPadding( 
637             /* [annotation][out] */ 
638             out UINT32 pNumPaddingFrames);
639 
640     HRESULT IsFormatSupported( 
641             /* [annotation][in] */ 
642             AUDCLNT_SHAREMODE ShareMode,
643             /* [annotation][in] */ 
644             const WAVEFORMATEX *pFormat,
645             /* [unique][annotation][out] */ 
646             WAVEFORMATEX **ppClosestMatch);
647 
648     HRESULT GetMixFormat( 
649             /* [annotation][out] */ 
650             out WAVEFORMATEX *ppDeviceFormat);
651 
652     HRESULT GetDevicePeriod( 
653             /* [annotation][out] */ 
654             out REFERENCE_TIME phnsDefaultDevicePeriod,
655             /* [annotation][out] */ 
656             out REFERENCE_TIME phnsMinimumDevicePeriod);
657 
658     HRESULT Start();
659 
660     HRESULT Stop();
661 
662     HRESULT Reset();
663 
664     HRESULT SetEventHandle( /* [in] */ HANDLE eventHandle);
665 
666     HRESULT GetService( 
667             /* [annotation][in] */ 
668             const ref IID riid,
669             /* [annotation][iid_is][out] */ 
670             void **ppv);
671 }
672 
673 enum AUDIO_STREAM_CATEGORY
674 {
675     AudioCategory_Other = 0,
676     AudioCategory_ForegroundOnlyMedia = 1,
677     AudioCategory_BackgroundCapableMedia = 2,
678     AudioCategory_Communications = 3,
679     AudioCategory_Alerts = 4,
680     AudioCategory_SoundEffects = 5,
681     AudioCategory_GameEffects = 6,
682     AudioCategory_GameMedia = 7,
683     AudioCategory_GameChat = 8,
684     AudioCategory_Speech = 9,
685     AudioCategory_Movie = 10,
686     AudioCategory_Media = 11,
687 }
688 
689 enum AUDCLNT_BUFFERFLAGS
690 {
691     AUDCLNT_BUFFERFLAGS_DATA_DISCONTINUITY	= 0x1,
692     AUDCLNT_BUFFERFLAGS_SILENT	= 0x2,
693     AUDCLNT_BUFFERFLAGS_TIMESTAMP_ERROR	= 0x4
694 }
695 
696 struct AudioClientProperties
697 {
698     UINT32 cbSize;
699     BOOL bIsOffload;
700     AUDIO_STREAM_CATEGORY eCategory;
701     AUDCLNT_STREAMOPTIONS Options;
702 }
703 
704 enum AUDCLNT_STREAMOPTIONS
705 {
706     AUDCLNT_STREAMOPTIONS_NONE	= 0,
707     AUDCLNT_STREAMOPTIONS_RAW	= 0x1,
708     AUDCLNT_STREAMOPTIONS_MATCH_FORMAT	= 0x2
709 }
710 
711 //AvSetMmThreadCharacteristics
712 extern HANDLE AvSetMmThreadCharacteristicsA (
713                                immutable (char) * TaskName,
714                                out DWORD TaskIndex
715                                );
716 extern BOOL AvRevertMmThreadCharacteristics (
717                                  HANDLE AvrtHandle
718                                  );
719 
720 
721 const IID IID_IAudioClient2 = makeGuid!"726778CD-F60A-4eda-82DE-E47610CD78AA";
722 interface IAudioClient2 : IAudioClient {
723     HRESULT IsOffloadCapable( 
724             /* [annotation][in] */ 
725             AUDIO_STREAM_CATEGORY Category,
726             /* [annotation][out] */ 
727             out BOOL pbOffloadCapable);
728 
729     HRESULT SetClientProperties( 
730             /* [annotation][in] */ 
731             const ref AudioClientProperties pProperties);
732 
733     HRESULT GetBufferSizeLimits( 
734             /* [annotation][in] */ 
735             const WAVEFORMATEX *pFormat,
736             /* [annotation][in] */ 
737             BOOL bEventDriven,
738             /* [annotation][out] */ 
739             out REFERENCE_TIME phnsMinBufferDuration,
740             /* [annotation][out] */ 
741             out REFERENCE_TIME phnsMaxBufferDuration);
742 }
743 
744 const IID IID_IAudioClient3 = makeGuid!"7ED4EE07-8E67-4CD4-8C1A-2B7A5987AD42";
745 interface IAudioClient3 : IAudioClient2 {
746     HRESULT GetSharedModeEnginePeriod( 
747             /* [annotation][in] */ 
748             const WAVEFORMATEX *pFormat,
749             /* [annotation][out] */ 
750             out UINT32 pDefaultPeriodInFrames,
751             /* [annotation][out] */ 
752             out UINT32 pFundamentalPeriodInFrames,
753             /* [annotation][out] */ 
754             out UINT32 pMinPeriodInFrames,
755             /* [annotation][out] */ 
756             out UINT32 pMaxPeriodInFrames);
757 
758     HRESULT GetCurrentSharedModeEnginePeriod( 
759             /* [unique][annotation][out] */ 
760             out WAVEFORMATEX *ppFormat,
761             /* [annotation][out] */ 
762             out UINT32 pCurrentPeriodInFrames);
763 
764     HRESULT InitializeSharedAudioStream( 
765             /* [annotation][in] */ 
766             DWORD StreamFlags,
767             /* [annotation][in] */ 
768             UINT32 PeriodInFrames,
769             /* [annotation][in] */ 
770             const WAVEFORMATEX *pFormat,
771             /* [annotation][in] */ 
772             LPCGUID AudioSessionGuid);
773 }
774 
775 const IID IID_IAudioRenderClient = makeGuid!"F294ACFC-3146-4483-A7BF-ADDCA7C260E2";
776 interface IAudioRenderClient : IUnknown {
777     HRESULT GetBuffer( 
778             /* [annotation][in] */ 
779             UINT32 NumFramesRequested,
780             /* [annotation][out] */ //_Outptr_result_buffer_(_Inexpressible_("NumFramesRequested * pFormat->nBlockAlign"))  
781             out BYTE *ppData);
782 
783     HRESULT ReleaseBuffer( 
784             /* [annotation][in] */ 
785             UINT32 NumFramesWritten,
786             /* [annotation][in] */ 
787             DWORD dwFlags);
788 }
789 
790 const IID IID_IMMDeviceEnumerator = makeGuid!"A95664D2-9614-4F35-A746-DE8DB63617E6";
791 const CLSID CLSID_MMDeviceEnumerator = makeGuid!"BCDE0395-E52F-467C-8E3D-C4579291692E";
792 interface IMMDeviceEnumerator : IUnknown {
793     HRESULT EnumAudioEndpoints( 
794             /* [in] */ 
795             EDataFlow dataFlow,
796             /* [in] */ 
797             DWORD dwStateMask,
798             /* [out] */ 
799             out IMMDeviceCollection ppDevices);
800     
801     HRESULT GetDefaultAudioEndpoint( 
802             /* [in] */ 
803             EDataFlow dataFlow,
804             /* [in] */ 
805             ERole role,
806             /* [out] */ 
807             out IMMDevice ppEndpoint);
808     
809     HRESULT GetDevice( 
810             /*  */ 
811             LPCWSTR pwstrId,
812             /* [out] */ 
813             IMMDevice *ppDevice);
814     
815     HRESULT RegisterEndpointNotificationCallback( 
816             /* [in] */ 
817             IMMNotificationClient pClient);
818     
819     HRESULT UnregisterEndpointNotificationCallback( 
820             /* [in] */ 
821             IMMNotificationClient pClient);
822 }
823 
824 // Audio Capture
825 
826 const IID IID_IAudioCaptureClient = makeGuid!"C8ADBD64-E71E-48a0-A4DE-185C395CD317";
827 interface IAudioCaptureClient : IUnknown
828 {
829 public:
830     HRESULT GetBuffer( 
831         /* [annotation][out] */ 
832         out BYTE *ppData,
833         /* [annotation][out] */ 
834         out UINT32 pNumFramesToRead,
835         /* [annotation][out] */ 
836         out DWORD pdwFlags,
837         /* [annotation][unique][out] */ 
838         UINT64 *pu64DevicePosition,
839         /* [annotation][unique][out] */ 
840         UINT64 *pu64QPCPosition);
841         
842     HRESULT ReleaseBuffer( 
843         /* [annotation][in] */ 
844         UINT32 NumFramesRead);
845         
846     HRESULT GetNextPacketSize( 
847         /* [annotation][out] */ 
848         out UINT32 pNumFramesInNextPacket);
849         
850 }
851 
852 
853 
854 // endpointvolume.h
855 
856 struct AUDIO_VOLUME_NOTIFICATION_DATA
857 {
858     GUID guidEventContext;
859     BOOL bMuted;
860     float fMasterVolume;
861     UINT nChannels;
862     float[1] afChannelVolumes;
863 }
864 
865 const IID IID_IAudioEndpointVolumeCallback = makeGuid!"657804FA-D6AD-4496-8A60-352752AF4F89";
866 interface IAudioEndpointVolumeCallback : IUnknown
867 {
868     HRESULT OnNotify(AUDIO_VOLUME_NOTIFICATION_DATA * pNotify);
869 }
870 
871 const IID IID_IAudioEndpointVolume = makeGuid!"5CDF2C82-841E-4546-9722-0CF74078229A";
872 interface IAudioEndpointVolume : IUnknown
873 {
874 public:
875     HRESULT RegisterControlChangeNotify( 
876             /* [annotation][in] */ 
877             IAudioEndpointVolumeCallback *pNotify);
878 
879     HRESULT UnregisterControlChangeNotify( 
880             /* [annotation][in] */ 
881             IAudioEndpointVolumeCallback *pNotify);
882 
883     HRESULT GetChannelCount( 
884             /* [annotation][out] */ 
885             out UINT pnChannelCount);
886 
887     HRESULT SetMasterVolumeLevel( 
888             /* [annotation][in] */ 
889             float fLevelDB,
890             /* [unique][in] */ LPCGUID pguidEventContext);
891 
892     HRESULT SetMasterVolumeLevelScalar( 
893             /* [annotation][in] */ 
894             float fLevel,
895             /* [unique][in] */ ref const(GUID) pguidEventContext);
896 
897     HRESULT GetMasterVolumeLevel( 
898             /* [annotation][out] */ 
899             out float pfLevelDB);
900 
901     HRESULT GetMasterVolumeLevelScalar( 
902             /* [annotation][out] */ 
903             out float pfLevel);
904 
905     HRESULT SetChannelVolumeLevel( 
906             /* [annotation][in] */ 
907             UINT nChannel,
908             float fLevelDB,
909             /* [unique][in] */ LPCGUID pguidEventContext);
910 
911     HRESULT SetChannelVolumeLevelScalar( 
912             /* [annotation][in] */ 
913             UINT nChannel,
914             float fLevel,
915             /* [unique][in] */ LPCGUID pguidEventContext);
916 
917     HRESULT GetChannelVolumeLevel( 
918             /* [annotation][in] */ 
919             UINT nChannel,
920             /* [annotation][out] */ 
921             out float pfLevelDB);
922 
923     HRESULT GetChannelVolumeLevelScalar( 
924             /* [annotation][in] */ 
925             UINT nChannel,
926             /* [annotation][out] */ 
927             out float pfLevel);
928 
929     HRESULT SetMute( 
930             /* [annotation][in] */ 
931             BOOL bMute,
932             /* [unique][in] */ ref const(GUID) pguidEventContext);
933 
934     HRESULT GetMute( 
935             /* [annotation][out] */ 
936             out  BOOL pbMute);
937 
938     HRESULT GetVolumeStepInfo( 
939             /* [annotation][out] */ 
940             out UINT pnStep,
941             /* [annotation][out] */ 
942             out UINT pnStepCount);
943 
944     HRESULT VolumeStepUp( 
945             /* [unique][in] */ ref const(GUID) pguidEventContext);
946 
947     HRESULT VolumeStepDown( 
948             /* [unique][in] */ ref const(GUID) pguidEventContext);
949 
950     HRESULT QueryHardwareSupport( 
951             /* [annotation][out] */ 
952             out DWORD pdwHardwareSupportMask);
953 
954     HRESULT GetVolumeRange( 
955             /* [annotation][out] */ 
956             out float pflVolumeMindB,
957             /* [annotation][out] */ 
958             out float pflVolumeMaxdB,
959             /* [annotation][out] */ 
960             out float pflVolumeIncrementdB);
961 }
962 
963 
964 extern HRESULT PropVariantClear(PROPVARIANT* pvar);
965 
966 extern HRESULT FreePropVariantArray(
967                                     ULONG cVariants,
968                                     PROPVARIANT* rgvars);
969 
970