d3f5286b66e7de0606c224e3e2461fe464921865
[reactos.git] / reactos / drivers / wdm / audio / legacy / wdmaud / interface.h
1 #ifndef INTERFACE_H__
2 #define INTERFACE_H__
3
4 ///
5 /// WDMAUD Interface Definition
6 ///
7 /// History: 12/02/2008 Created
8
9 // These are now in sndtypes.h
10 /*
11 typedef enum
12 {
13 DEVICE_TYPE_NONE = 0,
14 DEVICE_TYPE_WAVE_OUT,
15 DEVICE_TYPE_WAVE_IN,
16 DEVICE_TYPE_MIDI_IN,
17 DEVICE_TYPE_MIDI_OUT,
18 DEVICE_TYPE_AUX_IN,
19 DEVICE_TYPE_AUX_OUT
20
21 }AUDIO_DEVICE_TYPE;
22 */
23
24 #include <sndtypes.h>
25
26 typedef struct
27 {
28 SOUND_DEVICE_TYPE DeviceType;
29 ULONG DeviceIndex;
30
31 HANDLE hDevice;
32 ULONG DeviceCount;
33
34 ULONG BufferSize;
35 PUCHAR Buffer;
36
37 union
38 {
39 WAVEFORMATEX WaveFormatEx;
40 WAVEOUTCAPSW WaveOutCaps;
41 AUXCAPSW AuxCaps;
42 WAVEINCAPSW WaveInCaps;
43 ULONGLONG Position;
44 KSSTATE State;
45 ULONG Volume;
46 ULONG FrameSize;
47 }u;
48
49 }WDMAUD_DEVICE_INFO, *PWDMAUD_DEVICE_INFO;
50
51
52
53 /// IOCTL_OPEN_WDMAUD
54 ///
55 /// Description: This IOCTL informs wdmaud that an application whats to use wdmsys for a waveOut / waveIn / aux operation
56 ///
57 /// Arguments: InputBuffer is a pointer to a WDMAUD_DEVICE_INFO structure,
58 /// InputBufferSize is size of WDMAUD_DEVICE_INFO structure
59 /// Note: DeviceType identifies the device type, DeviceIndex the index, WaveFormatEx the device details
60 /// Result: is returned in hDevice
61 /// Return Code: STATUS_SUCCESS indicates success, otherwise appropiate error code
62 /// Prequsites: none
63
64 #define IOCTL_OPEN_WDMAUD \
65 CTL_CODE(FILE_DEVICE_SOUND, \
66 0, \
67 METHOD_BUFFERED, \
68 FILE_CREATE_TREE_CONNECTION | FILE_ANY_ACCESS)
69
70
71 /// IOCTL_CLOSE_WDMAUD
72 ///
73 /// Description: This IOCTL informs that an application has finished with wdmsys and closes the connection
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, DeviceIndex and hDevice must be set
78 /// ReturnCode: STATUS_SUCCESS indicates success
79 /// Prequsites: openend device
80
81 #define IOCTL_CLOSE_WDMAUD \
82 CTL_CODE(FILE_DEVICE_SOUND, \
83 1, \
84 METHOD_BUFFERED, \
85 FILE_CREATE_TREE_CONNECTION | FILE_ANY_ACCESS) \
86
87
88 /// IOCTL_GETNUMDEVS_TYPE
89 ///
90 /// Description: This IOCTL queries the number of devices currently present of a specific type. The caller passes a WDMAUD_DEVICE_INFO structure.
91 ///
92 /// Arguments: InputBuffer is a pointer to a WDMAUD_DEVICE_INFO structure,
93 /// InputBufferSize is size of WDMAUD_DEVICE_INFO structure
94 /// Note: The DeviceType contains the requested device type.
95 /// Result: The result is returned in DeviceCount
96 /// ReturnCode: STATUS_SUCCESS indicates success
97 /// Prequsites: none
98
99 #define IOCTL_GETNUMDEVS_TYPE \
100 CTL_CODE(FILE_DEVICE_SOUND, \
101 2, \
102 METHOD_BUFFERED, \
103 FILE_CREATE_TREE_CONNECTION | FILE_ANY_ACCESS)
104
105
106 /// IOCTL_SETDEVICE_STATE
107 ///
108 /// Description: This IOCTL sets an opened waveOut / waveIn / midiIn / midiOut / aux device to specific state
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, DeviceIndex, hDevice and State member must be set. State determines the new state
113 /// ReturnCode: STATUS_SUCCESS indicates success
114 /// Prequsites: opened device
115
116 #define IOCTL_SETDEVICE_STATE \
117 CTL_CODE(FILE_DEVICE_SOUND, \
118 3, \
119 METHOD_BUFFERED, \
120 FILE_CREATE_TREE_CONNECTION | FILE_ANY_ACCESS)
121
122
123 /// IOCTL_GETDEVID
124 ///
125 /// Description: This IOCTL returns the device index by its provided handle
126 ///
127 /// Arguments: InputBuffer is a pointer to a WDMAUD_DEVICE_INFO structure,
128 /// InputBufferSize is size of WDMAUD_DEVICE_INFO structure
129 /// Note: The DeviceType and hDevice must be set
130 /// Result: The result is returned in DeviceIndex
131 /// ReturnCode: STATUS_SUCCESS indicates success
132 /// Prequsites: opened device
133
134 #define IOCTL_GETDEVID \
135 CTL_CODE(FILE_DEVICE_SOUND, \
136 4, \
137 METHOD_BUFFERED, \
138 FILE_CREATE_TREE_CONNECTION | FILE_ANY_ACCESS)
139
140
141 /// IOCTL_GETVOLUME
142 ///
143 /// Description: This IOCTL returns the volume a device
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 Volume
149 /// ReturnCode: STATUS_SUCCESS indicates success
150 /// Prequsites: opened device
151
152 #define IOCTL_GETVOLUME \
153 CTL_CODE(FILE_DEVICE_SOUND, \
154 5, \
155 METHOD_BUFFERED, \
156 FILE_CREATE_TREE_CONNECTION | FILE_ANY_ACCESS)
157
158
159 /// IOCTL_SETVOLUME
160 ///
161 /// Description: This IOCTL sets 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, hDevice and Volume must be set
166 /// ReturnCode: STATUS_SUCCESS indicates success
167 /// Prequsites: opened device
168
169 #define IOCTL_SETVOLUME \
170 CTL_CODE(FILE_DEVICE_SOUND, \
171 6, \
172 METHOD_BUFFERED, \
173 FILE_CREATE_TREE_CONNECTION | FILE_ANY_ACCESS)
174
175
176 /// IOCTL_GETCAPABILTIES
177 ///
178 /// Description: This IOCTL retrieves the capabilties of an specific device
179 ///
180 /// Arguments: InputBuffer is a pointer to a WDMAUD_DEVICE_INFO structure,
181 /// InputBufferSize is size of WDMAUD_DEVICE_INFO structure
182 /// Note: The DeviceType and DeviceIndex must be set
183 /// ReturnCode: STATUS_SUCCESS indicates success
184 /// Prequsites: none
185
186 #define IOCTL_GETCAPABILITIES \
187 CTL_CODE(FILE_DEVICE_SOUND, \
188 7, \
189 METHOD_BUFFERED, \
190 FILE_CREATE_TREE_CONNECTION | FILE_ANY_ACCESS)
191
192
193 /// IOCTL_WRITEDATA
194 ///
195 /// Description: This IOCTL writes data to specified device
196 ///
197 /// Arguments: InputBuffer is a pointer to a WDMAUD_DEVICE_INFO structure,
198 /// InputBufferSize is size of WDMAUD_DEVICE_INFO structure
199 /// Note: The DeviceType, DeviceIndex, hDevice, BufferSize and Buffer must be set
200 /// ReturnCode: STATUS_SUCCESS indicates success
201 /// Prequsites: opened device
202
203 #define IOCTL_WRITEDATA \
204 CTL_CODE(FILE_DEVICE_SOUND, \
205 8, \
206 METHOD_BUFFERED, \
207 FILE_CREATE_TREE_CONNECTION | FILE_ANY_ACCESS)
208
209 /// IOCTL_GETPOS
210 ///
211 /// Description: This IOCTL retrieves the current playback / write position
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 and hDevice must be set
216 /// Result: The result is returned in Position
217 /// ReturnCode: STATUS_SUCCESS indicates success
218 /// Prequsites: opened device
219
220 #define IOCTL_GETPOS \
221 CTL_CODE(FILE_DEVICE_SOUND, \
222 9, \
223 METHOD_BUFFERED, \
224 FILE_CREATE_TREE_CONNECTION | FILE_ANY_ACCESS)
225
226 /// IOCTL_GETFRAMESIZE
227 ///
228 /// Description: This IOCTL retrieves the frame size requirements for an audio pin
229 ///
230 /// Arguments: InputBuffer is a pointer to a WDMAUD_DEVICE_INFO structure,
231 /// InputBufferSize is size of WDMAUD_DEVICE_INFO structure
232 /// Note: The DeviceType and hDevice must be set
233 /// Result: The result is returned in FrameSize
234 /// ReturnCode: STATUS_SUCCESS indicates success
235 /// Prequsites: opened device
236
237 #define IOCTL_GETFRAMESIZE \
238 CTL_CODE(FILE_DEVICE_SOUND, \
239 10, \
240 METHOD_BUFFERED, \
241 FILE_CREATE_TREE_CONNECTION | FILE_ANY_ACCESS)
242
243
244 #endif