xref: /reactos/dll/directx/dsound_new/precomp.h (revision 1734f297)
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 YDEBUG
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     DWORD dwFlags);
206 
207 HRESULT
208 PrimaryDirectSoundBuffer_SetFormat(
209     LPDIRECTSOUNDBUFFER8 iface,
210     LPWAVEFORMATEX pcfxFormat,
211     BOOL bLooped);
212 
213 VOID
214 PrimaryDirectSoundBuffer_AcquireLock(
215     LPDIRECTSOUNDBUFFER8 iface);
216 
217 VOID
218 PrimaryDirectSoundBuffer_ReleaseLock(
219     LPDIRECTSOUNDBUFFER8 iface);
220 
221 /* secondary.c */
222 
223 HRESULT
224 NewSecondarySoundBuffer(
225     LPDIRECTSOUNDBUFFER8 *OutBuffer,
226     LPFILTERINFO Filter,
227     DWORD dwLevel,
228     LPCDSBUFFERDESC lpcDSBufferDesc,
229     LPDIRECTSOUNDBUFFER8 PrimaryBuffer);
230 
231 /* property.c */
232 HRESULT
233 CALLBACK
234 NewKsPropertySet(
235     IUnknown* pUnkOuter,
236     REFIID riid,
237     LPVOID* ppvObject);
238 
239 /* capture.c */
240 
241 HRESULT
242 CALLBACK
243 NewDirectSoundCapture(
244     IUnknown* pUnkOuter,
245     REFIID riid,
246     LPVOID* ppvObject);
247 
248 
249 /* capturebuffer.c */
250 HRESULT
251 NewDirectSoundCaptureBuffer(
252     LPDIRECTSOUNDCAPTUREBUFFER8 *OutBuffer,
253     LPFILTERINFO Filter,
254     LPCDSCBUFFERDESC lpcDSBufferDesc);
255 
256 /* notify.c */
257 VOID
258 DoNotifyPositionEvents(
259     LPDIRECTSOUNDNOTIFY iface,
260     DWORD OldPosition,
261     DWORD NewPosition);
262 
263 HRESULT
264 NewDirectSoundNotify(
265     LPDIRECTSOUNDNOTIFY * Notify,
266     BOOL bLoop,
267     BOOL bMix,
268     HANDLE hPin,
269     DWORD BufferSize);
270 
271 #endif
272