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