0258c8e6691cfa572c9c0db83136a5b86f612ddd
[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 HANDLE Handle;
22 SOUND_DEVICE_TYPE Type;
23 ULONG FilterId;
24 ULONG PinId;
25 PRKEVENT NotifyEvent;
26 }WDMAUD_HANDLE, *PWDMAUD_HANDLE;
27
28 typedef struct
29 {
30 LIST_ENTRY Entry;
31 HANDLE hProcess;
32 ULONG NumPins;
33 WDMAUD_HANDLE * hPins;
34
35 LIST_ENTRY MixerEventList;
36 }WDMAUD_CLIENT, *PWDMAUD_CLIENT;
37
38 typedef struct
39 {
40 LIST_ENTRY Entry;
41 UNICODE_STRING SymbolicLink;
42 }SYSAUDIO_ENTRY, *PSYSAUDIO_ENTRY;
43
44 typedef struct
45 {
46 KSDEVICE_HEADER DeviceHeader;
47 PVOID SysAudioNotification;
48
49 BOOL DeviceInterfaceSupport;
50
51 KSPIN_LOCK Lock;
52 ULONG NumSysAudioDevices;
53 LIST_ENTRY SysAudioDeviceList;
54 HANDLE hSysAudio;
55 PFILE_OBJECT FileObject;
56
57 LIST_ENTRY WdmAudClientList;
58 }WDMAUD_DEVICE_EXTENSION, *PWDMAUD_DEVICE_EXTENSION;
59
60 typedef struct
61 {
62 PWDMAUD_CLIENT ClientInfo;
63 PWDMAUD_DEVICE_EXTENSION DeviceExtension;
64 SOUND_DEVICE_TYPE DeviceType;
65 }PIN_CREATE_CONTEXT, *PPIN_CREATE_CONTEXT;
66
67
68 NTSTATUS
69 NTAPI
70 OpenWavePin(
71 IN PWDMAUD_DEVICE_EXTENSION DeviceExtension,
72 IN ULONG FilterId,
73 IN ULONG PinId,
74 IN LPWAVEFORMATEX WaveFormatEx,
75 IN ACCESS_MASK DesiredAccess,
76 OUT PHANDLE PinHandle);
77
78 NTSTATUS
79 WdmAudRegisterDeviceInterface(
80 IN PDEVICE_OBJECT PhysicalDeviceObject,
81 IN PWDMAUD_DEVICE_EXTENSION DeviceExtension);
82
83 NTSTATUS
84 WdmAudOpenSysAudioDevices(
85 IN PDEVICE_OBJECT DeviceObject,
86 IN PWDMAUD_DEVICE_EXTENSION DeviceExtension);
87
88 NTSTATUS
89 WdmAudOpenSysaudio(
90 IN PDEVICE_OBJECT DeviceObject,
91 IN PWDMAUD_CLIENT *pClient);
92
93 NTSTATUS
94 NTAPI
95 WdmAudDeviceControl(
96 IN PDEVICE_OBJECT DeviceObject,
97 IN PIRP Irp);
98
99 NTSTATUS
100 NTAPI
101 WdmAudReadWrite(
102 IN PDEVICE_OBJECT DeviceObject,
103 IN PIRP Irp);
104
105 NTSTATUS
106 NTAPI
107 WdmAudWrite(
108 IN PDEVICE_OBJECT DeviceObject,
109 IN PIRP Irp);
110
111 NTSTATUS
112 WdmAudControlOpenMixer(
113 IN PDEVICE_OBJECT DeviceObject,
114 IN PIRP Irp,
115 IN PWDMAUD_DEVICE_INFO DeviceInfo,
116 IN PWDMAUD_CLIENT ClientInfo);
117
118 NTSTATUS
119 WdmAudControlOpenWave(
120 IN PDEVICE_OBJECT DeviceObject,
121 IN PIRP Irp,
122 IN PWDMAUD_DEVICE_INFO DeviceInfo,
123 IN PWDMAUD_CLIENT ClientInfo);
124
125
126 ULONG
127 GetNumOfMixerDevices(
128 IN PDEVICE_OBJECT DeviceObject);
129
130 NTSTATUS
131 SetIrpIoStatus(
132 IN PIRP Irp,
133 IN NTSTATUS Status,
134 IN ULONG Length);
135
136 NTSTATUS
137 WdmAudOpenSysAudioDevice(
138 IN LPWSTR DeviceName,
139 OUT PHANDLE Handle);
140
141 NTSTATUS
142 FindProductName(
143 IN LPWSTR PnpName,
144 IN ULONG ProductNameSize,
145 OUT LPWSTR ProductName);
146
147 NTSTATUS
148 WdmAudMixerCapabilities(
149 IN PDEVICE_OBJECT DeviceObject,
150 IN PWDMAUD_DEVICE_INFO DeviceInfo,
151 IN PWDMAUD_CLIENT ClientInfo,
152 IN PWDMAUD_DEVICE_EXTENSION DeviceExtension);
153
154 NTSTATUS
155 WdmAudWaveCapabilities(
156 IN PDEVICE_OBJECT DeviceObject,
157 IN PWDMAUD_DEVICE_INFO DeviceInfo,
158 IN PWDMAUD_CLIENT ClientInfo,
159 IN PWDMAUD_DEVICE_EXTENSION DeviceExtension);
160
161 NTSTATUS
162 NTAPI
163 WdmAudFrameSize(
164 IN PDEVICE_OBJECT DeviceObject,
165 IN PIRP Irp,
166 IN PWDMAUD_DEVICE_INFO DeviceInfo,
167 IN PWDMAUD_CLIENT ClientInfo);
168
169 NTSTATUS
170 NTAPI
171 WdmAudGetLineInfo(
172 IN PDEVICE_OBJECT DeviceObject,
173 IN PIRP Irp,
174 IN PWDMAUD_DEVICE_INFO DeviceInfo,
175 IN PWDMAUD_CLIENT ClientInfo);
176
177 NTSTATUS
178 NTAPI
179 WdmAudGetLineControls(
180 IN PDEVICE_OBJECT DeviceObject,
181 IN PIRP Irp,
182 IN PWDMAUD_DEVICE_INFO DeviceInfo,
183 IN PWDMAUD_CLIENT ClientInfo);
184
185 NTSTATUS
186 NTAPI
187 WdmAudSetControlDetails(
188 IN PDEVICE_OBJECT DeviceObject,
189 IN PIRP Irp,
190 IN PWDMAUD_DEVICE_INFO DeviceInfo,
191 IN PWDMAUD_CLIENT ClientInfo);
192
193 NTSTATUS
194 NTAPI
195 WdmAudGetMixerEvent(
196 IN PDEVICE_OBJECT DeviceObject,
197 IN PIRP Irp,
198 IN PWDMAUD_DEVICE_INFO DeviceInfo,
199 IN PWDMAUD_CLIENT ClientInfo);
200
201 NTSTATUS
202 NTAPI
203 WdmAudGetControlDetails(
204 IN PDEVICE_OBJECT DeviceObject,
205 IN PIRP Irp,
206 IN PWDMAUD_DEVICE_INFO DeviceInfo,
207 IN PWDMAUD_CLIENT ClientInfo);
208
209 NTSTATUS
210 WdmAudMixerInitialize(
211 IN PDEVICE_OBJECT DeviceObject);
212
213 NTSTATUS
214 NTAPI
215 WdmAudWaveInitialize(
216 IN PDEVICE_OBJECT DeviceObject);
217
218 ULONG
219 ClosePin(
220 IN PWDMAUD_CLIENT ClientInfo,
221 IN ULONG FilterId,
222 IN ULONG PinId,
223 IN SOUND_DEVICE_TYPE DeviceType);
224
225 NTSTATUS
226 InsertPinHandle(
227 IN PWDMAUD_CLIENT ClientInfo,
228 IN ULONG FilterId,
229 IN ULONG PinId,
230 IN SOUND_DEVICE_TYPE DeviceType,
231 IN HANDLE PinHandle,
232 IN ULONG FreeIndex);
233
234 NTSTATUS
235 GetSysAudioDevicePnpName(
236 IN PDEVICE_OBJECT DeviceObject,
237 IN ULONG DeviceIndex,
238 OUT LPWSTR * Device);
239
240 NTSTATUS
241 OpenSysAudioDeviceByIndex(
242 IN PDEVICE_OBJECT DeviceObject,
243 IN ULONG DeviceIndex,
244 IN PHANDLE DeviceHandle,
245 IN PFILE_OBJECT * FileObject);
246
247 NTSTATUS
248 OpenDevice(
249 IN LPWSTR Device,
250 OUT PHANDLE DeviceHandle,
251 OUT PFILE_OBJECT * FileObject);
252
253 ULONG
254 WdmAudGetMixerDeviceCount();
255
256 ULONG
257 WdmAudGetWaveInDeviceCount();
258
259 ULONG
260 WdmAudGetWaveOutDeviceCount();
261
262 NTSTATUS
263 WdmAudGetMixerPnpNameByIndex(
264 IN ULONG DeviceIndex,
265 OUT LPWSTR * Device);
266
267 NTSTATUS
268 WdmAudGetPnpNameByIndexAndType(
269 IN ULONG DeviceIndex,
270 IN SOUND_DEVICE_TYPE DeviceType,
271 OUT LPWSTR *Device);
272
273
274 /* sup.c */
275
276 ULONG
277 GetSysAudioDeviceCount(
278 IN PDEVICE_OBJECT DeviceObject);
279
280
281 PVOID
282 AllocateItem(
283 IN POOL_TYPE PoolType,
284 IN SIZE_T NumberOfBytes);
285
286 VOID
287 FreeItem(
288 IN PVOID Item);
289