caf0175dfb0974ee3ef2a4dfa83f5dd6641323b2
[reactos.git] / reactos / drivers / wdm / audio / legacy / wdmaud / wdmaud.h
1 #include <pseh/pseh2.h>
2 #include <ntddk.h>
3 #include <portcls.h>
4 #include <ks.h>
5 #include <ksmedia.h>
6 #include <mmreg.h>
7 #include <mmsystem.h>
8 #include <stdlib.h>
9 #include <stdio.h>
10 #include <wchar.h>
11 #include "mmixer.h"
12
13 #include "interface.h"
14
15 typedef struct
16 {
17 PMDL Mdl;
18 ULONG Length;
19 ULONG Function;
20 }WDMAUD_COMPLETION_CONTEXT, *PWDMAUD_COMPLETION_CONTEXT;
21
22
23 typedef struct
24 {
25 HANDLE Handle;
26 SOUND_DEVICE_TYPE Type;
27 ULONG FilterId;
28 ULONG PinId;
29 PRKEVENT NotifyEvent;
30 }WDMAUD_HANDLE, *PWDMAUD_HANDLE;
31
32 typedef struct
33 {
34 LIST_ENTRY Entry;
35 HANDLE hProcess;
36 ULONG NumPins;
37 WDMAUD_HANDLE * hPins;
38
39 LIST_ENTRY MixerEventList;
40 }WDMAUD_CLIENT, *PWDMAUD_CLIENT;
41
42 typedef struct
43 {
44 LIST_ENTRY Entry;
45 ULONG NotificationType;
46 ULONG Value;
47 HANDLE hMixer;
48 }EVENT_ENTRY, *PEVENT_ENTRY;
49
50 typedef struct
51 {
52 LIST_ENTRY Entry;
53 UNICODE_STRING SymbolicLink;
54 }SYSAUDIO_ENTRY, *PSYSAUDIO_ENTRY;
55
56 typedef struct
57 {
58 KSDEVICE_HEADER DeviceHeader;
59 PVOID SysAudioNotification;
60
61 BOOL DeviceInterfaceSupport;
62
63 KSPIN_LOCK Lock;
64 ULONG NumSysAudioDevices;
65 LIST_ENTRY SysAudioDeviceList;
66 HANDLE hSysAudio;
67 PFILE_OBJECT FileObject;
68 LIST_ENTRY WdmAudClientList;
69
70 ULONG SysAudioDeviceCount;
71 PIO_WORKITEM WorkItem;
72 KEVENT InitializationCompletionEvent;
73 ULONG WorkItemActive;
74
75 }WDMAUD_DEVICE_EXTENSION, *PWDMAUD_DEVICE_EXTENSION;
76
77 typedef struct
78 {
79 PWDMAUD_CLIENT ClientInfo;
80 PWDMAUD_DEVICE_EXTENSION DeviceExtension;
81 SOUND_DEVICE_TYPE DeviceType;
82 }PIN_CREATE_CONTEXT, *PPIN_CREATE_CONTEXT;
83
84
85 NTSTATUS
86 NTAPI
87 OpenWavePin(
88 IN PWDMAUD_DEVICE_EXTENSION DeviceExtension,
89 IN ULONG FilterId,
90 IN ULONG PinId,
91 IN LPWAVEFORMATEX WaveFormatEx,
92 IN ACCESS_MASK DesiredAccess,
93 OUT PHANDLE PinHandle);
94
95 NTSTATUS
96 WdmAudRegisterDeviceInterface(
97 IN PDEVICE_OBJECT PhysicalDeviceObject,
98 IN PWDMAUD_DEVICE_EXTENSION DeviceExtension);
99
100 NTSTATUS
101 WdmAudOpenSysAudioDevices(
102 IN PDEVICE_OBJECT DeviceObject,
103 IN PWDMAUD_DEVICE_EXTENSION DeviceExtension);
104
105 NTSTATUS
106 WdmAudOpenSysaudio(
107 IN PDEVICE_OBJECT DeviceObject,
108 IN PWDMAUD_CLIENT *pClient);
109
110 NTSTATUS
111 NTAPI
112 WdmAudDeviceControl(
113 IN PDEVICE_OBJECT DeviceObject,
114 IN PIRP Irp);
115
116 NTSTATUS
117 NTAPI
118 WdmAudReadWrite(
119 IN PDEVICE_OBJECT DeviceObject,
120 IN PIRP Irp);
121
122 NTSTATUS
123 NTAPI
124 WdmAudWrite(
125 IN PDEVICE_OBJECT DeviceObject,
126 IN PIRP Irp);
127
128 NTSTATUS
129 WdmAudControlOpenMixer(
130 IN PDEVICE_OBJECT DeviceObject,
131 IN PIRP Irp,
132 IN PWDMAUD_DEVICE_INFO DeviceInfo,
133 IN PWDMAUD_CLIENT ClientInfo);
134
135 NTSTATUS
136 WdmAudControlOpenWave(
137 IN PDEVICE_OBJECT DeviceObject,
138 IN PIRP Irp,
139 IN PWDMAUD_DEVICE_INFO DeviceInfo,
140 IN PWDMAUD_CLIENT ClientInfo);
141
142 NTSTATUS
143 WdmAudControlOpenMidi(
144 IN PDEVICE_OBJECT DeviceObject,
145 IN PIRP Irp,
146 IN PWDMAUD_DEVICE_INFO DeviceInfo,
147 IN PWDMAUD_CLIENT ClientInfo);
148
149 ULONG
150 GetNumOfMixerDevices(
151 IN PDEVICE_OBJECT DeviceObject);
152
153 NTSTATUS
154 SetIrpIoStatus(
155 IN PIRP Irp,
156 IN NTSTATUS Status,
157 IN ULONG Length);
158
159 NTSTATUS
160 WdmAudOpenSysAudioDevice(
161 IN LPWSTR DeviceName,
162 OUT PHANDLE Handle);
163
164 NTSTATUS
165 FindProductName(
166 IN LPWSTR PnpName,
167 IN ULONG ProductNameSize,
168 OUT LPWSTR ProductName);
169
170 NTSTATUS
171 WdmAudMixerCapabilities(
172 IN PDEVICE_OBJECT DeviceObject,
173 IN PWDMAUD_DEVICE_INFO DeviceInfo,
174 IN PWDMAUD_CLIENT ClientInfo,
175 IN PWDMAUD_DEVICE_EXTENSION DeviceExtension);
176
177 NTSTATUS
178 WdmAudWaveCapabilities(
179 IN PDEVICE_OBJECT DeviceObject,
180 IN PWDMAUD_DEVICE_INFO DeviceInfo,
181 IN PWDMAUD_CLIENT ClientInfo,
182 IN PWDMAUD_DEVICE_EXTENSION DeviceExtension);
183
184 NTSTATUS
185 WdmAudMidiCapabilities(
186 IN PDEVICE_OBJECT DeviceObject,
187 IN PWDMAUD_DEVICE_INFO DeviceInfo,
188 IN PWDMAUD_CLIENT ClientInfo,
189 IN PWDMAUD_DEVICE_EXTENSION DeviceExtension);
190
191 NTSTATUS
192 NTAPI
193 WdmAudFrameSize(
194 IN PDEVICE_OBJECT DeviceObject,
195 IN PIRP Irp,
196 IN PWDMAUD_DEVICE_INFO DeviceInfo,
197 IN PWDMAUD_CLIENT ClientInfo);
198
199 NTSTATUS
200 NTAPI
201 WdmAudGetLineInfo(
202 IN PDEVICE_OBJECT DeviceObject,
203 IN PIRP Irp,
204 IN PWDMAUD_DEVICE_INFO DeviceInfo,
205 IN PWDMAUD_CLIENT ClientInfo);
206
207 NTSTATUS
208 NTAPI
209 WdmAudGetLineControls(
210 IN PDEVICE_OBJECT DeviceObject,
211 IN PIRP Irp,
212 IN PWDMAUD_DEVICE_INFO DeviceInfo,
213 IN PWDMAUD_CLIENT ClientInfo);
214
215 NTSTATUS
216 NTAPI
217 WdmAudSetControlDetails(
218 IN PDEVICE_OBJECT DeviceObject,
219 IN PIRP Irp,
220 IN PWDMAUD_DEVICE_INFO DeviceInfo,
221 IN PWDMAUD_CLIENT ClientInfo);
222
223 NTSTATUS
224 NTAPI
225 WdmAudGetMixerEvent(
226 IN PDEVICE_OBJECT DeviceObject,
227 IN PIRP Irp,
228 IN PWDMAUD_DEVICE_INFO DeviceInfo,
229 IN PWDMAUD_CLIENT ClientInfo);
230
231 NTSTATUS
232 NTAPI
233 WdmAudGetControlDetails(
234 IN PDEVICE_OBJECT DeviceObject,
235 IN PIRP Irp,
236 IN PWDMAUD_DEVICE_INFO DeviceInfo,
237 IN PWDMAUD_CLIENT ClientInfo);
238
239 NTSTATUS
240 WdmAudMixerInitialize(
241 IN PDEVICE_OBJECT DeviceObject);
242
243 NTSTATUS
244 NTAPI
245 WdmAudWaveInitialize(
246 IN PDEVICE_OBJECT DeviceObject);
247
248 ULONG
249 ClosePin(
250 IN PWDMAUD_CLIENT ClientInfo,
251 IN ULONG FilterId,
252 IN ULONG PinId,
253 IN SOUND_DEVICE_TYPE DeviceType);
254
255 NTSTATUS
256 InsertPinHandle(
257 IN PWDMAUD_CLIENT ClientInfo,
258 IN ULONG FilterId,
259 IN ULONG PinId,
260 IN SOUND_DEVICE_TYPE DeviceType,
261 IN HANDLE PinHandle,
262 IN ULONG FreeIndex);
263
264 NTSTATUS
265 GetSysAudioDevicePnpName(
266 IN PDEVICE_OBJECT DeviceObject,
267 IN ULONG DeviceIndex,
268 OUT LPWSTR * Device);
269
270 NTSTATUS
271 OpenSysAudioDeviceByIndex(
272 IN PDEVICE_OBJECT DeviceObject,
273 IN ULONG DeviceIndex,
274 IN PHANDLE DeviceHandle,
275 IN PFILE_OBJECT * FileObject);
276
277 NTSTATUS
278 OpenDevice(
279 IN LPWSTR Device,
280 OUT PHANDLE DeviceHandle,
281 OUT PFILE_OBJECT * FileObject);
282
283 ULONG
284 WdmAudGetMixerDeviceCount(VOID);
285
286 ULONG
287 WdmAudGetWaveInDeviceCount(VOID);
288
289 ULONG
290 WdmAudGetWaveOutDeviceCount(VOID);
291
292 ULONG
293 WdmAudGetMidiInDeviceCount(VOID);
294
295 ULONG
296 WdmAudGetMidiOutDeviceCount(VOID);
297
298 NTSTATUS
299 WdmAudGetPnpNameByIndexAndType(
300 IN ULONG DeviceIndex,
301 IN SOUND_DEVICE_TYPE DeviceType,
302 OUT LPWSTR *Device);
303
304
305 /* sup.c */
306
307 ULONG
308 GetSysAudioDeviceCount(
309 IN PDEVICE_OBJECT DeviceObject);
310
311
312 PVOID
313 AllocateItem(
314 IN POOL_TYPE PoolType,
315 IN SIZE_T NumberOfBytes);
316
317 VOID
318 FreeItem(
319 IN PVOID Item);
320