Release 980614
[wine] / include / dsound.h
1 #ifndef __WINE_DSOUND_H
2 #define __WINE_DSOUND_H
3
4 #include "mmsystem.h"
5
6 DEFINE_GUID(CLSID_DirectSound,          0x47d4d946, 0x62e8, 0x11cf, 0x93, 0xbc, 0x44, 0x45, 0x53, 0x54, 0x0, 0x0);
7
8 DEFINE_GUID(IID_IDirectSound,           0x279AFA83,0x4981,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60);
9 DEFINE_GUID(IID_IDirectSoundBuffer,     0x279AFA85,0x4981,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60); 
10 DEFINE_GUID(IID_IDirectSoundNotify,     0xB0210783,0x89cd,0x11d0,0xAF,0x08,0x00,0xA0,0xC9,0x25,0xCD,0x16);
11 DEFINE_GUID(IID_IDirectSound3DListener, 0x279AFA84,0x4981,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60);
12 DEFINE_GUID(IID_IDirectSound3DBuffer,   0x279AFA86,0x4981,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60); 
13 DEFINE_GUID(IID_IDirectSoundCapture,    0xB0210781,0x89CD,0x11D0,0xAF,0x08,0x00,0xA0,0xC9,0x25,0xCD,0x16);
14 DEFINE_GUID(IID_IDirectSoundCaptureBuffer,0xB0210782,0x89CD,0x11D0,0xAF,0x08,0x00,0xA0,0xC9,0x25,0xCD,0x16);
15 DEFINE_GUID(IID_IKsPropertySet,         0x31EFAC30,0x515C,0x11D0,0xA9,0xAA,0x00,0xAA,0x00,0x61,0xBE,0x93);
16
17
18
19 typedef struct IDirectSound IDirectSound,*LPDIRECTSOUND;
20 typedef struct IDirectSoundNotify IDirectSoundNotify,*LPDIRECTSOUNDNOTIFY;
21 typedef struct IDirectSoundBuffer IDirectSoundBuffer,*LPDIRECTSOUNDBUFFER,**LPLPDIRECTSOUNDBUFFER;
22
23 #define _FACDS          0x878
24 #define MAKE_DSHRESULT(code)            MAKE_HRESULT(1,_FACDS,code)
25
26 #define DS_OK                           0
27 #define DSERR_ALLOCATED                 MAKE_DSHRESULT(10)
28 #define DSERR_CONTROLUNAVAIL            MAKE_DSHRESULT(30)
29 #define DSERR_INVALIDPARAM              E_INVALIDARG
30 #define DSERR_INVALIDCALL               MAKE_DSHRESULT(50)
31 #define DSERR_GENERIC                   E_FAIL
32 #define DSERR_PRIOLEVELNEEDED           MAKE_DSHRESULT(70)
33 #define DSERR_OUTOFMEMORY               E_OUTOFMEMORY
34 #define DSERR_BADFORMAT                 MAKE_DSHRESULT(100)
35 #define DSERR_UNSUPPORTED               E_NOTIMPL
36 #define DSERR_NODRIVER                  MAKE_DSHRESULT(120)
37 #define DSERR_ALREADYINITIALIZED        MAKE_DSHRESULT(130)
38 #define DSERR_NOAGGREGATION             CLASS_E_NOAGGREGATION
39 #define DSERR_BUFFERLOST                MAKE_DSHRESULT(150)
40 #define DSERR_OTHERAPPHASPRIO           MAKE_DSHRESULT(160)
41 #define DSERR_UNINITIALIZED             MAKE_DSHRESULT(170)
42
43 #define DSCAPS_PRIMARYMONO          0x00000001
44 #define DSCAPS_PRIMARYSTEREO        0x00000002
45 #define DSCAPS_PRIMARY8BIT          0x00000004
46 #define DSCAPS_PRIMARY16BIT         0x00000008
47 #define DSCAPS_CONTINUOUSRATE       0x00000010
48 #define DSCAPS_EMULDRIVER           0x00000020
49 #define DSCAPS_CERTIFIED            0x00000040
50 #define DSCAPS_SECONDARYMONO        0x00000100
51 #define DSCAPS_SECONDARYSTEREO      0x00000200
52 #define DSCAPS_SECONDARY8BIT        0x00000400
53 #define DSCAPS_SECONDARY16BIT       0x00000800
54
55 #define DSSCL_NORMAL            1
56 #define DSSCL_PRIORITY          2
57 #define DSSCL_EXCLUSIVE         3
58 #define DSSCL_WRITEPRIMARY      4
59
60 typedef struct _DSCAPS
61 {
62     DWORD       dwSize;
63     DWORD       dwFlags;
64     DWORD       dwMinSecondarySampleRate;
65     DWORD       dwMaxSecondarySampleRate;
66     DWORD       dwPrimaryBuffers;
67     DWORD       dwMaxHwMixingAllBuffers;
68     DWORD       dwMaxHwMixingStaticBuffers;
69     DWORD       dwMaxHwMixingStreamingBuffers;
70     DWORD       dwFreeHwMixingAllBuffers;
71     DWORD       dwFreeHwMixingStaticBuffers;
72     DWORD       dwFreeHwMixingStreamingBuffers;
73     DWORD       dwMaxHw3DAllBuffers;
74     DWORD       dwMaxHw3DStaticBuffers;
75     DWORD       dwMaxHw3DStreamingBuffers;
76     DWORD       dwFreeHw3DAllBuffers;
77     DWORD       dwFreeHw3DStaticBuffers;
78     DWORD       dwFreeHw3DStreamingBuffers;
79     DWORD       dwTotalHwMemBytes;
80     DWORD       dwFreeHwMemBytes;
81     DWORD       dwMaxContigFreeHwMemBytes;
82     DWORD       dwUnlockTransferRateHwBuffers;
83     DWORD       dwPlayCpuOverheadSwBuffers;
84     DWORD       dwReserved1;
85     DWORD       dwReserved2;
86 } DSCAPS,*LPDSCAPS;
87
88 #define DSBPLAY_LOOPING         0x00000001
89
90 #define DSBSTATUS_PLAYING           0x00000001
91 #define DSBSTATUS_BUFFERLOST        0x00000002
92 #define DSBSTATUS_LOOPING           0x00000004
93
94
95 #define DSBLOCK_FROMWRITECURSOR         0x00000001
96
97 #define DSBCAPS_PRIMARYBUFFER       0x00000001
98 #define DSBCAPS_STATIC              0x00000002
99 #define DSBCAPS_LOCHARDWARE         0x00000004
100 #define DSBCAPS_LOCSOFTWARE         0x00000008
101 #define DSBCAPS_CTRLFREQUENCY       0x00000020
102 #define DSBCAPS_CTRLPAN             0x00000040
103 #define DSBCAPS_CTRLVOLUME          0x00000080
104 #define DSBCAPS_CTRLDEFAULT         0x000000E0  /* Pan + volume + frequency. */
105 #define DSBCAPS_CTRLALL             0x000000E0  /* All control capabilities */
106 #define DSBCAPS_STICKYFOCUS         0x00004000
107 #define DSBCAPS_GETCURRENTPOSITION2 0x00010000  /* More accurate play cursor under emulation*/
108
109 typedef struct _DSBCAPS
110 {
111     DWORD       dwSize;
112     DWORD       dwFlags;
113     DWORD       dwBufferBytes;
114     DWORD       dwUnlockTransferRate;
115     DWORD       dwPlayCpuOverhead;
116 } DSBCAPS,*LPDSBCAPS;
117
118 #define DSSCL_NORMAL                1
119 #define DSSCL_PRIORITY              2
120 #define DSSCL_EXCLUSIVE             3
121 #define DSSCL_WRITEPRIMARY          4
122
123 typedef struct _DSBUFFERDESC
124 {
125     DWORD               dwSize;
126     DWORD               dwFlags;
127     DWORD               dwBufferBytes;
128     DWORD               dwReserved;
129     LPWAVEFORMATEX      lpwfxFormat;
130 } DSBUFFERDESC,*LPDSBUFFERDESC;
131
132 typedef struct _DSBPOSITIONNOTIFY
133 {
134         DWORD           dwOffset;
135         HANDLE32        hEventNotify;
136 } DSBPOSITIONNOTIFY,*LPDSBPOSITIONNOTIFY;
137
138 typedef const DSBPOSITIONNOTIFY *LPCDSBPOSITIONNOTIFY;
139
140 #define DSSPEAKER_HEADPHONE     1
141 #define DSSPEAKER_MONO          2
142 #define DSSPEAKER_QUAD          3
143 #define DSSPEAKER_STEREO        4
144 #define DSSPEAKER_SURROUND      5
145
146
147 typedef LPVOID* LPLPVOID;
148
149 typedef BOOL32 (CALLBACK *LPDSENUMCALLBACK32W)(LPGUID,LPWSTR,LPWSTR,LPVOID);
150 typedef BOOL32 (CALLBACK *LPDSENUMCALLBACK32A)(LPGUID,LPSTR,LPSTR,LPVOID);
151
152 extern HRESULT WINAPI DirectSoundCreate(LPGUID lpGUID,LPDIRECTSOUND * ppDS,IUnknown *pUnkOuter );
153
154 #define STDMETHOD(xfn) HRESULT (CALLBACK *fn##xfn)
155 #define STDMETHOD_(ret,xfn) ret (CALLBACK *fn##xfn)
156 #define PURE
157 #define FAR
158 #define THIS_ THIS,
159
160 #define THIS LPDIRECTSOUND this
161 typedef struct tagLPDIRECTSOUND_VTABLE
162 {
163     /*** IUnknown methods ***/
164     STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
165     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
166     STDMETHOD_(ULONG,Release) (THIS) PURE;
167     /*** IDirectSound methods ***/
168
169     STDMETHOD( CreateSoundBuffer)(THIS_ LPDSBUFFERDESC, LPLPDIRECTSOUNDBUFFER, IUnknown FAR *) PURE;
170     STDMETHOD( GetCaps)(THIS_ LPDSCAPS ) PURE;
171     STDMETHOD( DuplicateSoundBuffer)(THIS_ LPDIRECTSOUNDBUFFER, LPLPDIRECTSOUNDBUFFER ) PURE;
172     STDMETHOD( SetCooperativeLevel)(THIS_ HWND32, DWORD ) PURE;
173     STDMETHOD( Compact)(THIS ) PURE;
174     STDMETHOD( GetSpeakerConfig)(THIS_ LPDWORD ) PURE;
175     STDMETHOD( SetSpeakerConfig)(THIS_ DWORD ) PURE;
176     STDMETHOD( Initialize)(THIS_ GUID FAR * ) PURE;
177 } *LPDIRECTSOUND_VTABLE;
178
179 struct IDirectSound {
180         LPDIRECTSOUND_VTABLE    lpvtbl;
181         DWORD                   ref;
182         int                     nrofbuffers;
183         LPDIRECTSOUNDBUFFER     *buffers;
184         WAVEFORMATEX            wfx; /* current main waveformat */
185 };
186 #undef THIS
187
188 #define THIS LPDIRECTSOUNDBUFFER this
189 typedef struct tagLPDIRECTSOUNDBUFFER_VTABLE
190 {
191     /*** IUnknown methods ***/
192     STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
193     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
194     STDMETHOD_(ULONG,Release) (THIS) PURE;
195     /*** IDirectSoundBuffer methods ***/
196
197     STDMETHOD(           GetCaps)(THIS_ LPDSBCAPS ) PURE;
198     STDMETHOD(GetCurrentPosition)(THIS_ LPDWORD,LPDWORD ) PURE;
199     STDMETHOD(         GetFormat)(THIS_ LPWAVEFORMATEX, DWORD, LPDWORD ) PURE;
200     STDMETHOD(         GetVolume)(THIS_ LPLONG ) PURE;
201     STDMETHOD(            GetPan)(THIS_ LPLONG ) PURE;
202     STDMETHOD(      GetFrequency)(THIS_ LPDWORD ) PURE;
203     STDMETHOD(         GetStatus)(THIS_ LPDWORD ) PURE;
204     STDMETHOD(        Initialize)(THIS_ LPDIRECTSOUND, LPDSBUFFERDESC ) PURE;
205     STDMETHOD(              Lock)(THIS_ DWORD,DWORD,LPVOID,LPDWORD,LPVOID,LPDWORD,DWORD ) PURE;
206     STDMETHOD(              Play)(THIS_ DWORD,DWORD,DWORD ) PURE;
207     STDMETHOD(SetCurrentPosition)(THIS_ DWORD ) PURE;
208     STDMETHOD(         SetFormat)(THIS_ LPWAVEFORMATEX ) PURE;
209     STDMETHOD(         SetVolume)(THIS_ LONG ) PURE;
210     STDMETHOD(            SetPan)(THIS_ LONG ) PURE;
211     STDMETHOD(      SetFrequency)(THIS_ DWORD ) PURE;
212     STDMETHOD(              Stop)(THIS  ) PURE;
213     STDMETHOD(            Unlock)(THIS_ LPVOID,DWORD,LPVOID,DWORD ) PURE;
214     STDMETHOD(           Restore)(THIS  ) PURE;
215 } *LPDIRECTSOUNDBUFFER_VTABLE;
216
217 struct IDirectSoundBuffer {
218         LPDIRECTSOUNDBUFFER_VTABLE      lpvtbl;
219         WAVEFORMATEX                    wfx;
220         DWORD                           ref;
221         LPBYTE                          buffer;
222         DWORD                           playflags,playing,playpos,writepos,buflen;
223         LONG                            volume,pan;
224         LPDIRECTSOUND                   dsound;
225         DSBUFFERDESC                    dsbd;
226         LPDSBPOSITIONNOTIFY             notifies;
227         int                             nrofnotifies;
228         double                          volfac;
229 };
230 #undef THIS
231
232 #define THIS LPDIRECTSOUNDNOTIFY this
233 typedef struct IDirectSoundNotify_VTable {
234         /* IUnknown methods */
235         STDMETHOD(QueryInterface)           (THIS_ REFIID, LPVOID *) PURE;
236         STDMETHOD_(ULONG,AddRef)            (THIS) PURE;
237         STDMETHOD_(ULONG,Release)           (THIS) PURE;
238
239         /* IDirectSoundNotify methods */
240         STDMETHOD(SetNotificationPositions) (THIS_ DWORD, LPCDSBPOSITIONNOTIFY) PURE;
241 } *LPDIRECTSOUNDNOTIFY_VTABLE,IDirectSoundNotify_VTable;
242
243 struct IDirectSoundNotify {
244         LPDIRECTSOUNDNOTIFY_VTABLE      lpvtbl;
245         DWORD                           ref;
246         LPDIRECTSOUNDBUFFER             dsb;
247 };
248 #undef THIS
249 #undef STDMETHOD
250 #undef STDMETHOD_
251 #undef PURE
252 #undef FAR
253 #undef THIS_
254
255 /* DirectPlayLobby stuff */
256 /* {AF465C71-9588-11cf-A020-00AA006157AC} */
257 DEFINE_GUID(IID_IDirectPlayLobby, 0xaf465c71, 0x9588, 0x11cf, 0xa0, 0x20, 0x0, 0xaa, 0x0, 0x61, 0x57, 0xac);
258 /* {26C66A70-B367-11cf-A024-00AA006157AC} */
259 DEFINE_GUID(IID_IDirectPlayLobbyA, 0x26c66a70, 0xb367, 0x11cf, 0xa0, 0x24, 0x0, 0xaa, 0x0, 0x61, 0x57, 0xac);
260 /* {0194C220-A303-11d0-9C4F-00A0C905425E} */
261 DEFINE_GUID(IID_IDirectPlayLobby2, 0x194c220, 0xa303, 0x11d0, 0x9c, 0x4f, 0x0, 0xa0, 0xc9, 0x5, 0x42, 0x5e);
262 /* {1BB4AF80-A303-11d0-9C4F-00A0C905425E} */
263 DEFINE_GUID(IID_IDirectPlayLobby2A, 0x1bb4af80, 0xa303, 0x11d0, 0x9c, 0x4f, 0x0, 0xa0, 0xc9, 0x5, 0x42, 0x5e);
264 /* {2FE8F810-B2A5-11d0-A787-0000F803ABFC} */
265 DEFINE_GUID(CLSID_DirectPlayLobby, 0x2fe8f810, 0xb2a5, 0x11d0, 0xa7, 0x87, 0x0, 0x0, 0xf8, 0x3, 0xab, 0xfc);
266
267 typedef struct IDirectPlayLobby     *LPDIRECTPLAYLOBBY;
268 typedef struct IDirectPlayLobby     *LPDIRECTPLAYLOBBYA;
269 typedef struct IDirectPlayLobby     IDirectPlayLobbyA;
270
271 typedef struct IDirectPlayLobby2    *LPDIRECTPLAYLOBBY2;
272 typedef struct IDirectPlayLobby2    *LPDIRECTPLAYLOBBY2A;
273 typedef struct IDirectPlayLobby2    IDirectPlayLobby2A;
274
275 extern HRESULT WINAPI DirectPlayLobbyCreateW(LPGUID, LPDIRECTPLAYLOBBY *, IUnknown *, LPVOID, DWORD );
276
277 extern HRESULT WINAPI DirectPlayLobbyCreateA(LPGUID, LPDIRECTPLAYLOBBYA *, IUnknown *, LPVOID, DWORD );
278
279 #endif