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