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