Fixed bug that could cause SendMessage to return too early in certain
[wine] / include / dsdriver.h
1 /*
2  * DirectSound driver
3  * (DirectX 5 version)
4  *
5  * Copyright (C) 2000 Ove Kaaven
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20  */
21
22 #ifndef __WINE_DSDRIVER_H
23 #define __WINE_DSDRIVER_H
24
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28
29 /*****************************************************************************
30  * Predeclare the interfaces
31  */
32 DEFINE_GUID(IID_IDsDriver,              0x8C4233C0l, 0xB4CC, 0x11CE, 0x92, 0x94, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00);
33 typedef struct IDsDriver IDsDriver,*PIDSDRIVER;
34
35 DEFINE_GUID(IID_IDsDriverBuffer,        0x8C4233C1l, 0xB4CC, 0x11CE, 0x92, 0x94, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00);
36 typedef struct IDsDriverBuffer IDsDriverBuffer,*PIDSDRIVERBUFFER;
37
38 DEFINE_GUID(IID_IDsDriverPropertySet,   0x0F6F2E8E0, 0xD842, 0x11D0, 0x8F, 0x75, 0x00, 0xC0, 0x4F, 0xC2, 0x8A, 0xCA);
39 typedef struct IDsDriverPropertySet IDsDriverPropertySet,*PIDSDRIVERPROPERTYSET;
40
41 DEFINE_GUID(IID_IDsDriverNotify,        0x00363EF44, 0x3B57, 0x11D3, 0xAC, 0x79, 0x00, 0x10, 0x5A, 0x01, 0x7f, 0xe1);
42 typedef struct IDsDriverNotify IDsDriverNotify,*PIDSDRIVERNOTIFY;
43
44 DEFINE_GUID(IID_IDsCaptureDriver,       0x03DD10C47, 0x74FB, 0x11D3, 0x90, 0x49, 0xCB, 0xB4, 0xB3, 0x2E, 0xAA, 0x08);
45 typedef struct IDsCaptureDriver IDsCaptureDriver,*PIDSCDRIVER;
46
47 DEFINE_GUID(IID_IDsCaptureDriverBuffer, 0x03DD10C48, 0x74FB, 0x11D3, 0x90, 0x49, 0xCB, 0xB4, 0xB3, 0x2E, 0xAA, 0x08);
48 typedef struct IDsCaptureDriverBuffer IDsCaptureDriverBuffer,*PIDSCDRIVERBUFFER;
49
50 #define DSDDESC_DOMMSYSTEMOPEN          0x00000001
51 #define DSDDESC_DOMMSYSTEMSETFORMAT     0x00000002
52 #define DSDDESC_USESYSTEMMEMORY         0x00000004
53 #define DSDDESC_DONTNEEDPRIMARYLOCK     0x00000008
54 #define DSDDESC_DONTNEEDSECONDARYLOCK   0x00000010
55
56 #define DSDHEAP_NOHEAP                  0
57 #define DSDHEAP_CREATEHEAP              1
58 #define DSDHEAP_USEDIRECTDRAWHEAP       2
59 #define DSDHEAP_PRIVATEHEAP             3
60
61 typedef struct _DSDRIVERDESC
62 {
63     DWORD       dwFlags;
64     CHAR        szDesc[256];
65     CHAR        szDrvName[256];
66     DWORD       dnDevNode;
67     WORD        wVxdId;
68     WORD        wReserved;
69     ULONG       ulDeviceNum;
70     DWORD       dwHeapType;
71     LPVOID      pvDirectDrawHeap;
72     DWORD       dwMemStartAddress;
73     DWORD       dwMemEndAddress;
74     DWORD       dwMemAllocExtra;
75     LPVOID      pvReserved1;
76     LPVOID      pvReserved2;
77 } DSDRIVERDESC,*PDSDRIVERDESC;
78
79 typedef struct _DSDRIVERCAPS
80 {
81     DWORD       dwFlags;
82     DWORD       dwMinSecondarySampleRate;
83     DWORD       dwMaxSecondarySampleRate;
84     DWORD       dwPrimaryBuffers;
85     DWORD       dwMaxHwMixingAllBuffers;
86     DWORD       dwMaxHwMixingStaticBuffers;
87     DWORD       dwMaxHwMixingStreamingBuffers;
88     DWORD       dwFreeHwMixingAllBuffers;
89     DWORD       dwFreeHwMixingStaticBuffers;
90     DWORD       dwFreeHwMixingStreamingBuffers;
91     DWORD       dwMaxHw3DAllBuffers;
92     DWORD       dwMaxHw3DStaticBuffers;
93     DWORD       dwMaxHw3DStreamingBuffers;
94     DWORD       dwFreeHw3DAllBuffers;
95     DWORD       dwFreeHw3DStaticBuffers;
96     DWORD       dwFreeHw3DStreamingBuffers;
97     DWORD       dwTotalHwMemBytes;
98     DWORD       dwFreeHwMemBytes;
99     DWORD       dwMaxContigFreeHwMemBytes;
100 } DSDRIVERCAPS,*PDSDRIVERCAPS;
101
102 typedef struct _DSVOLUMEPAN
103 {
104     DWORD       dwTotalLeftAmpFactor;
105     DWORD       dwTotalRightAmpFactor;
106     LONG        lVolume;
107     DWORD       dwVolAmpFactor;
108     LONG        lPan;
109     DWORD       dwPanLeftAmpFactor;
110     DWORD       dwPanRightAmpFactor;
111 } DSVOLUMEPAN,*PDSVOLUMEPAN;
112
113 typedef union _DSPROPERTY
114 {
115     struct {
116         GUID    Set;
117         ULONG   Id;
118         ULONG   Flags;
119         ULONG   InstanceId;
120     } DUMMYSTRUCTNAME;
121     ULONGLONG   Alignment;
122 } DSPROPERTY,*PDSPROPERTY;
123
124 typedef struct _DSCDRIVERCAPS
125 {
126     DWORD       dwSize;
127     DWORD       dwFlags;
128     DWORD       dwFormats;
129     DWORD       dwChannels;
130 } DSCDRIVERCAPS,*PDSCDRIVERCAPS;
131
132 /*****************************************************************************
133  * IDsDriver interface
134  */
135 #define ICOM_INTERFACE IDsDriver
136 #define IDsDriver_METHODS \
137     ICOM_METHOD1(HRESULT,GetDriverDesc,         PDSDRIVERDESC,pDsDriverDesc) \
138     ICOM_METHOD (HRESULT,Open) \
139     ICOM_METHOD (HRESULT,Close) \
140     ICOM_METHOD1(HRESULT,GetCaps,               PDSDRIVERCAPS,pDsDrvCaps) \
141     ICOM_METHOD6(HRESULT,CreateSoundBuffer,     LPWAVEFORMATEX,pwfx,DWORD,dwFlags,DWORD,dwCardAddress,LPDWORD,pdwcbBufferSize,LPBYTE*,ppbBuffer,LPVOID*,ppvObj) \
142     ICOM_METHOD2(HRESULT,DuplicateSoundBuffer,  PIDSDRIVERBUFFER,pIDsDriverBuffer,LPVOID*,ppvObj)
143 #define IDsDriver_IMETHODS \
144     IUnknown_METHODS \
145     IDsDriver_METHODS
146 ICOM_DEFINE(IDsDriver,IUnknown)
147 #undef ICOM_INTERFACE
148
149     /*** IUnknown methods ***/
150 #define IDsDriver_QueryInterface(p,a,b)         ICOM_CALL2(QueryInterface,p,a,b)
151 #define IDsDriver_AddRef(p)                     ICOM_CALL (AddRef,p)
152 #define IDsDriver_Release(p)                    ICOM_CALL (Release,p)
153     /*** IDsDriver methods ***/
154 #define IDsDriver_GetDriverDesc(p,a)            ICOM_CALL1(GetDriverDesc,p,a)
155 #define IDsDriver_Open(p)                       ICOM_CALL (Open,p)
156 #define IDsDriver_Close(p)                      ICOM_CALL (Close,p)
157 #define IDsDriver_GetCaps(p,a)                  ICOM_CALL1(GetCaps,p,a)
158 #define IDsDriver_CreateSoundBuffer(p,a,b,c,d,e,f) ICOM_CALL6(CreateSoundBuffer,p,a,b,c,d,e,f)
159 #define IDsDriver_DuplicateSoundBuffer(p,a,b)   ICOM_CALL2(DuplicateSoundBuffer,p,a,b)
160
161 /*****************************************************************************
162  * IDsDriverBuffer interface
163  */
164 #define ICOM_INTERFACE IDsDriverBuffer
165 #define IDsDriverBuffer_METHODS \
166     ICOM_METHOD7(HRESULT,Lock,          LPVOID*,ppvAudio1,LPDWORD,pdwLen1,LPVOID*,pdwAudio2,LPDWORD,pdwLen2,DWORD,dwWritePosition,DWORD,dwWriteLen,DWORD,dwFlags) \
167     ICOM_METHOD4(HRESULT,Unlock,        LPVOID,pvAudio1,DWORD,dwLen1,LPVOID,pvAudio2,DWORD,dwLen2) \
168     ICOM_METHOD1(HRESULT,SetFormat,     LPWAVEFORMATEX,pwfxToSet) \
169     ICOM_METHOD1(HRESULT,SetFrequency,  DWORD,dwFrequency) \
170     ICOM_METHOD1(HRESULT,SetVolumePan,  PDSVOLUMEPAN,pDsVolumePan) \
171     ICOM_METHOD1(HRESULT,SetPosition,   DWORD,dwNewPosition) \
172     ICOM_METHOD2(HRESULT,GetPosition,   LPDWORD,lpdwCurrentPlayCursor,LPDWORD,lpdwCurrentWriteCursor) \
173     ICOM_METHOD3(HRESULT,Play,          DWORD,dwReserved1,DWORD,dwReserved2,DWORD,dwFlags) \
174     ICOM_METHOD (HRESULT,Stop)
175 #define IDsDriverBuffer_IMETHODS \
176     IUnknown_METHODS \
177     IDsDriverBuffer_METHODS
178 ICOM_DEFINE(IDsDriverBuffer,IUnknown)
179 #undef ICOM_INTERFACE
180
181     /*** IUnknown methods ***/
182 #define IDsDriverBuffer_QueryInterface(p,a,b)   ICOM_CALL2(QueryInterface,p,a,b)
183 #define IDsDriverBuffer_AddRef(p)               ICOM_CALL (AddRef,p)
184 #define IDsDriverBuffer_Release(p)              ICOM_CALL (Release,p)
185     /*** IDsDriverBuffer methods ***/
186 #define IDsDriverBuffer_Lock(p,a,b,c,d,e,f,g)   ICOM_CALL7(Lock,p,a,b,c,d,e,f,g)
187 #define IDsDriverBuffer_Unlock(p,a,b,c,d)       ICOM_CALL4(Unlock,p,a,b,c,d)
188 #define IDsDriverBuffer_SetFormat(p,a)          ICOM_CALL1(SetFormat,p,a)
189 #define IDsDriverBuffer_SetFrequency(p,a)       ICOM_CALL1(SetFrequency,p,a)
190 #define IDsDriverBuffer_SetVolumePan(p,a)       ICOM_CALL1(SetVolumePan,p,a)
191 #define IDsDriverBuffer_SetPosition(p,a)        ICOM_CALL1(SetPosition,p,a)
192 #define IDsDriverBuffer_GetPosition(p,a,b)      ICOM_CALL2(GetPosition,p,a,b)
193 #define IDsDriverBuffer_Play(p,a,b,c)           ICOM_CALL3(Play,p,a,b,c)
194 #define IDsDriverBuffer_Stop(p)                 ICOM_CALL (Stop,p)
195
196 /*****************************************************************************
197  * IDsDriverPropertySet interface
198  */
199 #define ICOM_INTERFACE IDsDriverPropertySet
200 #define IDsDriverPropertySet_METHODS \
201     ICOM_METHOD6(HRESULT,Get,           PDSPROPERTY,pDsProperty,LPVOID,pPropertyParams,ULONG,cbPropertyParams,LPVOID,pPropertyData,ULONG,cbPropertyData,PULONG,pcbReturnedData) \
202     ICOM_METHOD5(HRESULT,Set,           PDSPROPERTY,pDsProperty,LPVOID,pPropertyParams,ULONG,cbPropertyParams,LPVOID,pPropertyData,ULONG,cbPropertyData) \
203     ICOM_METHOD3(HRESULT,QuerySupport,  REFGUID,PropertySetId,ULONG,PropertyId,PULONG,pSupport)
204 #define IDsDriverPropertySet_IMETHODS \
205     IUnknown_METHODS \
206     IDsDriverPropertySet_METHODS
207 ICOM_DEFINE(IDsDriverPropertySet,IUnknown)
208 #undef ICOM_INTERFACE
209
210     /*** IUnknown methods ***/
211 #define IDsDriverPropertySet_QueryInterface(p,a,b)      ICOM_CALL2(QueryInterface,p,a,b)
212 #define IDsDriverPropertySet_AddRef(p)                  ICOM_CALL (AddRef,p)
213 #define IDsDriverPropertySet_Release(p)                 ICOM_CALL (Release,p)
214     /*** IDsDriverPropertySet methods ***/
215 #define IDsDriverPropertySet_Get(p,a,b,c,d,e,f)         ICOM_CALL6(Get,p,a,b,c,d,e,f)
216 #define IDsDriverPropertySet_Set(p,a,b,c,d,e)           ICOM_CALL5(Set,p,a,b,c,d,e)
217 #define IDsDriverPropertySet_QuerySupport(p,a,b,c)      ICOM_CALL3(QuerySupport,p,a,b,c)
218
219 /* Defined property sets */
220 DEFINE_GUID(DSPROPSETID_DirectSound3DListener,    0x6D047B40, 0x7AF9, 0x11D0, 0x92, 0x94, 0x44, 0x45, 0x53, 0x54, 0x0, 0x0);
221 typedef enum
222 {
223     DSPROPERTY_DIRECTSOUND3DLISTENER_ALL,
224     DSPROPERTY_DIRECTSOUND3DLISTENER_POSITION,
225     DSPROPERTY_DIRECTSOUND3DLISTENER_VELOCITY,
226     DSPROPERTY_DIRECTSOUND3DLISTENER_ORIENTATION,
227     DSPROPERTY_DIRECTSOUND3DLISTENER_DISTANCEFACTOR,
228     DSPROPERTY_DIRECTSOUND3DLISTENER_ROLLOFFFACTOR,
229     DSPROPERTY_DIRECTSOUND3DLISTENER_DOPPLERFACTOR,
230     DSPROPERTY_DIRECTSOUND3DLISTENER_BATCH,
231     DSPROPERTY_DIRECTSOUND3DLISTENER_ALLOCATION
232 } DSPROPERTY_DIRECTSOUND3DLISTENER;
233
234 DEFINE_GUID(DSPROPSETID_DirectSound3DBuffer,      0x6D047B41, 0x7AF9, 0x11D0, 0x92, 0x94, 0x44, 0x45, 0x53, 0x54, 0x0, 0x0);
235 typedef enum
236 {
237     DSPROPERTY_DIRECTSOUND3DBUFFER_ALL,
238     DSPROPERTY_DIRECTSOUND3DBUFFER_POSITION,
239     DSPROPERTY_DIRECTSOUND3DBUFFER_VELOCITY,
240     DSPROPERTY_DIRECTSOUND3DBUFFER_CONEANGLES,
241     DSPROPERTY_DIRECTSOUND3DBUFFER_CONEORIENTATION,
242     DSPROPERTY_DIRECTSOUND3DBUFFER_CONEOUTSIDEVOLUME,
243     DSPROPERTY_DIRECTSOUND3DBUFFER_MINDISTANCE,
244     DSPROPERTY_DIRECTSOUND3DBUFFER_MAXDISTANCE,
245     DSPROPERTY_DIRECTSOUND3DBUFFER_MODE
246 } DSPROPERTY_DIRECTSOUND3DBUFFER;
247
248 DEFINE_GUID(DSPROPSETID_DirectSoundSpeakerConfig, 0x6D047B42, 0x7AF9, 0x11D0, 0x92, 0x94, 0x44, 0x45, 0x53, 0x54, 0x0, 0x0);
249 typedef enum
250 {
251     DSPROPERTY_DIRECTSOUNDSPEAKERCONFIG_SPEAKERCONFIG
252 } DSPROPERTY_DIRECTSOUNDSPEAKERCONFIG;
253
254 /*****************************************************************************
255  * IDsDriverNotify interface
256  */
257 #define ICOM_INTERFACE IDsDriverNotify
258 #define IDsDriverNotify_METHODS \
259     ICOM_METHOD2(HRESULT,SetNotificationPositions,      DWORD,dwPositionNotifies,LPCDSBPOSITIONNOTIFY,pcPositionNotifies)
260 #define IDsDriverNotify_IMETHODS \
261     IUnknown_METHODS \
262     IDsDriverNotify_METHODS
263 ICOM_DEFINE(IDsDriverNotify,IUnknown)
264 #undef ICOM_INTERFACE
265
266     /*** IUnknown methods ***/
267 #define IDsDriverNotify_QueryInterface(p,a,b)           ICOM_CALL2(QueryInterface,p,a,b)
268 #define IDsDriverNotify_AddRef(p)                       ICOM_CALL (AddRef,p)
269 #define IDsDriverNotify_Release(p)                      ICOM_CALL (Release,p)
270     /*** IDsDriverNotify methods ***/
271 #define IDsDriverNotify_SetNotificationPositions(p,a,b) ICOM_CALL2(SetNotificationPositions,p,a,b)
272
273 /*****************************************************************************
274  * IDsCaptureDriver interface
275  */
276 #define ICOM_INTERFACE IDsCaptureDriver
277 #define IDsCaptureDriver_METHODS \
278     ICOM_METHOD1(HRESULT,GetDriverDesc,         PDSDRIVERDESC,pDsDriverDesc) \
279     ICOM_METHOD (HRESULT,Open) \
280     ICOM_METHOD (HRESULT,Close) \
281     ICOM_METHOD1(HRESULT,GetCaps,               PDSCDRIVERCAPS,pDsDrvCaps) \
282     ICOM_METHOD6(HRESULT,CreateCaptureBuffer,   LPWAVEFORMATEX,pwfx,DWORD,dwFlags,DWORD,dwCardAddress,LPDWORD,pdwcbBufferSize,LPBYTE*,ppbBuffer,LPVOID*,ppvObj)
283 #define IDsCaptureDriver_IMETHODS \
284     IUnknown_METHODS \
285     IDsCaptureDriver_METHODS
286 ICOM_DEFINE(IDsCaptureDriver,IUnknown)
287 #undef ICOM_INTERFACE
288
289     /*** IUnknown methods ***/
290 #define IDsCaptureDriver_QueryInterface(p,a,b)          ICOM_CALL2(QueryInterface,p,a,b)
291 #define IDsCaptureDriver_AddRef(p)                      ICOM_CALL (AddRef,p)
292 #define IDsCaptureDriver_Release(p)                     ICOM_CALL (Release,p)
293     /*** IDsCaptureDriver methods ***/
294 #define IDsCaptureDriver_GetDriverDesc(p,a)             ICOM_CALL1(GetDriverDesc,p,a)
295 #define IDsCaptureDriver_Open(p)                        ICOM_CALL (Open,p)
296 #define IDsCaptureDriver_Close(p)                       ICOM_CALL (Close,p)
297 #define IDsCaptureDriver_GetCaps(p,a)                   ICOM_CALL1(GetCaps,p,a)
298 #define IDsCaptureDriver_CreateCaptureBuffer(p,a,b,c,d,e,f) ICOM_CALL6(CreateCaptureBuffer,p,a,b,c,d,e,f)
299
300 /*****************************************************************************
301  * IDsCaptureDriverBuffer interface
302  */
303 #define ICOM_INTERFACE IDsCaptureDriverBuffer
304 #define IDsCaptureDriverBuffer_METHODS \
305     ICOM_METHOD7(HRESULT,Lock,          LPVOID*,ppvAudio1,LPDWORD,pdwLen1,LPVOID*,ppvAudio2,LPDWORD,pdwLen2,DWORD,dwWritePosition,DWORD,dwWriteLen,DWORD,dwFlags) \
306     ICOM_METHOD4(HRESULT,Unlock,        LPVOID,pvAudio1,DWORD,dwLen1,LPVOID,pvAudio2,DWORD,dwLen2) \
307     ICOM_METHOD1(HRESULT,SetFormat,     LPWAVEFORMATEX,pwfxToSet) \
308     ICOM_METHOD2(HRESULT,GetPosition,   LPDWORD,lpdwCurrentPlayCursor,LPDWORD,lpdwCurrentWriteCursor) \
309     ICOM_METHOD1(HRESULT,GetStatus,     LPDWORD,lpdwStatus) \
310     ICOM_METHOD1(HRESULT,Start,         DWORD,dwFlags) \
311     ICOM_METHOD (HRESULT,Stop)
312 #define IDsCaptureDriverBuffer_IMETHODS \
313     IUnknown_METHODS \
314     IDsCaptureDriverBuffer_METHODS
315 ICOM_DEFINE(IDsCaptureDriverBuffer,IUnknown)
316 #undef ICOM_INTERFACE
317
318     /*** IUnknown methods ***/
319 #define IDsCaptureDriverBuffer_QueryInterface(p,a,b)    ICOM_CALL2(QueryInterface,p,a,b)
320 #define IDsCaptureDriverBuffer_AddRef(p)                ICOM_CALL (AddRef,p)
321 #define IDsCaptureDriverBuffer_Release(p)               ICOM_CALL (Release,p)
322     /*** IDsCaptureDriverBuffer methods ***/
323 #define IDsCaptureDriverBuffer_Lock(p,a,b,c,d,e,f,g)    ICOM_CALL7(Lock,p,a,b,c,d,e,f,g)
324 #define IDsCaptureDriverBuffer_Unlock(p,a,b,c,d)        ICOM_CALL4(Unlock,p,a,b,c,d)
325 #define IDsCaptureDriverBuffer_SetFormat(p,a)           ICOM_CALL1(SetFormat,p,a)
326 #define IDsCaptureDriverBuffer_GetPosition(p,a,b)       ICOM_CALL2(GetPosition,p,a,b)
327 #define IDsCaptureDriverBuffer_GetStatus(p,a)           ICOM_CALL1(GetStatus,p,a)
328 #define IDsCaptureDriverBuffer_Start(p,a)               ICOM_CALL1(Start,p,a)
329 #define IDsCaptureDriverBuffer_Stop(p)                  ICOM_CALL (Stop,p)
330
331 #ifdef __cplusplus
332 } /* extern "C" */
333 #endif
334
335 #endif /* __WINE_DSDRIVER_H */