Added missing #include "config.h"
[wine/multimedia.git] / include / dsound.h
blob81a1220ade16af69d5f84b2eef337cc643be08fa
1 #ifndef __WINE_DSOUND_H
2 #define __WINE_DSOUND_H
4 #include "mmsystem.h"
6 DEFINE_GUID(CLSID_DirectSound, 0x47d4d946, 0x62e8, 0x11cf, 0x93, 0xbc, 0x44, 0x45, 0x53, 0x54, 0x0, 0x0);
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);
19 typedef struct IDirectSound IDirectSound,*LPDIRECTSOUND;
20 typedef struct IDirectSoundNotify IDirectSoundNotify,*LPDIRECTSOUNDNOTIFY;
21 typedef struct IDirectSoundBuffer IDirectSoundBuffer,*LPDIRECTSOUNDBUFFER,**LPLPDIRECTSOUNDBUFFER;
23 #define _FACDS 0x878
24 #define MAKE_DSHRESULT(code) MAKE_HRESULT(1,_FACDS,code)
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)
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
55 #define DSSCL_NORMAL 1
56 #define DSSCL_PRIORITY 2
57 #define DSSCL_EXCLUSIVE 3
58 #define DSSCL_WRITEPRIMARY 4
60 typedef struct _DSCAPS
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;
88 #define DSBPLAY_LOOPING 0x00000001
90 #define DSBSTATUS_PLAYING 0x00000001
91 #define DSBSTATUS_BUFFERLOST 0x00000002
92 #define DSBSTATUS_LOOPING 0x00000004
95 #define DSBLOCK_FROMWRITECURSOR 0x00000001
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*/
109 typedef struct _DSBCAPS
111 DWORD dwSize;
112 DWORD dwFlags;
113 DWORD dwBufferBytes;
114 DWORD dwUnlockTransferRate;
115 DWORD dwPlayCpuOverhead;
116 } DSBCAPS,*LPDSBCAPS;
118 #define DSSCL_NORMAL 1
119 #define DSSCL_PRIORITY 2
120 #define DSSCL_EXCLUSIVE 3
121 #define DSSCL_WRITEPRIMARY 4
123 typedef struct _DSBUFFERDESC
125 DWORD dwSize;
126 DWORD dwFlags;
127 DWORD dwBufferBytes;
128 DWORD dwReserved;
129 LPWAVEFORMATEX lpwfxFormat;
130 } DSBUFFERDESC,*LPDSBUFFERDESC;
132 typedef struct _DSBPOSITIONNOTIFY
134 DWORD dwOffset;
135 HANDLE32 hEventNotify;
136 } DSBPOSITIONNOTIFY,*LPDSBPOSITIONNOTIFY;
138 typedef const DSBPOSITIONNOTIFY *LPCDSBPOSITIONNOTIFY;
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
147 typedef LPVOID* LPLPVOID;
149 typedef BOOL32 (CALLBACK *LPDSENUMCALLBACK32W)(LPGUID,LPWSTR,LPWSTR,LPVOID);
150 typedef BOOL32 (CALLBACK *LPDSENUMCALLBACK32A)(LPGUID,LPSTR,LPSTR,LPVOID);
152 extern HRESULT WINAPI DirectSoundCreate(LPGUID lpGUID,LPDIRECTSOUND * ppDS,IUnknown *pUnkOuter );
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,
160 #define THIS LPDIRECTSOUND this
161 typedef struct tagLPDIRECTSOUND_VTABLE
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 ***/
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;
179 struct IDirectSound {
180 LPDIRECTSOUND_VTABLE lpvtbl;
181 DWORD ref;
182 int nrofbuffers;
183 LPDIRECTSOUNDBUFFER *buffers;
184 WAVEFORMATEX wfx; /* current main waveformat */
186 #undef THIS
188 #define THIS LPDIRECTSOUNDBUFFER this
189 typedef struct tagLPDIRECTSOUNDBUFFER_VTABLE
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 ***/
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;
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;
230 #undef THIS
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;
239 /* IDirectSoundNotify methods */
240 STDMETHOD(SetNotificationPositions) (THIS_ DWORD, LPCDSBPOSITIONNOTIFY) PURE;
241 } *LPDIRECTSOUNDNOTIFY_VTABLE,IDirectSoundNotify_VTable;
243 struct IDirectSoundNotify {
244 LPDIRECTSOUNDNOTIFY_VTABLE lpvtbl;
245 DWORD ref;
246 LPDIRECTSOUNDBUFFER dsb;
248 #undef THIS
249 #undef STDMETHOD
250 #undef STDMETHOD_
251 #undef PURE
252 #undef FAR
253 #undef THIS_
254 #endif