1 #pragma once 2 3 /// 4 /// WDMAUD Interface Definition 5 /// 6 /// History: 12/02/2008 Created 7 8 // These are now in sndtypes.h 9 /* 10 typedef enum 11 { 12 DEVICE_TYPE_NONE = 0, 13 DEVICE_TYPE_WAVE_OUT, 14 DEVICE_TYPE_WAVE_IN, 15 DEVICE_TYPE_MIDI_IN, 16 DEVICE_TYPE_MIDI_OUT, 17 DEVICE_TYPE_AUX_IN, 18 DEVICE_TYPE_AUX_OUT 19 20 }AUDIO_DEVICE_TYPE; 21 */ 22 23 #include <sndtypes.h> 24 25 typedef struct 26 { 27 KSSTREAM_HEADER Header; 28 SOUND_DEVICE_TYPE DeviceType; 29 ULONG_PTR DeviceIndex; 30 31 HANDLE hDevice; 32 ULONG DeviceCount; 33 ULONG Flags; 34 35 union 36 { 37 MIXERCAPSW MixCaps; 38 MIXERCONTROLDETAILS MixDetails; 39 MIXERLINECONTROLSW MixControls; 40 MIXERLINEW MixLine; 41 WAVEFORMATEX WaveFormatEx; 42 WAVEOUTCAPSW WaveOutCaps; 43 AUXCAPSW AuxCaps; 44 WAVEINCAPSW WaveInCaps; 45 MIDIINCAPSW MidiInCaps; 46 MIDIOUTCAPSW MidiOutCaps; 47 ULONGLONG Position; 48 struct 49 { 50 LPWSTR DeviceInterfaceString; 51 ULONG DeviceInterfaceStringSize; 52 }Interface; 53 54 struct 55 { 56 HANDLE hMixer; 57 ULONG NotificationType; 58 ULONG Value; 59 }MixerEvent; 60 KSSTATE State; 61 KSRESET ResetStream; 62 ULONG Volume; 63 ULONG FrameSize; 64 HANDLE hNotifyEvent; 65 }u; 66 67 }WDMAUD_DEVICE_INFO, *PWDMAUD_DEVICE_INFO; 68 69 70 71 /// IOCTL_OPEN_WDMAUD 72 /// 73 /// Description: This IOCTL informs wdmaud that an application whats to use wdmsys for a waveOut / waveIn / aux operation 74 /// 75 /// Arguments: InputBuffer is a pointer to a WDMAUD_DEVICE_INFO structure, 76 /// InputBufferSize is size of WDMAUD_DEVICE_INFO structure 77 /// Note: DeviceType identifies the device type, DeviceIndex the index, WaveFormatEx the device details 78 /// Result: is returned in hDevice 79 /// Return Code: STATUS_SUCCESS indicates success, otherwise appropriate error code 80 /// Prerequisites: none 81 82 #define IOCTL_OPEN_WDMAUD \ 83 CTL_CODE(FILE_DEVICE_SOUND, \ 84 0, \ 85 METHOD_BUFFERED, \ 86 FILE_CREATE_TREE_CONNECTION | FILE_ANY_ACCESS) 87 88 89 /// IOCTL_CLOSE_WDMAUD 90 /// 91 /// Description: This IOCTL informs that an application has finished with wdmsys and closes the connection 92 /// 93 /// Arguments: InputBuffer is a pointer to a WDMAUD_DEVICE_INFO structure, 94 /// InputBufferSize is size of WDMAUD_DEVICE_INFO structure 95 /// Note: DeviceType, DeviceIndex and hDevice must be set 96 /// ReturnCode: STATUS_SUCCESS indicates success 97 /// Prerequisites: openend device 98 99 #define IOCTL_CLOSE_WDMAUD \ 100 CTL_CODE(FILE_DEVICE_SOUND, \ 101 1, \ 102 METHOD_BUFFERED, \ 103 FILE_CREATE_TREE_CONNECTION | FILE_ANY_ACCESS) \ 104 105 106 /// IOCTL_GETNUMDEVS_TYPE 107 /// 108 /// Description: This IOCTL queries the number of devices currently present of a specific type. The caller passes a WDMAUD_DEVICE_INFO structure. 109 /// 110 /// Arguments: InputBuffer is a pointer to a WDMAUD_DEVICE_INFO structure, 111 /// InputBufferSize is size of WDMAUD_DEVICE_INFO structure 112 /// Note: The DeviceType contains the requested device type. 113 /// Result: The result is returned in DeviceCount 114 /// ReturnCode: STATUS_SUCCESS indicates success 115 /// Prerequisites: none 116 117 #define IOCTL_GETNUMDEVS_TYPE \ 118 CTL_CODE(FILE_DEVICE_SOUND, \ 119 2, \ 120 METHOD_BUFFERED, \ 121 FILE_CREATE_TREE_CONNECTION | FILE_ANY_ACCESS) 122 123 124 /// IOCTL_SETDEVICE_STATE 125 /// 126 /// Description: This IOCTL sets an opened waveOut / waveIn / midiIn / midiOut / aux device to specific state 127 /// 128 /// Arguments: InputBuffer is a pointer to a WDMAUD_DEVICE_INFO structure, 129 /// InputBufferSize is size of WDMAUD_DEVICE_INFO structure 130 /// Note: The DeviceType, DeviceIndex, hDevice and State member must be set. State determines the new state 131 /// ReturnCode: STATUS_SUCCESS indicates success 132 /// Prerequisites: opened device 133 134 #define IOCTL_SETDEVICE_STATE \ 135 CTL_CODE(FILE_DEVICE_SOUND, \ 136 3, \ 137 METHOD_BUFFERED, \ 138 FILE_CREATE_TREE_CONNECTION | FILE_ANY_ACCESS) 139 140 141 /// IOCTL_GETDEVID 142 /// 143 /// Description: This IOCTL returns the device index by its provided handle 144 /// 145 /// Arguments: InputBuffer is a pointer to a WDMAUD_DEVICE_INFO structure, 146 /// InputBufferSize is size of WDMAUD_DEVICE_INFO structure 147 /// Note: The DeviceType and hDevice must be set 148 /// Result: The result is returned in DeviceIndex 149 /// ReturnCode: STATUS_SUCCESS indicates success 150 /// Prerequisites: opened device 151 152 #define IOCTL_GETDEVID \ 153 CTL_CODE(FILE_DEVICE_SOUND, \ 154 4, \ 155 METHOD_BUFFERED, \ 156 FILE_CREATE_TREE_CONNECTION | FILE_ANY_ACCESS) 157 158 159 /// IOCTL_GETVOLUME 160 /// 161 /// Description: This IOCTL returns the volume a device 162 /// 163 /// Arguments: InputBuffer is a pointer to a WDMAUD_DEVICE_INFO structure, 164 /// InputBufferSize is size of WDMAUD_DEVICE_INFO structure 165 /// Note: The DeviceType and hDevice must be set 166 /// Result: The result is returned in Volume 167 /// ReturnCode: STATUS_SUCCESS indicates success 168 /// Prerequisites: opened device 169 170 #define IOCTL_GETVOLUME \ 171 CTL_CODE(FILE_DEVICE_SOUND, \ 172 5, \ 173 METHOD_BUFFERED, \ 174 FILE_CREATE_TREE_CONNECTION | FILE_ANY_ACCESS) 175 176 177 /// IOCTL_SETVOLUME 178 /// 179 /// Description: This IOCTL sets the volume a device 180 /// 181 /// Arguments: InputBuffer is a pointer to a WDMAUD_DEVICE_INFO structure, 182 /// InputBufferSize is size of WDMAUD_DEVICE_INFO structure 183 /// Note: The DeviceType, hDevice and Volume must be set 184 /// ReturnCode: STATUS_SUCCESS indicates success 185 /// Prerequisites: opened device 186 187 #define IOCTL_SETVOLUME \ 188 CTL_CODE(FILE_DEVICE_SOUND, \ 189 6, \ 190 METHOD_BUFFERED, \ 191 FILE_CREATE_TREE_CONNECTION | FILE_ANY_ACCESS) 192 193 194 /// IOCTL_GETCAPABILITIES 195 /// 196 /// Description: This IOCTL retrieves the capabilities of an specific device 197 /// 198 /// Arguments: InputBuffer is a pointer to a WDMAUD_DEVICE_INFO structure, 199 /// InputBufferSize is size of WDMAUD_DEVICE_INFO structure 200 /// Note: The DeviceType and DeviceIndex must be set 201 /// ReturnCode: STATUS_SUCCESS indicates success 202 /// Prerequisites: none 203 204 #define IOCTL_GETCAPABILITIES \ 205 CTL_CODE(FILE_DEVICE_SOUND, \ 206 7, \ 207 METHOD_BUFFERED, \ 208 FILE_CREATE_TREE_CONNECTION | FILE_ANY_ACCESS) 209 210 211 /// IOCTL_WRITEDATA 212 /// 213 /// Description: This IOCTL writes data to specified device 214 /// 215 /// Arguments: InputBuffer is a pointer to a WDMAUD_DEVICE_INFO structure, 216 /// InputBufferSize is size of WDMAUD_DEVICE_INFO structure 217 /// Note: The DeviceType, DeviceIndex, hDevice, BufferSize and Buffer must be set 218 /// ReturnCode: STATUS_SUCCESS indicates success 219 /// Prerequisites: opened device 220 221 #define IOCTL_WRITEDATA \ 222 CTL_CODE(FILE_DEVICE_SOUND, \ 223 8, \ 224 METHOD_BUFFERED, \ 225 FILE_CREATE_TREE_CONNECTION | FILE_ANY_ACCESS) 226 227 /// IOCTL_GETPOS 228 /// 229 /// Description: This IOCTL retrieves the current playback / write position 230 /// 231 /// Arguments: InputBuffer is a pointer to a WDMAUD_DEVICE_INFO structure, 232 /// InputBufferSize is size of WDMAUD_DEVICE_INFO structure 233 /// Note: The DeviceType and hDevice must be set 234 /// Result: The result is returned in Position 235 /// ReturnCode: STATUS_SUCCESS indicates success 236 /// Prerequisites: opened device 237 238 #define IOCTL_GETPOS \ 239 CTL_CODE(FILE_DEVICE_SOUND, \ 240 9, \ 241 METHOD_BUFFERED, \ 242 FILE_CREATE_TREE_CONNECTION | FILE_ANY_ACCESS) 243 244 /// IOCTL_GETFRAMESIZE 245 /// 246 /// Description: This IOCTL retrieves the frame size requirements for an audio pin 247 /// 248 /// Arguments: InputBuffer is a pointer to a WDMAUD_DEVICE_INFO structure, 249 /// InputBufferSize is size of WDMAUD_DEVICE_INFO structure 250 /// Note: The DeviceType and hDevice must be set 251 /// Result: The result is returned in FrameSize 252 /// ReturnCode: STATUS_SUCCESS indicates success 253 /// Prerequisites: opened device 254 255 #define IOCTL_GETFRAMESIZE \ 256 CTL_CODE(FILE_DEVICE_SOUND, \ 257 10, \ 258 METHOD_BUFFERED, \ 259 FILE_CREATE_TREE_CONNECTION | FILE_ANY_ACCESS) 260 261 /// IOCTL_GETLINEINFO 262 /// 263 /// Description: This IOCTL retrieves information on a mixerline 264 /// 265 /// Arguments: InputBuffer is a pointer to a WDMAUD_DEVICE_INFO structure, 266 /// InputBufferSize is size of WDMAUD_DEVICE_INFO structure 267 /// Note: The hDevice member must be set 268 /// Result: The result is returned in MixLine 269 /// ReturnCode: STATUS_SUCCESS indicates success 270 /// Prerequisites: opened device 271 272 #define IOCTL_GETLINEINFO \ 273 CTL_CODE(FILE_DEVICE_SOUND, \ 274 11, \ 275 METHOD_BUFFERED, \ 276 FILE_CREATE_TREE_CONNECTION | FILE_ANY_ACCESS) 277 278 279 /// IOCTL_GETLINECONTROLS 280 /// 281 /// Description: This IOCTL retrieves controls of a mixerline 282 /// 283 /// Arguments: InputBuffer is a pointer to a WDMAUD_DEVICE_INFO structure, 284 /// InputBufferSize is size of WDMAUD_DEVICE_INFO structure 285 /// Note: The hDevice member must be set 286 /// Result: The result is returned in MixControls 287 /// ReturnCode: STATUS_SUCCESS indicates success 288 /// Prerequisites: opened device 289 290 #define IOCTL_GETLINECONTROLS \ 291 CTL_CODE(FILE_DEVICE_SOUND, \ 292 12, \ 293 METHOD_BUFFERED, \ 294 FILE_CREATE_TREE_CONNECTION | FILE_ANY_ACCESS) 295 296 297 /// IOCTL_SETCONTROLDETAILS 298 /// 299 /// Description: This IOCTL sets details of a control of a mixerline 300 /// 301 /// Arguments: InputBuffer is a pointer to a WDMAUD_DEVICE_INFO structure, 302 /// InputBufferSize is size of WDMAUD_DEVICE_INFO structure 303 /// Note: The hDevice member must be set 304 /// ReturnCode: STATUS_SUCCESS indicates success 305 /// Prerequisites: opened device 306 307 #define IOCTL_SETCONTROLDETAILS \ 308 CTL_CODE(FILE_DEVICE_SOUND, \ 309 13, \ 310 METHOD_BUFFERED, \ 311 FILE_CREATE_TREE_CONNECTION | FILE_ANY_ACCESS) 312 313 314 /// IOCTL_GETCONTROLDETAILS 315 /// 316 /// Description: This IOCTL gets details of a control of a mixerline 317 /// 318 /// Arguments: InputBuffer is a pointer to a WDMAUD_DEVICE_INFO structure, 319 /// InputBufferSize is size of WDMAUD_DEVICE_INFO structure 320 /// Note: The hDevice member must be set 321 /// Result: The result is returned in MixDetails 322 /// ReturnCode: STATUS_SUCCESS indicates success 323 /// Prerequisites: opened device 324 325 #define IOCTL_GETCONTROLDETAILS \ 326 CTL_CODE(FILE_DEVICE_SOUND, \ 327 14, \ 328 METHOD_BUFFERED, \ 329 FILE_CREATE_TREE_CONNECTION | FILE_ANY_ACCESS) 330 331 332 /// IOCTL_QUERYDEVICEINTERFACESTRING 333 /// 334 /// Description: This IOCTL queries the mixer / playback / recording device for its device interface string 335 /// 336 /// Arguments: InputBuffer is a pointer to a WDMAUD_DEVICE_INFO structure, 337 /// InputBufferSize is size of WDMAUD_DEVICE_INFO structure 338 /// Note: The DeviceType, DeviceIndex must be set 339 /// Result: The size is returned in Interface.DeviceInterfaceStringSize and if a buffer is supplied in Interface.DeviceInterfaceString 340 /// the device interface string is stored 341 /// ReturnCode: STATUS_SUCCESS indicates success 342 343 #define IOCTL_QUERYDEVICEINTERFACESTRING \ 344 CTL_CODE(FILE_DEVICE_SOUND, \ 345 15, \ 346 METHOD_BUFFERED, \ 347 FILE_CREATE_TREE_CONNECTION | FILE_ANY_ACCESS) 348 349 /// IOCTL_GET_MIXER_EVENT 350 /// 351 /// Description: This IOCTL queries for wdmaud driver if there any new kernel streaming events available 352 /// 353 /// Arguments: InputBuffer is a pointer to a WDMAUD_DEVICE_INFO structure, 354 /// InputBufferSize is size of WDMAUD_DEVICE_INFO structure 355 /// Note: The hDevice member must be set 356 /// Result: The result is returned in the struct MixerInfo 357 /// ReturnCode: STATUS_SUCCESS indicates success 358 359 #define IOCTL_GET_MIXER_EVENT \ 360 CTL_CODE(FILE_DEVICE_SOUND, \ 361 16, \ 362 METHOD_BUFFERED, \ 363 FILE_CREATE_TREE_CONNECTION | FILE_ANY_ACCESS) 364 365 /// IOCTL_RESET_STREAM 366 /// 367 /// Description: This IOCTL instructs wdmaud to reset a stream 368 /// 369 /// Arguments: InputBuffer is a pointer to a WDMAUD_DEVICE_INFO structure, 370 /// InputBufferSize is size of WDMAUD_DEVICE_INFO structure 371 /// Note: The hDevice member must be set and DeviceType 372 /// ReturnCode: STATUS_SUCCESS indicates success 373 374 #define IOCTL_RESET_STREAM \ 375 CTL_CODE(FILE_DEVICE_SOUND, \ 376 17, \ 377 METHOD_BUFFERED, \ 378 FILE_CREATE_TREE_CONNECTION | FILE_ANY_ACCESS) 379