More comcat.dll implementation, swprintf fix, winerror.h additions.
[wine] / include / dsound.h
1 /*
2  * Copyright (C) the Wine project
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17  */
18
19 #ifndef __WINE_DSOUND_H
20 #define __WINE_DSOUND_H
21
22 #include "winbase.h"     /* for CRITICAL_SECTION */
23 #include "mmsystem.h"
24 #include "d3dtypes.h"
25
26 #ifdef __cplusplus
27 extern "C" {
28 #endif /* defined(__cplusplus) */
29
30 /*****************************************************************************
31  * Predeclare the interfaces
32  */
33 DEFINE_GUID(CLSID_DirectSound,          0x47d4d946, 0x62e8, 0x11cf, 0x93, 0xbc, 0x44, 0x45, 0x53, 0x54, 0x0, 0x0);
34
35 DEFINE_GUID(IID_IDirectSound,           0x279AFA83,0x4981,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60);
36 typedef struct IDirectSound IDirectSound,*LPDIRECTSOUND;
37
38 DEFINE_GUID(IID_IDirectSoundBuffer,     0x279AFA85,0x4981,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60); 
39 typedef struct IDirectSoundBuffer IDirectSoundBuffer,*LPDIRECTSOUNDBUFFER,**LPLPDIRECTSOUNDBUFFER;
40
41 DEFINE_GUID(IID_IDirectSoundNotify,     0xB0210783,0x89cd,0x11d0,0xAF,0x08,0x00,0xA0,0xC9,0x25,0xCD,0x16);
42 typedef struct IDirectSoundNotify IDirectSoundNotify,*LPDIRECTSOUNDNOTIFY;
43
44 DEFINE_GUID(IID_IDirectSound3DListener, 0x279AFA84,0x4981,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60);
45 typedef struct IDirectSound3DListener IDirectSound3DListener,*LPDIRECTSOUND3DLISTENER;
46
47 DEFINE_GUID(IID_IDirectSound3DBuffer,   0x279AFA86,0x4981,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60); 
48 typedef struct IDirectSound3DBuffer IDirectSound3DBuffer,*LPDIRECTSOUND3DBUFFER;
49
50 DEFINE_GUID(IID_IDirectSoundCapture,    0xB0210781,0x89CD,0x11D0,0xAF,0x08,0x00,0xA0,0xC9,0x25,0xCD,0x16);
51 typedef struct IDirectSoundCapture IDirectSoundCapture,*LPDIRECTSOUNDCAPTURE;
52
53 DEFINE_GUID(IID_IDirectSoundCaptureBuffer,0xB0210782,0x89CD,0x11D0,0xAF,0x08,0x00,0xA0,0xC9,0x25,0xCD,0x16);
54 typedef struct IDirectSoundCaptureBuffer IDirectSoundCaptureBuffer,*LPDIRECTSOUNDCAPTUREBUFFER;
55   
56 DEFINE_GUID(DSDEVID_WinePlayback, 0x40316A1D,0x605B,0xD611,0x87,0xC6,0x00,0x80,0xAD,0x00,0x02,0xFE);
57
58 DEFINE_GUID(IID_IKsPropertySet,         0x31EFAC30,0x515C,0x11D0,0xA9,0xAA,0x00,0xAA,0x00,0x61,0xBE,0x93);
59 typedef struct IKsPropertySet IKsPropertySet,*LPKSPROPERTYSET;
60
61
62 #define _FACDS          0x878
63 #define MAKE_DSHRESULT(code)            MAKE_HRESULT(1,_FACDS,code)
64
65 #define DS_OK                           0
66 #define DSERR_ALLOCATED                 MAKE_DSHRESULT(10)
67 #define DSERR_CONTROLUNAVAIL            MAKE_DSHRESULT(30)
68 #define DSERR_INVALIDPARAM              E_INVALIDARG
69 #define DSERR_INVALIDCALL               MAKE_DSHRESULT(50)
70 #define DSERR_GENERIC                   E_FAIL
71 #define DSERR_PRIOLEVELNEEDED           MAKE_DSHRESULT(70)
72 #define DSERR_OUTOFMEMORY               E_OUTOFMEMORY
73 #define DSERR_BADFORMAT                 MAKE_DSHRESULT(100)
74 #define DSERR_UNSUPPORTED               E_NOTIMPL
75 #define DSERR_NODRIVER                  MAKE_DSHRESULT(120)
76 #define DSERR_ALREADYINITIALIZED        MAKE_DSHRESULT(130)
77 #define DSERR_NOAGGREGATION             CLASS_E_NOAGGREGATION
78 #define DSERR_BUFFERLOST                MAKE_DSHRESULT(150)
79 #define DSERR_OTHERAPPHASPRIO           MAKE_DSHRESULT(160)
80 #define DSERR_UNINITIALIZED             MAKE_DSHRESULT(170)
81
82 #define DSCAPS_PRIMARYMONO          0x00000001
83 #define DSCAPS_PRIMARYSTEREO        0x00000002
84 #define DSCAPS_PRIMARY8BIT          0x00000004
85 #define DSCAPS_PRIMARY16BIT         0x00000008
86 #define DSCAPS_CONTINUOUSRATE       0x00000010
87 #define DSCAPS_EMULDRIVER           0x00000020
88 #define DSCAPS_CERTIFIED            0x00000040
89 #define DSCAPS_SECONDARYMONO        0x00000100
90 #define DSCAPS_SECONDARYSTEREO      0x00000200
91 #define DSCAPS_SECONDARY8BIT        0x00000400
92 #define DSCAPS_SECONDARY16BIT       0x00000800
93
94 #define DSSCL_NORMAL            1
95 #define DSSCL_PRIORITY          2
96 #define DSSCL_EXCLUSIVE         3
97 #define DSSCL_WRITEPRIMARY      4
98
99 typedef struct _DSCAPS
100 {
101     DWORD       dwSize;
102     DWORD       dwFlags;
103     DWORD       dwMinSecondarySampleRate;
104     DWORD       dwMaxSecondarySampleRate;
105     DWORD       dwPrimaryBuffers;
106     DWORD       dwMaxHwMixingAllBuffers;
107     DWORD       dwMaxHwMixingStaticBuffers;
108     DWORD       dwMaxHwMixingStreamingBuffers;
109     DWORD       dwFreeHwMixingAllBuffers;
110     DWORD       dwFreeHwMixingStaticBuffers;
111     DWORD       dwFreeHwMixingStreamingBuffers;
112     DWORD       dwMaxHw3DAllBuffers;
113     DWORD       dwMaxHw3DStaticBuffers;
114     DWORD       dwMaxHw3DStreamingBuffers;
115     DWORD       dwFreeHw3DAllBuffers;
116     DWORD       dwFreeHw3DStaticBuffers;
117     DWORD       dwFreeHw3DStreamingBuffers;
118     DWORD       dwTotalHwMemBytes;
119     DWORD       dwFreeHwMemBytes;
120     DWORD       dwMaxContigFreeHwMemBytes;
121     DWORD       dwUnlockTransferRateHwBuffers;
122     DWORD       dwPlayCpuOverheadSwBuffers;
123     DWORD       dwReserved1;
124     DWORD       dwReserved2;
125 } DSCAPS,*LPDSCAPS;
126
127 #define DSBPLAY_LOOPING         0x00000001
128
129 #define DSBSTATUS_PLAYING           0x00000001
130 #define DSBSTATUS_BUFFERLOST        0x00000002
131 #define DSBSTATUS_LOOPING           0x00000004
132
133
134 #define DSBLOCK_FROMWRITECURSOR     0x00000001
135 #define DSBLOCK_ENTIREBUFFER        0x00000002
136
137 #define DSBCAPS_PRIMARYBUFFER       0x00000001
138 #define DSBCAPS_STATIC              0x00000002
139 #define DSBCAPS_LOCHARDWARE         0x00000004
140 #define DSBCAPS_LOCSOFTWARE         0x00000008
141 #define DSBCAPS_CTRL3D              0x00000010
142 #define DSBCAPS_CTRLFREQUENCY       0x00000020
143 #define DSBCAPS_CTRLPAN             0x00000040
144 #define DSBCAPS_CTRLVOLUME          0x00000080
145 #define DSBCAPS_CTRLPOSITIONNOTIFY  0x00000100
146 #define DSBCAPS_CTRLDEFAULT         0x000000E0  /* Pan + volume + frequency. */
147 #define DSBCAPS_CTRLALL             0x000001F0  /* All control capabilities */
148 #define DSBCAPS_STICKYFOCUS         0x00004000
149 #define DSBCAPS_GLOBALFOCUS         0x00008000
150 #define DSBCAPS_GETCURRENTPOSITION2 0x00010000  /* More accurate play cursor under emulation*/
151 #define DSBCAPS_MUTE3DATMAXDISTANCE 0x00020000
152
153 #define DSBSIZE_MIN                 4
154 #define DSBSIZE_MAX                 0xFFFFFFF
155 #define DSBPAN_LEFT                 -10000
156 #define DSBPAN_RIGHT                 10000
157 #define DSBVOLUME_MAX                    0
158 #define DSBVOLUME_MIN               -10000
159 #define DSBFREQUENCY_MIN            100
160 #define DSBFREQUENCY_MAX            100000
161 #define DSBFREQUENCY_ORIGINAL       0
162
163 typedef struct _DSBCAPS
164 {
165     DWORD       dwSize;
166     DWORD       dwFlags;
167     DWORD       dwBufferBytes;
168     DWORD       dwUnlockTransferRate;
169     DWORD       dwPlayCpuOverhead;
170 } DSBCAPS,*LPDSBCAPS;
171
172 #define DSSCL_NORMAL                1
173 #define DSSCL_PRIORITY              2
174 #define DSSCL_EXCLUSIVE             3
175 #define DSSCL_WRITEPRIMARY          4
176
177 typedef struct _DSBUFFERDESC
178 {
179     DWORD               dwSize;
180     DWORD               dwFlags;
181     DWORD               dwBufferBytes;
182     DWORD               dwReserved;
183     LPWAVEFORMATEX      lpwfxFormat;
184 } DSBUFFERDESC,*LPDSBUFFERDESC;
185
186 typedef struct _DSBPOSITIONNOTIFY
187 {
188         DWORD           dwOffset;
189         HANDLE  hEventNotify;
190 } DSBPOSITIONNOTIFY,*LPDSBPOSITIONNOTIFY;
191
192 typedef const DSBPOSITIONNOTIFY *LPCDSBPOSITIONNOTIFY;
193
194 #define DSSPEAKER_HEADPHONE     1
195 #define DSSPEAKER_MONO          2
196 #define DSSPEAKER_QUAD          3
197 #define DSSPEAKER_STEREO        4
198 #define DSSPEAKER_SURROUND      5
199
200 #define DSSPEAKER_GEOMETRY_MIN      0x00000005  /* 5 degrees */
201 #define DSSPEAKER_GEOMETRY_NARROW   0x0000000A  /* 10 degrees */
202 #define DSSPEAKER_GEOMETRY_WIDE     0x00000014  /* 20 degrees */
203 #define DSSPEAKER_GEOMETRY_MAX      0x000000B4  /* 180 degrees */
204
205 typedef struct _DSCBUFFERDESC
206 {
207   DWORD          dwSize;
208   DWORD          dwFlags;
209   DWORD          dwBufferBytes;
210   DWORD          dwReserved;
211   LPWAVEFORMATEX lpwfxFormat;
212 } DSCBUFFERDESC, *LPDSCBUFFERDESC;
213 typedef const DSCBUFFERDESC *LPCDSCBUFFERDESC;
214
215 typedef struct _DSCCAPS
216 {
217   DWORD DwSize;
218   DWORD dwFlags;
219   DWORD dwFormats;
220   DWORD dwChannels;
221 } DSCCAPS, *LPDSCCAPS;
222 typedef const DSCCAPS *LPCDSCCAPS;
223
224 typedef struct _DSCBCAPS
225 {
226   DWORD dwSize;
227   DWORD dwFlags;
228   DWORD dwBufferBytes;
229   DWORD dwReserved;
230 } DSCBCAPS, *LPDSCBCAPS;
231 typedef const DSCBCAPS *LPCDSCBCAPS;
232
233 #ifndef __LPCGUID_DEFINED__
234 #define __LPCGUID_DEFINED__
235 typedef const GUID *LPCGUID;
236 #endif 
237
238 typedef LPVOID* LPLPVOID;
239
240 typedef BOOL (CALLBACK *LPDSENUMCALLBACKW)(LPGUID,LPWSTR,LPWSTR,LPVOID);
241 typedef BOOL (CALLBACK *LPDSENUMCALLBACKA)(LPGUID,LPSTR,LPSTR,LPVOID);
242
243 extern HRESULT WINAPI DirectSoundCreate(LPCGUID lpGUID,LPDIRECTSOUND * ppDS,IUnknown *pUnkOuter );
244 extern HRESULT WINAPI DirectSoundEnumerateA(LPDSENUMCALLBACKA, LPVOID);
245 extern HRESULT WINAPI DirectSoundEnumerateW(LPDSENUMCALLBACKW, LPVOID);
246
247 extern HRESULT WINAPI DirectSoundCaptureCreate(LPCGUID, LPDIRECTSOUNDCAPTURE *, LPUNKNOWN);
248 extern HRESULT WINAPI DirectSoundCaptureEnumerateA(LPDSENUMCALLBACKA, LPVOID);
249 extern HRESULT WINAPI DirectSoundCaptureEnumerateW(LPDSENUMCALLBACKW, LPVOID);
250
251
252 /*****************************************************************************
253  * IDirectSound interface
254  */
255 #define ICOM_INTERFACE IDirectSound
256 #define IDirectSound_METHODS \
257     ICOM_METHOD3(HRESULT,CreateSoundBuffer,    LPDSBUFFERDESC,lpcDSBufferDesc, LPLPDIRECTSOUNDBUFFER,lplpDirectSoundBuffer, IUnknown*,pUnkOuter) \
258     ICOM_METHOD1(HRESULT,GetCaps,              LPDSCAPS,lpDSCaps) \
259     ICOM_METHOD2(HRESULT,DuplicateSoundBuffer, LPDIRECTSOUNDBUFFER,lpDsbOriginal, LPLPDIRECTSOUNDBUFFER,lplpDsbDuplicate) \
260     ICOM_METHOD2(HRESULT,SetCooperativeLevel,  HWND,hwnd, DWORD,dwLevel) \
261     ICOM_METHOD (HRESULT,Compact) \
262     ICOM_METHOD1(HRESULT,GetSpeakerConfig,     LPDWORD,lpdwSpeakerConfig) \
263     ICOM_METHOD1(HRESULT,SetSpeakerConfig,     DWORD,dwSpeakerConfig) \
264     ICOM_METHOD1(HRESULT,Initialize,           LPCGUID,lpcGuid)
265 #define IDirectSound_IMETHODS \
266     IUnknown_IMETHODS \
267     IDirectSound_METHODS
268 ICOM_DEFINE(IDirectSound,IUnknown)
269 #undef ICOM_INTERFACE
270
271     /*** IUnknown methods ***/
272 #define IDirectSound_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b)
273 #define IDirectSound_AddRef(p)             ICOM_CALL (AddRef,p)
274 #define IDirectSound_Release(p)            ICOM_CALL (Release,p)
275     /*** IDirectSound methods ***/
276 #define IDirectSound_CreateSoundBuffer(p,a,b,c)  ICOM_CALL3(CreateSoundBuffer,p,a,b,c)
277 #define IDirectSound_GetCaps(p,a)                ICOM_CALL1(GetCaps,p,a)
278 #define IDirectSound_DuplicateSoundBuffer(p,a,b) ICOM_CALL2(DuplicateSoundBuffer,p,a,b)
279 #define IDirectSound_SetCooperativeLevel(p,a,b)  ICOM_CALL2(SetCooperativeLevel,p,a,b)
280 #define IDirectSound_Compact(p)                  ICOM_CALL (Compact,p)
281 #define IDirectSound_GetSpeakerConfig(p,a)       ICOM_CALL1(GetSpeakerConfig,p,a)
282 #define IDirectSound_SetSpeakerConfig(p,a)       ICOM_CALL1(SetSpeakerConfig,p,a)
283 #define IDirectSound_Initialize(p,a)             ICOM_CALL1(Initialize,p,a)
284
285
286 /*****************************************************************************
287  * IDirectSoundBuffer interface
288  */
289 #define ICOM_INTERFACE IDirectSoundBuffer
290 #define IDirectSoundBuffer_METHODS \
291     ICOM_METHOD1(HRESULT,GetCaps,              LPDSBCAPS,lpDSBufferCaps) \
292     ICOM_METHOD2(HRESULT,GetCurrentPosition,   LPDWORD,lpdwCurrentPlayCursor, LPDWORD,lpdwCurrentWriteCursor) \
293     ICOM_METHOD3(HRESULT,GetFormat,            LPWAVEFORMATEX,lpwfxFormat, DWORD,dwSizeAllocated, LPDWORD,lpdwSizeWritten) \
294     ICOM_METHOD1(HRESULT,GetVolume,            LPLONG,lplVolume) \
295     ICOM_METHOD1(HRESULT,GetPan,               LPLONG,lplpan) \
296     ICOM_METHOD1(HRESULT,GetFrequency,         LPDWORD,lpdwFrequency) \
297     ICOM_METHOD1(HRESULT,GetStatus,            LPDWORD,lpdwStatus) \
298     ICOM_METHOD2(HRESULT,Initialize,           LPDIRECTSOUND,lpDirectSound, LPDSBUFFERDESC,lpcDSBufferDesc) \
299     ICOM_METHOD7(HRESULT,Lock,                 DWORD,dwWriteCursor, DWORD,dwWriteBytes, LPVOID,lplpvAudioPtr1, LPDWORD,lpdwAudioBytes1, LPVOID,lplpvAudioPtr2, LPDWORD,lpdwAudioBytes2, DWORD,dwFlags) \
300     ICOM_METHOD3(HRESULT,Play,                 DWORD,dwReserved1, DWORD,dwReserved2, DWORD,dwFlags) \
301     ICOM_METHOD1(HRESULT,SetCurrentPosition,   DWORD,dwNewPosition) \
302     ICOM_METHOD1(HRESULT,SetFormat,            LPWAVEFORMATEX,lpcfxFormat) \
303     ICOM_METHOD1(HRESULT,SetVolume,            LONG,lVolume) \
304     ICOM_METHOD1(HRESULT,SetPan,               LONG,lPan) \
305     ICOM_METHOD1(HRESULT,SetFrequency,         DWORD,dwFrequency) \
306     ICOM_METHOD (HRESULT,Stop) \
307     ICOM_METHOD4(HRESULT,Unlock,               LPVOID,lpvAudioPtr1, DWORD,dwAudioBytes1, LPVOID,lpvAudioPtr2, DWORD,dwAudioPtr2) \
308     ICOM_METHOD (HRESULT,Restore)
309 #define IDirectSoundBuffer_IMETHODS \
310     IUnknown_IMETHODS \
311     IDirectSoundBuffer_METHODS
312 ICOM_DEFINE(IDirectSoundBuffer,IUnknown)
313 #undef ICOM_INTERFACE
314
315     /*** IUnknown methods ***/
316 #define IDirectSoundBuffer_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b)
317 #define IDirectSoundBuffer_AddRef(p)             ICOM_CALL (AddRef,p)
318 #define IDirectSoundBuffer_Release(p)            ICOM_CALL (Release,p)
319     /*** IDirectSoundBuffer methods ***/
320 #define IDirectSoundBuffer_GetCaps(p,a)                ICOM_CALL1(GetCaps,p,a)
321 #define IDirectSoundBuffer_GetCurrentPosition(p,a,b)   ICOM_CALL2(GetCurrentPosition,p,a,b)
322 #define IDirectSoundBuffer_GetFormat(p,a,b,c)          ICOM_CALL3(GetFormat,p,a,b,c)
323 #define IDirectSoundBuffer_GetVolume(p,a)              ICOM_CALL1(GetVolume,p,a)
324 #define IDirectSoundBuffer_GetPan(p,a)                 ICOM_CALL1(GetPan,p,a)
325 #define IDirectSoundBuffer_GetFrequency(p,a)           ICOM_CALL1(GetFrequency,p,a)
326 #define IDirectSoundBuffer_GetStatus(p,a)              ICOM_CALL1(GetStatus,p,a)
327 #define IDirectSoundBuffer_Initialize(p,a,b)           ICOM_CALL2(Initialize,p,a,b)
328 #define IDirectSoundBuffer_Lock(p,a,b,c,d,e,f,g)       ICOM_CALL7(Lock,p,a,b,c,d,e,f,g)
329 #define IDirectSoundBuffer_Play(p,a,b,c)               ICOM_CALL3(Play,p,a,b,c)
330 #define IDirectSoundBuffer_SetCurrentPosition(p,a)     ICOM_CALL1(SetCurrentPosition,p,a)
331 #define IDirectSoundBuffer_SetFormat(p,a)              ICOM_CALL1(SetFormat,p,a)
332 #define IDirectSoundBuffer_SetVolume(p,a)              ICOM_CALL1(SetVolume,p,a)
333 #define IDirectSoundBuffer_SetPan(p,a)                 ICOM_CALL1(SetPan,p,a)
334 #define IDirectSoundBuffer_SetFrequency(p,a)           ICOM_CALL1(SetFrequency,p,a)
335 #define IDirectSoundBuffer_Stop(p)                     ICOM_CALL (Stop,p)
336 #define IDirectSoundBuffer_Unlock(p,a,b,c,d)           ICOM_CALL4(Unlock,p,a,b,c,d)
337 #define IDirectSoundBuffer_Restore(p)                  ICOM_CALL (Restore,p)
338
339
340 /*****************************************************************************
341  * IDirectSoundCapture interface
342  */
343 #define ICOM_INTERFACE IDirectSoundCapture
344 #define IDirectSoundCapture_METHODS \
345     ICOM_METHOD3(HRESULT,CreateCaptureBuffer, LPCDSCBUFFERDESC,lpcDSCBufferDesc,LPDIRECTSOUNDCAPTUREBUFFER*,lplpDSCaptureBuffer, LPUNKNOWN,pUnk) \
346     ICOM_METHOD1(HRESULT,GetCaps,             LPDSCCAPS,lpDSCCaps) \
347     ICOM_METHOD1(HRESULT,Initialize,          LPCGUID,lpcGUID)
348
349 #define IDirectSoundCapture_IMETHODS \
350     IUnknown_IMETHODS \
351     IDirectSoundCapture_METHODS
352 ICOM_DEFINE(IDirectSoundCapture,IUnknown)
353 #undef ICOM_INTERFACE
354
355 #define IDirectSoundCapture_QueryInterface(p,a,b)        ICOM_CALL2(QueryInterface,p,a,b)
356 #define IDirectSoundCapture_AddRef(p)                    ICOM_CALL (AddRef,p) 
357 #define IDirectSoundCapture_Release(p)                   ICOM_CALL (Release,p) 
358 #define IDirectSoundCapture_CreateCaptureBuffer(p,a,b,c) ICOM_CALL3(CreateCaptureBuffer,p,a,b,c)
359 #define IDirectSoundCapture_GetCaps(p,a)                 ICOM_CALL (GetCaps,p,a)
360 #define IDirectSoundCapture_Initialize(p,a)              ICOM_CALL (Initialize,p,a)
361
362 /*****************************************************************************
363  * IDirectSoundCaptureBuffer interface
364  */
365 #define ICOM_INTERFACE IDirectSoundCaptureBuffer
366 #define IDirectSoundCaptureBuffer_METHODS \
367     ICOM_METHOD1(HRESULT,GetCaps,             LPDSCBCAPS,lpDSCBCaps) \
368     ICOM_METHOD2(HRESULT,GetCurrentPosition,  LPDWORD,lpdwCapturePosition,LPDWORD,lpdwReadPosition) \
369     ICOM_METHOD3(HRESULT,GetFormat,           LPWAVEFORMATEX,lpwfxFormat, DWORD,dwSizeAllocated, LPDWORD,lpdwSizeWritten) \
370     ICOM_METHOD1(HRESULT,GetStatus,           LPDWORD,lpdwStatus) \
371     ICOM_METHOD2(HRESULT,Initialize,          LPDIRECTSOUNDCAPTURE,lpDSC, LPCDSCBUFFERDESC,lpcDSCBDesc) \
372     ICOM_METHOD7(HRESULT,Lock,                DWORD,dwReadCusor, DWORD,dwReadBytes, LPVOID*,lplpvAudioPtr1, LPDWORD,lpdwAudioBytes1, LPVOID*,lplpvAudioPtr2, LPDWORD,lpdwAudioBytes2, DWORD,dwFlags) \
373     ICOM_METHOD1(HRESULT,Start,               DWORD,dwFlags) \
374     ICOM_METHOD (HRESULT,Stop) \
375     ICOM_METHOD4(HRESULT,Unlock,              LPVOID,lpvAudioPtr1, DWORD,dwAudioBytes1, LPVOID,lpvAudioPtr2, DWORD,dwAudioBytes2)               
376
377 #define IDirectSoundCaptureBuffer_IMETHODS \
378     IUnknown_IMETHODS \
379     IDirectSoundCaptureBuffer_METHODS
380 ICOM_DEFINE(IDirectSoundCaptureBuffer,IUnknown)
381 #undef ICOM_INTERFACE
382
383 #define IDirectSoundCaptureBuffer_QueryInterface(p,a,b)     ICOM_CALL2(QueryInterface,p,a,b)
384 #define IDirectSoundCaptureBuffer_AddRef(p)                 ICOM_CALL (AddRef,p) 
385 #define IDirectSoundCaptureBuffer_Release(p)                ICOM_CALL (Release,p) 
386 #define IDirectSoundCaptureBuffer_GetCurrentPosition(p,a,b) ICOM_CALL2(GetCurrentPosition,p,a,b)
387 #define IDirectSoundCaptureBuffer_GetFormat(p,a,b,c)        ICOM_CALL3(GetFormat,p,a,b,c) 
388 #define IDirectSoundCaptureBuffer_GetStatus(p,a)            ICOM_CALL1(GetStatus,p,a) 
389 #define IDirectSoundCaptureBuffer_Initialize(p,a,b)         ICOM_CALL2(Initialize,p,a,b) 
390 #define IDirectSoundCaptureBuffer_Lock(p,a,b,c,d,e,f,g)     ICOM_CALL7(Lock,p,a,b,c,d,e,f,g)
391 #define IDirectSoundCaptureBuffer_Start(p,a)                ICOM_CALL1(Start,p,a) 
392 #define IDirectSoundCaptureBuffer_Stop(p)                   ICOM_CALL (Stop,p)
393 #define IDirectSoundCaptureBuffer_Unlock(p,a,b,c,d)         ICOM_CALL4(Unlock,p,a,b,c,d)
394
395 /*****************************************************************************
396  * IDirectSoundNotify interface
397  */
398 #define WINE_NOBUFFER                   0x80000000
399
400 #define DSBPN_OFFSETSTOP                -1
401
402 #define ICOM_INTERFACE IDirectSoundNotify
403 #define IDirectSoundNotify_METHODS \
404     ICOM_METHOD2(HRESULT,SetNotificationPositions, DWORD,cPositionNotifies, LPCDSBPOSITIONNOTIFY,lpcPositionNotifies)
405 #define IDirectSoundNotify_IMETHODS \
406     IUnknown_IMETHODS \
407     IDirectSoundNotify_METHODS
408 ICOM_DEFINE(IDirectSoundNotify,IUnknown)
409 #undef ICOM_INTERFACE
410
411 /*** IUnknown methods ***/
412 #define IDirectSoundNotify_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b)
413 #define IDirectSoundNotify_AddRef(p)             ICOM_CALL (AddRef,p)
414 #define IDirectSoundNotify_Release(p)            ICOM_CALL (Release,p)
415 /*** IDirectSoundNotify methods ***/
416 #define IDirectSoundNotify_SetNotificationPositions(p,a,b) ICOM_CALL2(SetNotificationPositions,p,a,b)
417
418
419 /*****************************************************************************
420  * IDirectSound3DListener interface
421  */
422 #define DS3DMODE_NORMAL             0x00000000
423 #define DS3DMODE_HEADRELATIVE       0x00000001
424 #define DS3DMODE_DISABLE            0x00000002
425
426 #define DS3D_IMMEDIATE              0x00000000
427 #define DS3D_DEFERRED               0x00000001
428
429 #define DS3D_MINDISTANCEFACTOR      0.0f
430 #define DS3D_MAXDISTANCEFACTOR      10.0f
431 #define DS3D_DEFAULTDISTANCEFACTOR  1.0f
432
433 #define DS3D_MINROLLOFFFACTOR       0.0f
434 #define DS3D_MAXROLLOFFFACTOR       10.0f
435 #define DS3D_DEFAULTROLLOFFFACTOR   1.0f
436
437 #define DS3D_MINDOPPLERFACTOR       0.0f
438 #define DS3D_MAXDOPPLERFACTOR       10.0f
439 #define DS3D_DEFAULTDOPPLERFACTOR   1.0f
440
441 #define DS3D_DEFAULTMINDISTANCE     1.0f
442 #define DS3D_DEFAULTMAXDISTANCE     1000000000.0f
443
444 #define DS3D_MINCONEANGLE           0
445 #define DS3D_MAXCONEANGLE           360
446 #define DS3D_DEFAULTCONEANGLE       360
447
448 #define DS3D_DEFAULTCONEOUTSIDEVOLUME   0
449
450 typedef struct _DS3DLISTENER {
451         DWORD                           dwSize;
452         D3DVECTOR                       vPosition;
453         D3DVECTOR                       vVelocity;
454         D3DVECTOR                       vOrientFront;
455         D3DVECTOR                       vOrientTop;
456         D3DVALUE                        flDistanceFactor;
457         D3DVALUE                        flRolloffFactor;
458         D3DVALUE                        flDopplerFactor;
459 } DS3DLISTENER, *LPDS3DLISTENER;
460
461 typedef const DS3DLISTENER *LPCDS3DLISTENER;
462         
463 #define ICOM_INTERFACE IDirectSound3DListener
464 #define IDirectSound3DListener_METHODS \
465     ICOM_METHOD1(HRESULT,GetAllParameters,  LPDS3DLISTENER,lpListener) \
466     ICOM_METHOD1(HRESULT,GetDistanceFactor, LPD3DVALUE,lpflDistanceFactor) \
467     ICOM_METHOD1(HRESULT,GetDopplerFactor,  LPD3DVALUE,lpflDopplerFactor) \
468     ICOM_METHOD2(HRESULT,GetOrientation,    LPD3DVECTOR,lpvOrientFront, LPD3DVECTOR,lpvOrientTop) \
469     ICOM_METHOD1(HRESULT,GetPosition,       LPD3DVECTOR,lpvPosition) \
470     ICOM_METHOD1(HRESULT,GetRolloffFactor,  LPD3DVALUE,lpflRolloffFactor) \
471     ICOM_METHOD1(HRESULT,GetVelocity,       LPD3DVECTOR,lpvVelocity) \
472     ICOM_METHOD2(HRESULT,SetAllParameters,  LPCDS3DLISTENER,lpcListener, DWORD,dwApply) \
473     ICOM_METHOD2(HRESULT,SetDistanceFactor, D3DVALUE,flDistanceFactor, DWORD,dwApply) \
474     ICOM_METHOD2(HRESULT,SetDopplerFactor,  D3DVALUE,flDopplerFactor, DWORD,dwApply) \
475     ICOM_METHOD7(HRESULT,SetOrientation,    D3DVALUE,xFront, D3DVALUE,yFront, D3DVALUE,zFront, D3DVALUE,xTop, D3DVALUE,yTop, D3DVALUE,zTop, DWORD,dwApply) \
476     ICOM_METHOD4(HRESULT,SetPosition,       D3DVALUE,x, D3DVALUE,y, D3DVALUE,z, DWORD,dwApply) \
477     ICOM_METHOD2(HRESULT,SetRolloffFactor,  D3DVALUE,flRolloffFactor, DWORD,dwApply) \
478     ICOM_METHOD4(HRESULT,SetVelocity,       D3DVALUE,x, D3DVALUE,y, D3DVALUE,z, DWORD,dwApply) \
479     ICOM_METHOD (HRESULT,CommitDeferredSettings)
480 #define IDirectSound3DListener_IMETHODS \
481     IUnknown_IMETHODS \
482     IDirectSound3DListener_METHODS
483 ICOM_DEFINE(IDirectSound3DListener,IUnknown)
484 #undef ICOM_INTERFACE
485
486 /*** IUnknown methods ***/
487 #define IDirectSound3DListener_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b)
488 #define IDirectSound3DListener_AddRef(p)             ICOM_CALL (AddRef,p)
489 #define IDirectSound3DListener_Release(p)            ICOM_CALL (Release,p)
490 /*** IDirectSound3DListener methods ***/
491 #define IDirectSound3DListener_GetAllParameters(p,a)           ICOM_CALL1(GetAllParameters,p,a)
492 #define IDirectSound3DListener_GetDistanceFactor(p,a)          ICOM_CALL1(GetDistanceFactor,p,a)
493 #define IDirectSound3DListener_GetDopplerFactor(p,a)           ICOM_CALL1(GetDopplerFactor,p,a)
494 #define IDirectSound3DListener_GetOrientation(p,a,b)           ICOM_CALL2(GetOrientation,p,a,b)
495 #define IDirectSound3DListener_GetPosition(p,a)                ICOM_CALL1(GetPosition,p,a)
496 #define IDirectSound3DListener_GetRolloffFactor(p,a)           ICOM_CALL1(GetRolloffFactor,p,a)
497 #define IDirectSound3DListener_GetVelocity(p,a)                ICOM_CALL1(GetVelocity,p,a)
498 #define IDirectSound3DListener_SetAllParameters(p,a,b)         ICOM_CALL2(SetAllParameters,p,a,b)
499 #define IDirectSound3DListener_SetDistanceFactor(p,a,b)        ICOM_CALL2(SetDistanceFactor,p,a,b)
500 #define IDirectSound3DListener_SetDopplerFactor(p,a,b)         ICOM_CALL2(SetDopplerFactor,p,a,b)
501 #define IDirectSound3DListener_SetOrientation(p,a,b,c,d,e,f,g) ICOM_CALL7(SetOrientation,p,a,b,c,d,e,f,g)
502 #define IDirectSound3DListener_SetPosition(p,a,b,c,d)          ICOM_CALL4(SetPosition,p,a,b,c,d)
503 #define IDirectSound3DListener_SetRolloffFactor(p,a,b)         ICOM_CALL2(SetRolloffFactor,p,a,b)
504 #define IDirectSound3DListener_SetVelocity(p,a,b,c,d)          ICOM_CALL4(SetVelocity,p,a,b,c,d)
505 #define IDirectSound3DListener_CommitDeferredSettings(p)       ICOM_CALL (CommitDeferredSettings,p)
506
507
508 /*****************************************************************************
509  * IDirectSound3DBuffer interface
510  */
511 typedef struct  _DS3DBUFFER {
512         DWORD                           dwSize;
513         D3DVECTOR                       vPosition;
514         D3DVECTOR                       vVelocity;
515         DWORD                           dwInsideConeAngle;
516         DWORD                           dwOutsideConeAngle;
517         D3DVECTOR                       vConeOrientation;
518         LONG                            lConeOutsideVolume;
519         D3DVALUE                        flMinDistance;
520         D3DVALUE                        flMaxDistance;
521         DWORD                           dwMode;
522 } DS3DBUFFER, *LPDS3DBUFFER;
523
524 typedef const DS3DBUFFER *LPCDS3DBUFFER;
525
526 #define ICOM_INTERFACE IDirectSound3DBuffer
527 #define IDirectSound3DBuffer_METHODS \
528     ICOM_METHOD1(HRESULT,GetAllParameters,     LPDS3DBUFFER,lpDs3dBuffer) \
529     ICOM_METHOD2(HRESULT,GetConeAngles,        LPDWORD,lpdwInsideConeAngle, LPDWORD,lpdwOutsideConeAngle) \
530     ICOM_METHOD1(HRESULT,GetConeOrientation,   LPD3DVECTOR,lpvOrientation) \
531     ICOM_METHOD1(HRESULT,GetConeOutsideVolume, LPLONG,lplConeOutsideVolume) \
532     ICOM_METHOD1(HRESULT,GetMaxDistance,       LPD3DVALUE,lpflMaxDistance) \
533     ICOM_METHOD1(HRESULT,GetMinDistance,       LPD3DVALUE,lpflMinDistance) \
534     ICOM_METHOD1(HRESULT,GetMode,              LPDWORD,lpwdMode) \
535     ICOM_METHOD1(HRESULT,GetPosition,          LPD3DVECTOR,lpvPosition) \
536     ICOM_METHOD1(HRESULT,GetVelocity,          LPD3DVECTOR,lpvVelocity) \
537     ICOM_METHOD2(HRESULT,SetAllParameters,     LPCDS3DBUFFER,lpcDs3dBuffer, DWORD,dwApply) \
538     ICOM_METHOD3(HRESULT,SetConeAngles,        DWORD,dwInsideConeAngle, DWORD,dwOutsideConeAngle, DWORD,dwApply) \
539     ICOM_METHOD4(HRESULT,SetConeOrientation,   D3DVALUE,x, D3DVALUE,y, D3DVALUE,z, DWORD,dwApply) \
540     ICOM_METHOD2(HRESULT,SetConeOutsideVolume, LONG,lConeOutsideVolume, DWORD,dwApply) \
541     ICOM_METHOD2(HRESULT,SetMaxDistance,       D3DVALUE,flMaxDistance, DWORD,dwApply) \
542     ICOM_METHOD2(HRESULT,SetMinDistance,       D3DVALUE,flMinDistance, DWORD,dwApply) \
543     ICOM_METHOD2(HRESULT,SetMode,              DWORD,dwMode, DWORD,dwApply) \
544     ICOM_METHOD4(HRESULT,SetPosition,          D3DVALUE,x, D3DVALUE,y, D3DVALUE,z, DWORD,dwApply) \
545     ICOM_METHOD4(HRESULT,SetVelocity,          D3DVALUE,x, D3DVALUE,y, D3DVALUE,z, DWORD,dwApply)
546 #define IDirectSound3DBuffer_IMETHODS \
547     IUnknown_IMETHODS \
548     IDirectSound3DBuffer_METHODS
549 ICOM_DEFINE(IDirectSound3DBuffer,IUnknown)
550 #undef ICOM_INTERFACE
551
552 /*** IUnknown methods ***/
553 #define IDirectSound3DBuffer_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b)
554 #define IDirectSound3DBuffer_AddRef(p)             ICOM_CALL (AddRef,p)
555 #define IDirectSound3DBuffer_Release(p)            ICOM_CALL (Release,p)
556 /*** IDirectSound3DBuffer methods ***/
557 #define IDirectSound3DBuffer_GetAllParameters(p,a)         ICOM_CALL1(GetAllParameters,p,a)
558 #define IDirectSound3DBuffer_GetConeAngles(p,a,b)          ICOM_CALL2(GetConeAngles,p,a,b)
559 #define IDirectSound3DBuffer_GetConeOrientation(p,a)       ICOM_CALL1(GetConeOrientation,p,a)
560 #define IDirectSound3DBuffer_GetConeOutsideVolume(p,a)     ICOM_CALL1(GetConeOutsideVolume,p,a)
561 #define IDirectSound3DBuffer_GetMaxDistance(p,a)           ICOM_CALL1(GetMaxDistance,p,a)
562 #define IDirectSound3DBuffer_GetMinDistance(p,a)           ICOM_CALL1(GetMinDistance,p,a)
563 #define IDirectSound3DBuffer_GetMode(p,a)                  ICOM_CALL1(GetMode,p,a)
564 #define IDirectSound3DBuffer_GetPosition(p,a)              ICOM_CALL1(GetPosition,p,a)
565 #define IDirectSound3DBuffer_GetVelocity(p,a)              ICOM_CALL1(GetVelocity,p,a)
566 #define IDirectSound3DBuffer_SetAllParameters(p,a,b)       ICOM_CALL2(SetAllParameters,p,a,b)
567 #define IDirectSound3DBuffer_SetConeAngles(p,a,b)          ICOM_CALL3(SetConeAngles,p,a,b)
568 #define IDirectSound3DBuffer_SetConeOrientation(p,a,b,c,d) ICOM_CALL4(SetConeOrientation,p,a,b,c,d)
569 #define IDirectSound3DBuffer_SetConeOutsideVolume(p,a,b)   ICOM_CALL2(SetConeOutsideVolume,p,a,b)
570 #define IDirectSound3DBuffer_SetMaxDistance(p,a,b)         ICOM_CALL2(SetMaxDistance,p,a,b)
571 #define IDirectSound3DBuffer_SetMinDistance(p,a,b)         ICOM_CALL2(SetMinDistance,p,a,b)
572 #define IDirectSound3DBuffer_SetMode(p,a,b)                ICOM_CALL2(SetMode,p,a,b)
573 #define IDirectSound3DBuffer_SetPosition(p,a,b,c,d)        ICOM_CALL4(SetPosition,p,a,b,c,d)
574 #define IDirectSound3DBuffer_SetVelocity(p,a,b,c,d)        ICOM_CALL4(SetVelocity,p,a,b,c,d)
575
576 /*****************************************************************************
577  * IKsPropertySet interface
578  */
579 #define KSPROPERTY_SUPPORT_GET  1
580 #define KSPROPERTY_SUPPORT_SET  2
581
582 #define ICOM_INTERFACE IKsPropertySet
583 #define IKsPropertySet_METHODS \
584     ICOM_METHOD7(HRESULT,Get,REFGUID,rgid,ULONG,x1,LPVOID,p1,ULONG,x2,LPVOID,p2,ULONG,x3,ULONG*,px4);\
585     ICOM_METHOD6(HRESULT,Set,REFGUID,rgid,ULONG,x1,LPVOID,p1,ULONG,x2,LPVOID,p2,ULONG,x3);\
586     ICOM_METHOD3(HRESULT,QuerySupport,REFGUID,rgid,ULONG,x1,ULONG*,px2);
587 #define IKsPropertySet_IMETHODS \
588         IUnknown_IMETHODS \
589         IKsPropertySet_METHODS
590 ICOM_DEFINE(IKsPropertySet,IUnknown)
591 #undef ICOM_INTERFACE
592
593 #define IKsPropertySet_QueryInterface(p,a,b)    ICOM_CALL2(QueryInterface,p,a,b)
594 #define IKsPropertySet_AddRef(p)                ICOM_CALL (AddRef,p)
595 #define IKsPropertySet_Release(p)               ICOM_CALL (Release,p)
596 #define IKsPropertySet_Get(p,a,b,c,d,e,f,g)     ICOM_CALL7(Get,p,a,b,c,d,e,f,g)
597 #define IKsPropertySet_Set(p,a,b,c,d,e,f)       ICOM_CALL6(Set,p,a,b,c,d,e,f)
598 #define IKsPropertySet_QuerySupport(p,a,b,c)    ICOM_CALL3(QuerySupport,p,a,b,c)
599
600
601 #ifdef __cplusplus
602 } /* extern "C" */
603 #endif /* defined(__cplusplus) */
604
605 #endif /* __WINE_DSOUND_H */