HTTP_DealWithProxy: Only add http:// to proxy string when needed.
[wine/multimedia.git] / dlls / dsound / dsound_private.h
blob77f0c531c319a0ae5825366022bf53786445f7e8
1 /* DirectSound
3 * Copyright 1998 Marcus Meissner
4 * Copyright 1998 Rob Riggs
5 * Copyright 2000-2001 TransGaming Technologies, Inc.
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.
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.
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
22 /* Linux does not support better timing than 10ms */
23 #define DS_TIME_RES 10 /* Resolution of multimedia timer */
24 #define DS_TIME_DEL 10 /* Delay of multimedia timer callback, and duration of HEL fragment */
26 #define DS_HEL_FRAGS 48 /* HEL only: number of waveOut fragments in primary buffer
27 * (changing this won't help you) */
29 /* direct sound hardware acceleration levels */
30 #define DS_HW_ACCEL_FULL 0 /* default on Windows 98 */
31 #define DS_HW_ACCEL_STANDARD 1 /* default on Windows 2000 */
32 #define DS_HW_ACCEL_BASIC 2
33 #define DS_HW_ACCEL_EMULATION 3
35 extern int ds_emuldriver;
36 extern int ds_hel_margin;
37 extern int ds_hel_queue;
38 extern int ds_snd_queue_max;
39 extern int ds_snd_queue_min;
40 extern int ds_hw_accel;
41 extern int ds_default_playback;
42 extern int ds_default_capture;
44 /*****************************************************************************
45 * Predeclare the interface implementation structures
47 typedef struct IDirectSoundImpl IDirectSoundImpl;
48 typedef struct IDirectSoundBufferImpl IDirectSoundBufferImpl;
49 typedef struct IDirectSoundCaptureImpl IDirectSoundCaptureImpl;
50 typedef struct IDirectSoundCaptureBufferImpl IDirectSoundCaptureBufferImpl;
51 typedef struct IDirectSoundFullDuplexImpl IDirectSoundFullDuplexImpl;
52 typedef struct IDirectSoundNotifyImpl IDirectSoundNotifyImpl;
53 typedef struct IDirectSoundCaptureNotifyImpl IDirectSoundCaptureNotifyImpl;
54 typedef struct IDirectSound3DListenerImpl IDirectSound3DListenerImpl;
55 typedef struct IDirectSound3DBufferImpl IDirectSound3DBufferImpl;
56 typedef struct IKsBufferPropertySetImpl IKsBufferPropertySetImpl;
57 typedef struct IKsPrivatePropertySetImpl IKsPrivatePropertySetImpl;
58 typedef struct PrimaryBufferImpl PrimaryBufferImpl;
59 typedef struct SecondaryBufferImpl SecondaryBufferImpl;
60 typedef struct IClassFactoryImpl IClassFactoryImpl;
62 /*****************************************************************************
63 * IDirectSound implementation structure
65 struct IDirectSoundImpl
67 /* IUnknown fields */
68 ICOM_VFIELD(IDirectSound8);
69 DWORD ref;
70 /* IDirectSoundImpl fields */
71 GUID guid;
72 PIDSDRIVER driver;
73 DSDRIVERDESC drvdesc;
74 DSDRIVERCAPS drvcaps;
75 DWORD priolevel;
76 WAVEFORMATEX wfx; /* current main waveformat */
77 HWAVEOUT hwo;
78 LPWAVEHDR pwave[DS_HEL_FRAGS];
79 UINT timerID, pwplay, pwwrite, pwqueue, prebuf, precount;
80 DWORD fraglen;
81 PIDSDRIVERBUFFER hwbuf;
82 LPBYTE buffer;
83 DWORD writelead, buflen, state, playpos, mixpos;
84 BOOL need_remix;
85 int nrofbuffers;
86 IDirectSoundBufferImpl** buffers;
87 RTL_RWLOCK lock;
88 CRITICAL_SECTION mixlock;
89 DSVOLUMEPAN volpan;
90 PrimaryBufferImpl* primary;
91 DSBUFFERDESC dsbd;
92 DWORD speaker_config;
94 /* DirectSound3DListener fields */
95 IDirectSound3DListenerImpl* listener;
96 DS3DLISTENER ds3dl;
97 CRITICAL_SECTION ds3dl_lock;
98 BOOL ds3dl_need_recalc;
101 /* reference counted buffer memory for duplicated buffer memory */
102 typedef struct BufferMemory
104 DWORD ref;
105 LPBYTE memory;
106 } BufferMemory;
108 /*****************************************************************************
109 * IDirectSoundBuffer implementation structure
111 struct IDirectSoundBufferImpl
113 /* FIXME: document */
114 /* IUnknown fields */
115 ICOM_VFIELD(IDirectSoundBuffer8);
116 DWORD ref;
117 /* IDirectSoundBufferImpl fields */
118 SecondaryBufferImpl* dsb;
119 IDirectSoundImpl* dsound;
120 CRITICAL_SECTION lock;
121 PIDSDRIVERBUFFER hwbuf;
122 WAVEFORMATEX wfx;
123 BufferMemory* buffer;
124 DWORD playflags,state,leadin;
125 DWORD playpos,startpos,writelead,buflen;
126 DWORD nAvgBytesPerSec;
127 DWORD freq;
128 DSVOLUMEPAN volpan, cvolpan;
129 DSBUFFERDESC dsbd;
130 /* used for frequency conversion (PerfectPitch) */
131 ULONG freqAdjust, freqAcc;
132 /* used for intelligent (well, sort of) prebuffering */
133 DWORD probably_valid_to, last_playpos;
134 DWORD primary_mixpos, buf_mixpos;
135 BOOL need_remix;
137 /* IDirectSoundNotifyImpl fields */
138 IDirectSoundNotifyImpl* notify;
139 LPDSBPOSITIONNOTIFY notifies;
140 int nrofnotifies;
141 PIDSDRIVERNOTIFY hwnotify;
143 /* DirectSound3DBuffer fields */
144 IDirectSound3DBufferImpl* ds3db;
145 DS3DBUFFER ds3db_ds3db;
146 LONG ds3db_lVolume;
147 BOOL ds3db_need_recalc;
149 /* IKsPropertySet fields */
150 IKsBufferPropertySetImpl* iks;
153 HRESULT WINAPI IDirectSoundBufferImpl_Create(
154 IDirectSoundImpl *ds,
155 IDirectSoundBufferImpl **pdsb,
156 LPDSBUFFERDESC dsbd);
158 /*****************************************************************************
159 * SecondaryBuffer implementation structure
161 struct SecondaryBufferImpl
163 ICOM_VFIELD(IDirectSoundBuffer8);
164 DWORD ref;
165 IDirectSoundBufferImpl* dsb;
168 HRESULT WINAPI SecondaryBufferImpl_Create(
169 IDirectSoundBufferImpl *dsb,
170 SecondaryBufferImpl **pdsb);
172 /*****************************************************************************
173 * PrimaryBuffer implementation structure
175 struct PrimaryBufferImpl
177 ICOM_VFIELD(IDirectSoundBuffer8);
178 DWORD ref;
179 IDirectSoundImpl* dsound;
182 HRESULT WINAPI PrimaryBufferImpl_Create(
183 IDirectSoundImpl *ds,
184 PrimaryBufferImpl **pdsb,
185 LPDSBUFFERDESC dsbd);
187 /*****************************************************************************
188 * IDirectSoundCapture implementation structure
190 struct IDirectSoundCaptureImpl
192 /* IUnknown fields */
193 ICOM_VFIELD(IDirectSoundCapture);
194 DWORD ref;
196 /* IDirectSoundCaptureImpl fields */
197 GUID guid;
198 BOOL initialized;
200 /* DirectSound driver stuff */
201 PIDSCDRIVER driver;
202 DSDRIVERDESC drvdesc;
203 DSCDRIVERCAPS drvcaps;
204 PIDSCDRIVERBUFFER hwbuf;
206 /* wave driver info */
207 HWAVEIN hwi;
209 /* more stuff */
210 LPBYTE buffer;
211 DWORD buflen;
212 DWORD read_position;
214 PWAVEFORMATEX pwfx;
216 IDirectSoundCaptureBufferImpl* capture_buffer;
217 DWORD state;
218 LPWAVEHDR pwave;
219 int nrofpwaves;
220 int index;
221 CRITICAL_SECTION lock;
224 /*****************************************************************************
225 * IDirectSoundCaptureBuffer implementation structure
227 struct IDirectSoundCaptureBufferImpl
229 /* IUnknown fields */
230 ICOM_VFIELD(IDirectSoundCaptureBuffer8);
231 DWORD ref;
233 /* IDirectSoundCaptureBufferImpl fields */
234 IDirectSoundCaptureImpl* dsound;
235 /* FIXME: don't need this */
236 LPDSCBUFFERDESC pdscbd;
237 DWORD flags;
239 /* IDirectSoundCaptureNotifyImpl fields */
240 IDirectSoundCaptureNotifyImpl* notify;
241 LPDSBPOSITIONNOTIFY notifies;
242 int nrofnotifies;
243 PIDSDRIVERNOTIFY hwnotify;
246 /*****************************************************************************
247 * IDirectSoundFullDuplex implementation structure
249 struct IDirectSoundFullDuplexImpl
251 /* IUnknown fields */
252 ICOM_VFIELD(IDirectSoundFullDuplex);
253 DWORD ref;
255 /* IDirectSoundFullDuplexImpl fields */
256 CRITICAL_SECTION lock;
259 /*****************************************************************************
260 * IDirectSoundNotify implementation structure
262 struct IDirectSoundNotifyImpl
264 /* IUnknown fields */
265 ICOM_VFIELD(IDirectSoundNotify);
266 DWORD ref;
267 IDirectSoundBufferImpl* dsb;
270 HRESULT WINAPI IDirectSoundNotifyImpl_Create(
271 IDirectSoundBufferImpl *dsb,
272 IDirectSoundNotifyImpl **pdsn);
274 /*****************************************************************************
275 * IDirectSoundCaptureNotify implementation structure
277 struct IDirectSoundCaptureNotifyImpl
279 /* IUnknown fields */
280 ICOM_VFIELD(IDirectSoundNotify);
281 DWORD ref;
282 IDirectSoundCaptureBufferImpl* dscb;
285 HRESULT WINAPI IDirectSoundCaptureNotifyImpl_Create(
286 IDirectSoundCaptureBufferImpl *dscb,
287 IDirectSoundCaptureNotifyImpl ** pdscn);
289 /*****************************************************************************
290 * IDirectSound3DListener implementation structure
292 struct IDirectSound3DListenerImpl
294 /* IUnknown fields */
295 ICOM_VFIELD(IDirectSound3DListener);
296 DWORD ref;
297 /* IDirectSound3DListenerImpl fields */
298 IDirectSoundImpl* dsound;
301 HRESULT WINAPI IDirectSound3DListenerImpl_Create(
302 PrimaryBufferImpl *pb,
303 IDirectSound3DListenerImpl **pdsl);
305 /*****************************************************************************
306 * IKsBufferPropertySet implementation structure
308 struct IKsBufferPropertySetImpl
310 /* IUnknown fields */
311 ICOM_VFIELD(IKsPropertySet);
312 DWORD ref;
313 /* IKsPropertySetImpl fields */
314 IDirectSoundBufferImpl* dsb;
317 HRESULT WINAPI IKsBufferPropertySetImpl_Create(
318 IDirectSoundBufferImpl *dsb,
319 IKsBufferPropertySetImpl **piks);
321 /*****************************************************************************
322 * IKsPrivatePropertySet implementation structure
324 struct IKsPrivatePropertySetImpl
326 /* IUnknown fields */
327 ICOM_VFIELD(IKsPropertySet);
328 DWORD ref;
331 HRESULT WINAPI IKsPrivatePropertySetImpl_Create(
332 IKsPrivatePropertySetImpl **piks);
334 /*****************************************************************************
335 * IDirectSound3DBuffer implementation structure
337 struct IDirectSound3DBufferImpl
339 /* IUnknown fields */
340 ICOM_VFIELD(IDirectSound3DBuffer);
341 DWORD ref;
342 /* IDirectSound3DBufferImpl fields */
343 IDirectSoundBufferImpl* dsb;
346 HRESULT WINAPI IDirectSound3DBufferImpl_Create(
347 IDirectSoundBufferImpl *dsb,
348 IDirectSound3DBufferImpl **pds3db);
350 /*******************************************************************************
351 * DirectSound ClassFactory implementation structure
353 struct IClassFactoryImpl
355 /* IUnknown fields */
356 ICOM_VFIELD(IClassFactory);
357 DWORD ref;
360 extern IClassFactoryImpl DSOUND_CAPTURE_CF;
361 extern IClassFactoryImpl DSOUND_FULLDUPLEX_CF;
363 void DSOUND_RecalcVolPan(PDSVOLUMEPAN volpan);
364 void DSOUND_RecalcFormat(IDirectSoundBufferImpl *dsb);
366 /* primary.c */
368 HRESULT DSOUND_PrimaryCreate(IDirectSoundImpl *This);
369 HRESULT DSOUND_PrimaryDestroy(IDirectSoundImpl *This);
370 HRESULT DSOUND_PrimaryPlay(IDirectSoundImpl *This);
371 HRESULT DSOUND_PrimaryStop(IDirectSoundImpl *This);
372 HRESULT DSOUND_PrimaryGetPosition(IDirectSoundImpl *This, LPDWORD playpos, LPDWORD writepos);
374 /* buffer.c */
376 DWORD DSOUND_CalcPlayPosition(IDirectSoundBufferImpl *This,
377 DWORD state, DWORD pplay, DWORD pwrite, DWORD pmix, DWORD bmix);
379 /* mixer.c */
381 void DSOUND_CheckEvent(IDirectSoundBufferImpl *dsb, int len);
382 void DSOUND_ForceRemix(IDirectSoundBufferImpl *dsb);
383 void DSOUND_MixCancelAt(IDirectSoundBufferImpl *dsb, DWORD buf_writepos);
384 void DSOUND_WaveQueue(IDirectSoundImpl *dsound, DWORD mixq);
385 void DSOUND_PerformMix(void);
386 void CALLBACK DSOUND_timer(UINT timerID, UINT msg, DWORD dwUser, DWORD dw1, DWORD dw2);
387 void CALLBACK DSOUND_callback(HWAVEOUT hwo, UINT msg, DWORD dwUser, DWORD dw1, DWORD dw2);
389 /* sound3d.c */
391 void DSOUND_Calc3DBuffer(IDirectSoundBufferImpl *dsb);
393 #define STATE_STOPPED 0
394 #define STATE_STARTING 1
395 #define STATE_PLAYING 2
396 #define STATE_CAPTURING 2
397 #define STATE_STOPPING 3
399 #define DSOUND_FREQSHIFT (14)
401 extern IDirectSoundImpl* dsound;
403 extern HRESULT mmErr(UINT err);
404 extern void setup_dsound_options(void);