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