[DSOUND]
[reactos.git] / reactos / dll / directx / dsound_new / precomp.h
1 #ifndef PRECOMP_H__
2 #define PRECOMP_H__
3
4 #define COBJMACROS
5 #define NONAMELESSUNION
6 #define NONAMELESSSTRUCT
7
8 #include <windows.h>
9 #include <setupapi.h>
10 #include <mmddk.h>
11 #include <objbase.h>
12 #include <olectl.h>
13 #include <unknwn.h>
14 #include <dsound.h>
15 #include <dsconf.h>
16 #include <vfwmsgs.h>
17 #include <setupapi.h>
18 #define NDEBUG
19 #include <debug.h>
20 #include <ks.h>
21 #include <ksmedia.h>
22 #include <limits.h>
23 #include <stdio.h>
24
25 #include "resource.h"
26
27
28 /* factory method */
29 typedef HRESULT (CALLBACK *LPFNCREATEINSTANCE)(IUnknown* pUnkOuter, REFIID riid, LPVOID* ppvObject);
30
31 /* factory table */
32 typedef struct
33 {
34 REFIID riid;
35 LPFNCREATEINSTANCE lpfnCI;
36 } INTERFACE_TABLE;
37
38
39 typedef struct tagFILTERINFO
40 {
41 SP_DEVINFO_DATA DeviceData;
42 WCHAR DevicePath[MAX_PATH];
43 HANDLE hFilter;
44 ULONG PinCount;
45 PULONG Pin;
46 GUID DeviceGuid[2];
47 ULONG MappedId[2];
48
49 struct tagFILTERINFO *lpNext;
50 }FILTERINFO, *LPFILTERINFO;
51
52 #define INIT_GUID(guid, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
53 guid.Data1 = l; guid.Data2 = w1; guid.Data3 = w2; \
54 guid.Data4[0] = b1; guid.Data4[1] = b2; guid.Data4[2] = b3; \
55 guid.Data4[3] = b4; guid.Data4[4] = b5; guid.Data4[5] = b6; \
56 guid.Data4[6] = b7; guid.Data4[7] = b8;
57
58 typedef enum
59 {
60 PIN_TYPE_NONE = 0,
61 PIN_TYPE_PLAYBACK = 1,
62 PIN_TYPE_RECORDING = 2
63 }PIN_TYPE;
64
65 /* globals */
66 extern HINSTANCE dsound_hInstance;
67 extern LPFILTERINFO RootInfo;
68
69 /* classfactory.c */
70
71 IClassFactory *
72 IClassFactory_fnConstructor(
73 LPFNCREATEINSTANCE lpfnCI,
74 PLONG pcRefDll,
75 REFIID riidInst);
76
77
78 /* devicelist.c */
79
80 HRESULT
81 EnumAudioDeviceInterfaces(
82 LPFILTERINFO *OutRootInfo);
83
84 BOOL
85 FindDeviceByGuid(
86 LPCGUID pGuidSrc,
87 LPFILTERINFO *Filter);
88
89 BOOL
90 FindDeviceByMappedId(
91 IN ULONG DeviceID,
92 LPFILTERINFO *Filter,
93 BOOL bPlayback);
94
95 ULONG
96 GetPinIdFromFilter(
97 LPFILTERINFO Filter,
98 BOOL bCapture,
99 ULONG Offset);
100
101 /* directsound.c */
102
103 HRESULT
104 CALLBACK
105 NewDirectSound(
106 IUnknown* pUnkOuter,
107 REFIID riid,
108 LPVOID* ppvObject);
109
110
111 /* misc.c */
112
113 VOID
114 PerformChannelConversion(
115 PUCHAR Buffer,
116 ULONG BufferLength,
117 PULONG BytesRead,
118 ULONG OldChannels,
119 ULONG NewChannels,
120 ULONG BitsPerSample,
121 PUCHAR Result,
122 ULONG ResultLength,
123 PULONG BytesWritten);
124
125 BOOL
126 SetPinFormat(
127 IN HANDLE hPin,
128 IN LPWAVEFORMATEX WaveFormatEx);
129
130 BOOL
131 CreateCompatiblePin(
132 IN HANDLE hFilter,
133 IN DWORD PinId,
134 IN BOOL bLoop,
135 IN LPWAVEFORMATEX WaveFormatEx,
136 OUT LPWAVEFORMATEX WaveFormatOut,
137 OUT PHANDLE hPin);
138
139
140 DWORD
141 SyncOverlappedDeviceIoControl(
142 IN HANDLE Handle,
143 IN DWORD IoControlCode,
144 IN LPVOID InBuffer,
145 IN DWORD InBufferSize,
146 OUT LPVOID OutBuffer,
147 IN DWORD OutBufferSize,
148 OUT LPDWORD BytesTransferred OPTIONAL);
149
150 DWORD
151 PrimaryDirectSoundBuffer_Write(
152 LPDIRECTSOUNDBUFFER8 iface,
153 LPVOID Buffer,
154 DWORD BufferSize);
155
156
157 DWORD
158 OpenPin(
159 HANDLE hFilter,
160 ULONG PinId,
161 LPWAVEFORMATEX WaveFormatEx,
162 PHANDLE hPin,
163 BOOL bLoop);
164
165 DWORD
166 OpenFilter(
167 IN LPCWSTR lpFileName,
168 IN PHANDLE OutHandle);
169
170 DWORD
171 GetFilterPinCount(
172 IN HANDLE hFilter,
173 OUT PULONG NumPins);
174
175 DWORD
176 GetFilterPinCommunication(
177 IN HANDLE hFilter,
178 IN ULONG PinId,
179 OUT PKSPIN_COMMUNICATION Communication);
180
181 DWORD
182 GetFilterPinDataFlow(
183 IN HANDLE hFilter,
184 IN ULONG PinId,
185 OUT PKSPIN_DATAFLOW DataFlow);
186
187 /* primary.c */
188
189 HRESULT
190 PrimaryDirectSoundBuffer_GetPosition(
191 LPDIRECTSOUNDBUFFER8 iface,
192 LPDWORD pdwCurrentPlayCursor,
193 LPDWORD pdwCurrentWriteCursor);
194
195 VOID
196 PrimaryDirectSoundBuffer_SetState(
197 LPDIRECTSOUNDBUFFER8 iface,
198 KSSTATE State);
199
200 HRESULT
201 NewPrimarySoundBuffer(
202 LPDIRECTSOUNDBUFFER8 *OutBuffer,
203 LPFILTERINFO Filter,
204 DWORD dwLevel);
205
206 HRESULT
207 PrimaryDirectSoundBuffer_SetFormat(
208 LPDIRECTSOUNDBUFFER8 iface,
209 LPWAVEFORMATEX pcfxFormat,
210 BOOL bLooped);
211
212 VOID
213 PrimaryDirectSoundBuffer_AcquireLock(
214 LPDIRECTSOUNDBUFFER8 iface);
215
216 VOID
217 PrimaryDirectSoundBuffer_ReleaseLock(
218 LPDIRECTSOUNDBUFFER8 iface);
219
220 /* secondary.c */
221
222 HRESULT
223 NewSecondarySoundBuffer(
224 LPDIRECTSOUNDBUFFER8 *OutBuffer,
225 LPFILTERINFO Filter,
226 DWORD dwLevel,
227 LPCDSBUFFERDESC lpcDSBufferDesc,
228 LPDIRECTSOUNDBUFFER8 PrimaryBuffer);
229
230 /* property.c */
231 HRESULT
232 CALLBACK
233 NewKsPropertySet(
234 IUnknown* pUnkOuter,
235 REFIID riid,
236 LPVOID* ppvObject);
237
238 /* capture.c */
239
240 HRESULT
241 CALLBACK
242 NewDirectSoundCapture(
243 IUnknown* pUnkOuter,
244 REFIID riid,
245 LPVOID* ppvObject);
246
247
248 /* capturebuffer.c */
249 HRESULT
250 NewDirectSoundCaptureBuffer(
251 LPDIRECTSOUNDCAPTUREBUFFER8 *OutBuffer,
252 LPFILTERINFO Filter,
253 LPCDSCBUFFERDESC lpcDSBufferDesc);
254
255 /* notify.c */
256 VOID
257 DoNotifyPositionEvents(
258 LPDIRECTSOUNDNOTIFY iface,
259 DWORD OldPosition,
260 DWORD NewPosition);
261
262 HRESULT
263 NewDirectSoundNotify(
264 LPDIRECTSOUNDNOTIFY * Notify,
265 BOOL bLoop,
266 BOOL bMix,
267 HANDLE hPin,
268 DWORD BufferSize);
269
270 #endif