msi: Fix some copy/paste bugs in the implementation of condition operators.
[wine] / dlls / dsound / dsound_private.h
1 /*                      DirectSound
2  *
3  * Copyright 1998 Marcus Meissner
4  * Copyright 1998 Rob Riggs
5  * Copyright 2000-2001 TransGaming Technologies, Inc.
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20  */
21
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 */
25
26 #define DS_HEL_FRAGS 48 /* HEL only: number of waveOut fragments in primary buffer
27                          * (changing this won't help you) */
28
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
34
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;
43 extern int ds_default_sample_rate;
44 extern int ds_default_bits_per_sample;
45
46 /*****************************************************************************
47  * Predeclare the interface implementation structures
48  */
49 typedef struct IDirectSoundImpl              IDirectSoundImpl;
50 typedef struct IDirectSound_IUnknown         IDirectSound_IUnknown;
51 typedef struct IDirectSound_IDirectSound     IDirectSound_IDirectSound;
52 typedef struct IDirectSound8_IUnknown        IDirectSound8_IUnknown;
53 typedef struct IDirectSound8_IDirectSound    IDirectSound8_IDirectSound;
54 typedef struct IDirectSound8_IDirectSound8   IDirectSound8_IDirectSound8;
55 typedef struct IDirectSoundBufferImpl        IDirectSoundBufferImpl;
56 typedef struct IDirectSoundCaptureImpl       IDirectSoundCaptureImpl;
57 typedef struct IDirectSoundCaptureBufferImpl IDirectSoundCaptureBufferImpl;
58 typedef struct IDirectSoundFullDuplexImpl    IDirectSoundFullDuplexImpl;
59 typedef struct IDirectSoundFullDuplex_IUnknown IDirectSoundFullDuplex_IUnknown;
60 typedef struct IDirectSoundFullDuplex_IDirectSound IDirectSoundFullDuplex_IDirectSound;
61 typedef struct IDirectSoundFullDuplex_IDirectSound8 IDirectSoundFullDuplex_IDirectSound8;
62 typedef struct IDirectSoundFullDuplex_IDirectSoundCapture IDirectSoundFullDuplex_IDirectSoundCapture;
63 typedef struct IDirectSoundNotifyImpl        IDirectSoundNotifyImpl;
64 typedef struct IDirectSoundCaptureNotifyImpl IDirectSoundCaptureNotifyImpl;
65 typedef struct IDirectSound3DListenerImpl    IDirectSound3DListenerImpl;
66 typedef struct IDirectSound3DBufferImpl      IDirectSound3DBufferImpl;
67 typedef struct IKsBufferPropertySetImpl      IKsBufferPropertySetImpl;
68 typedef struct IKsPrivatePropertySetImpl     IKsPrivatePropertySetImpl;
69 typedef struct PrimaryBufferImpl             PrimaryBufferImpl;
70 typedef struct SecondaryBufferImpl           SecondaryBufferImpl;
71 typedef struct IClassFactoryImpl             IClassFactoryImpl;
72 typedef struct DirectSoundDevice             DirectSoundDevice;
73 typedef struct DirectSoundCaptureDevice      DirectSoundCaptureDevice;
74
75 /*****************************************************************************
76  * IDirectSound implementation structure
77  */
78 struct IDirectSoundImpl
79 {
80     LONG                        ref;
81
82     DirectSoundDevice          *device;
83     LPUNKNOWN                   pUnknown;
84     LPDIRECTSOUND               pDS;
85     LPDIRECTSOUND8              pDS8;
86 };
87
88 HRESULT IDirectSoundImpl_Create(
89     LPDIRECTSOUND8 * ppds);
90
91 /*****************************************************************************
92  * IDirectSoundDevice implementation structure
93  */
94 struct DirectSoundDevice
95 {
96     LONG                        ref;
97
98     GUID                        guid;
99     PIDSDRIVER                  driver;
100     DSDRIVERDESC                drvdesc;
101     DSDRIVERCAPS                drvcaps;
102     DWORD                       priolevel;
103     PWAVEFORMATEX               pwfx;
104     HWAVEOUT                    hwo;
105     LPWAVEHDR                   pwave[DS_HEL_FRAGS];
106     UINT                        timerID, pwplay, pwwrite, pwqueue, prebuf, precount;
107     DWORD                       fraglen;
108     PIDSDRIVERBUFFER            hwbuf;
109     LPBYTE                      buffer;
110     DWORD                       writelead, buflen, state, playpos, mixpos;
111     BOOL                        need_remix;
112     int                         nrofbuffers;
113     IDirectSoundBufferImpl**    buffers;
114     RTL_RWLOCK                  buffer_list_lock;
115     CRITICAL_SECTION            mixlock;
116     PrimaryBufferImpl*          primary;
117     DSBUFFERDESC                dsbd;
118     DWORD                       speaker_config;
119     LPBYTE                      tmp_buffer;
120     DWORD                       tmp_buffer_len;
121
122     /* DirectSound3DListener fields */
123     IDirectSound3DListenerImpl* listener;
124     DS3DLISTENER                ds3dl;
125     BOOL                        ds3dl_need_recalc;
126 };
127
128 /* reference counted buffer memory for duplicated buffer memory */
129 typedef struct BufferMemory
130 {
131     LONG                        ref;
132     LPBYTE                      memory;
133 } BufferMemory;
134
135 HRESULT DirectSoundDevice_Create(DirectSoundDevice ** ppDevice);
136 ULONG DirectSoundDevice_AddRef(DirectSoundDevice * device);
137 ULONG DirectSoundDevice_Release(DirectSoundDevice * device);
138 HRESULT DirectSoundDevice_Initialize(
139     DirectSoundDevice ** ppDevice,
140     LPCGUID lpcGUID);
141 HRESULT DirectSoundDevice_AddBuffer(
142     DirectSoundDevice * device,
143     IDirectSoundBufferImpl * pDSB);
144 HRESULT DirectSoundDevice_RemoveBuffer(
145     DirectSoundDevice * device,
146     IDirectSoundBufferImpl * pDSB);
147 HRESULT DirectSoundDevice_GetCaps(DirectSoundDevice * device, LPDSCAPS lpDSCaps);
148 HRESULT DirectSoundDevice_CreateSoundBuffer(
149     DirectSoundDevice * device,
150     LPCDSBUFFERDESC dsbd,
151     LPLPDIRECTSOUNDBUFFER ppdsb,
152     LPUNKNOWN lpunk,
153     BOOL from8);
154 HRESULT DirectSoundDevice_DuplicateSoundBuffer(
155     DirectSoundDevice * device,
156     LPDIRECTSOUNDBUFFER psb,
157     LPLPDIRECTSOUNDBUFFER ppdsb);
158 HRESULT DirectSoundDevice_SetCooperativeLevel(
159     DirectSoundDevice * devcie,
160     HWND hwnd,
161     DWORD level);
162 HRESULT DirectSoundDevice_Compact(DirectSoundDevice * device);
163 HRESULT DirectSoundDevice_GetSpeakerConfig(
164     DirectSoundDevice * device,
165     LPDWORD lpdwSpeakerConfig);
166 HRESULT DirectSoundDevice_SetSpeakerConfig(
167     DirectSoundDevice * device,
168     DWORD config);
169 HRESULT DirectSoundDevice_VerifyCertification(
170     DirectSoundDevice * device,
171     LPDWORD pdwCertified);
172
173 /*****************************************************************************
174  * IDirectSound COM components
175  */
176 struct IDirectSound_IUnknown {
177     const IUnknownVtbl         *lpVtbl;
178     LONG                        ref;
179     LPDIRECTSOUND8              pds;
180 };
181
182 HRESULT IDirectSound_IUnknown_Create(
183     LPDIRECTSOUND8 pds,
184     LPUNKNOWN * ppunk);
185
186 struct IDirectSound_IDirectSound {
187     const IDirectSoundVtbl     *lpVtbl;
188     LONG                        ref;
189     LPDIRECTSOUND8              pds;
190 };
191
192 HRESULT IDirectSound_IDirectSound_Create(
193     LPDIRECTSOUND8 pds,
194     LPDIRECTSOUND * ppds);
195
196 /*****************************************************************************
197  * IDirectSound8 COM components
198  */
199 struct IDirectSound8_IUnknown {
200     const IUnknownVtbl         *lpVtbl;
201     LONG                        ref;
202     LPDIRECTSOUND8              pds;
203 };
204
205 HRESULT IDirectSound8_IUnknown_Create(
206     LPDIRECTSOUND8 pds,
207     LPUNKNOWN * ppunk);
208
209 struct IDirectSound8_IDirectSound {
210     const IDirectSoundVtbl     *lpVtbl;
211     LONG                        ref;
212     LPDIRECTSOUND8              pds;
213 };
214
215 HRESULT IDirectSound8_IDirectSound_Create(
216     LPDIRECTSOUND8 pds,
217     LPDIRECTSOUND * ppds);
218
219 struct IDirectSound8_IDirectSound8 {
220     const IDirectSound8Vtbl    *lpVtbl;
221     LONG                        ref;
222     LPDIRECTSOUND8              pds;
223 };
224
225 HRESULT IDirectSound8_IDirectSound8_Create(
226     LPDIRECTSOUND8 pds,
227     LPDIRECTSOUND8 * ppds);
228
229 /*****************************************************************************
230  * IDirectSoundBuffer implementation structure
231  */
232 struct IDirectSoundBufferImpl
233 {
234     /* FIXME: document */
235     /* IUnknown fields */
236     const IDirectSoundBuffer8Vtbl *lpVtbl;
237     LONG                        ref;
238     /* IDirectSoundBufferImpl fields */
239     SecondaryBufferImpl*        secondary;
240     DirectSoundDevice*          device;
241     CRITICAL_SECTION            lock;
242     PIDSDRIVERBUFFER            hwbuf;
243     PWAVEFORMATEX               pwfx;
244     BufferMemory*               buffer;
245     DWORD                       playflags,state,leadin;
246     DWORD                       playpos,startpos,writelead,buflen;
247     DWORD                       nAvgBytesPerSec;
248     DWORD                       freq;
249     DSVOLUMEPAN                 volpan, cvolpan;
250     DSBUFFERDESC                dsbd;
251     /* used for frequency conversion (PerfectPitch) */
252     ULONG                       freqAdjust, freqAcc;
253     /* used for intelligent (well, sort of) prebuffering */
254     DWORD                       probably_valid_to, last_playpos;
255     DWORD                       primary_mixpos, buf_mixpos;
256     BOOL                        need_remix;
257
258     /* IDirectSoundNotifyImpl fields */
259     IDirectSoundNotifyImpl*     notify;
260     LPDSBPOSITIONNOTIFY         notifies;
261     int                         nrofnotifies;
262     PIDSDRIVERNOTIFY            hwnotify;
263
264     /* DirectSound3DBuffer fields */
265     IDirectSound3DBufferImpl*   ds3db;
266     DS3DBUFFER                  ds3db_ds3db;
267     LONG                        ds3db_lVolume;
268     BOOL                        ds3db_need_recalc;
269
270     /* IKsPropertySet fields */
271     IKsBufferPropertySetImpl*   iks;
272 };
273
274 HRESULT IDirectSoundBufferImpl_Create(
275     DirectSoundDevice *device,
276     IDirectSoundBufferImpl **ppdsb,
277     LPCDSBUFFERDESC dsbd);
278 HRESULT IDirectSoundBufferImpl_Destroy(
279     IDirectSoundBufferImpl *pdsb);
280 HRESULT IDirectSoundBufferImpl_Duplicate(
281     DirectSoundDevice *device,
282     IDirectSoundBufferImpl **ppdsb,
283     IDirectSoundBufferImpl *pdsb);
284
285 /*****************************************************************************
286  * SecondaryBuffer implementation structure
287  */
288 struct SecondaryBufferImpl
289 {
290     const IDirectSoundBuffer8Vtbl *lpVtbl;
291     LONG                        ref;
292     IDirectSoundBufferImpl*     dsb;
293 };
294
295 HRESULT SecondaryBufferImpl_Create(
296     IDirectSoundBufferImpl *dsb,
297     SecondaryBufferImpl **pdsb);
298 HRESULT SecondaryBufferImpl_Destroy(
299     SecondaryBufferImpl *pdsb);
300
301 /*****************************************************************************
302  * PrimaryBuffer implementation structure
303  */
304 struct PrimaryBufferImpl
305 {
306     const IDirectSoundBuffer8Vtbl *lpVtbl;
307     LONG                        ref;
308     DirectSoundDevice*          device;
309 };
310
311 HRESULT PrimaryBufferImpl_Create(
312     DirectSoundDevice * device,
313     PrimaryBufferImpl **ppdsb,
314     LPCDSBUFFERDESC dsbd);
315
316 /*****************************************************************************
317  * IDirectSoundCapture implementation structure
318  */
319 struct IDirectSoundCaptureImpl
320 {
321     /* IUnknown fields */
322     const IDirectSoundCaptureVtbl     *lpVtbl;
323     LONG                               ref;
324
325     DirectSoundCaptureDevice          *device;
326 };
327
328 HRESULT IDirectSoundCaptureImpl_Create(
329     LPDIRECTSOUNDCAPTURE8 * ppds);
330
331 /*****************************************************************************
332  * DirectSoundCaptureDevice implementation structure
333  */
334 struct DirectSoundCaptureDevice
335 {
336     /* IDirectSoundCaptureImpl fields */
337     GUID                               guid;
338     LONG                               ref;
339
340     /* DirectSound driver stuff */
341     PIDSCDRIVER                        driver;
342     DSDRIVERDESC                       drvdesc;
343     DSCDRIVERCAPS                      drvcaps;
344     PIDSCDRIVERBUFFER                  hwbuf;
345
346     /* wave driver info */
347     HWAVEIN                            hwi;
348
349     /* more stuff */
350     LPBYTE                             buffer;
351     DWORD                              buflen;
352     DWORD                              read_position;
353
354     PWAVEFORMATEX                      pwfx;
355
356     IDirectSoundCaptureBufferImpl*     capture_buffer;
357     DWORD                              state;
358     LPWAVEHDR                          pwave;
359     int                                nrofpwaves;
360     int                                index;
361     CRITICAL_SECTION                   lock;
362 };
363
364 HRESULT DirectSoundCaptureDevice_Create(
365     DirectSoundCaptureDevice ** ppDevice);
366 HRESULT DirectSoundCaptureDevice_Initialize(
367     DirectSoundCaptureDevice ** ppDevice,
368     LPCGUID lpcGUID);
369 ULONG DirectSoundCaptureDevice_AddRef(
370     DirectSoundCaptureDevice * device);
371 ULONG DirectSoundCaptureDevice_Release(
372     DirectSoundCaptureDevice * device);
373
374 /*****************************************************************************
375  * IDirectSoundCaptureBuffer implementation structure
376  */
377 struct IDirectSoundCaptureBufferImpl
378 {
379     /* IUnknown fields */
380     const IDirectSoundCaptureBuffer8Vtbl *lpVtbl;
381     LONG                                ref;
382
383     /* IDirectSoundCaptureBufferImpl fields */
384     DirectSoundCaptureDevice*           device;
385     /* FIXME: don't need this */
386     LPDSCBUFFERDESC                     pdscbd;
387     DWORD                               flags;
388
389     /* IDirectSoundCaptureNotifyImpl fields */
390     IDirectSoundCaptureNotifyImpl*      notify;
391     LPDSBPOSITIONNOTIFY                 notifies;
392     int                                 nrofnotifies;
393     PIDSDRIVERNOTIFY                    hwnotify;
394 };
395
396 HRESULT IDirectSoundCaptureBufferImpl_Create(
397     DirectSoundCaptureDevice *device,
398     IDirectSoundCaptureBufferImpl ** ppobj,
399     LPCDSCBUFFERDESC lpcDSCBufferDesc);
400
401 /*****************************************************************************
402  * IDirectSoundFullDuplex implementation structure
403  */
404 struct IDirectSoundFullDuplexImpl
405 {
406     /* IUnknown fields */
407     const IDirectSoundFullDuplexVtbl *lpVtbl;
408     LONG                              ref;
409
410     /* IDirectSoundFullDuplexImpl fields */
411     DirectSoundDevice                *renderer_device;
412     DirectSoundCaptureDevice         *capture_device;
413
414     LPUNKNOWN                         pUnknown;
415     LPDIRECTSOUND                     pDS;
416     LPDIRECTSOUND8                    pDS8;
417     LPDIRECTSOUNDCAPTURE              pDSC;
418 };
419
420 /*****************************************************************************
421  * IDirectSoundFullDuplex COM components
422  */
423 struct IDirectSoundFullDuplex_IUnknown {
424     const IUnknownVtbl         *lpVtbl;
425     LONG                        ref;
426     IDirectSoundFullDuplexImpl *pdsfd;
427 };
428
429 HRESULT IDirectSoundFullDuplex_IUnknown_Create(
430     LPDIRECTSOUNDFULLDUPLEX pdsfd,
431     LPUNKNOWN * ppunk);
432
433 struct IDirectSoundFullDuplex_IDirectSound {
434     const IDirectSoundVtbl     *lpVtbl;
435     LONG                        ref;
436     IDirectSoundFullDuplexImpl *pdsfd;
437 };
438
439 HRESULT IDirectSoundFullDuplex_IDirectSound_Create(
440     LPDIRECTSOUNDFULLDUPLEX pdsfd,
441     LPDIRECTSOUND * ppds);
442
443 struct IDirectSoundFullDuplex_IDirectSound8 {
444     const IDirectSound8Vtbl    *lpVtbl;
445     LONG                        ref;
446     IDirectSoundFullDuplexImpl *pdsfd;
447 };
448
449 HRESULT IDirectSoundFullDuplex_IDirectSound8_Create(
450     LPDIRECTSOUNDFULLDUPLEX pdsfd,
451     LPDIRECTSOUND8 * ppds8);
452
453 struct IDirectSoundFullDuplex_IDirectSoundCapture {
454     const IDirectSoundCaptureVtbl *lpVtbl;
455     LONG                           ref;
456     IDirectSoundFullDuplexImpl    *pdsfd;
457 };
458
459 HRESULT IDirectSoundFullDuplex_IDirectSoundCapture_Create(
460     LPDIRECTSOUNDFULLDUPLEX pdsfd,
461     LPDIRECTSOUNDCAPTURE8 * ppdsc8);
462
463 /*****************************************************************************
464  * IDirectSoundNotify implementation structure
465  */
466 struct IDirectSoundNotifyImpl
467 {
468     /* IUnknown fields */
469     const IDirectSoundNotifyVtbl *lpVtbl;
470     LONG                        ref;
471     IDirectSoundBufferImpl*     dsb;
472 };
473
474 HRESULT IDirectSoundNotifyImpl_Create(
475     IDirectSoundBufferImpl *dsb,
476     IDirectSoundNotifyImpl **pdsn);
477 HRESULT IDirectSoundNotifyImpl_Destroy(
478     IDirectSoundNotifyImpl *pdsn);
479
480 /*****************************************************************************
481  * IDirectSoundCaptureNotify implementation structure
482  */
483 struct IDirectSoundCaptureNotifyImpl
484 {
485     /* IUnknown fields */
486     const IDirectSoundNotifyVtbl       *lpVtbl;
487     LONG                                ref;
488     IDirectSoundCaptureBufferImpl*      dscb;
489 };
490
491 HRESULT IDirectSoundCaptureNotifyImpl_Create(
492     IDirectSoundCaptureBufferImpl *dscb,
493     IDirectSoundCaptureNotifyImpl ** pdscn);
494
495 /*****************************************************************************
496  *  IDirectSound3DListener implementation structure
497  */
498 struct IDirectSound3DListenerImpl
499 {
500     /* IUnknown fields */
501     const IDirectSound3DListenerVtbl *lpVtbl;
502     LONG                        ref;
503     /* IDirectSound3DListenerImpl fields */
504     DirectSoundDevice*          device;
505 };
506
507 HRESULT IDirectSound3DListenerImpl_Create(
508     DirectSoundDevice           *device,
509     IDirectSound3DListenerImpl **pdsl);
510
511 /*****************************************************************************
512  *  IKsBufferPropertySet implementation structure
513  */
514 struct IKsBufferPropertySetImpl
515 {
516     /* IUnknown fields */
517     const IKsPropertySetVtbl   *lpVtbl;
518     LONG                        ref;
519     /* IKsPropertySetImpl fields */
520     IDirectSoundBufferImpl*     dsb;
521 };
522
523 HRESULT IKsBufferPropertySetImpl_Create(
524     IDirectSoundBufferImpl *dsb,
525     IKsBufferPropertySetImpl **piks);
526 HRESULT IKsBufferPropertySetImpl_Destroy(
527     IKsBufferPropertySetImpl *piks);
528
529 /*****************************************************************************
530  *  IKsPrivatePropertySet implementation structure
531  */
532 struct IKsPrivatePropertySetImpl
533 {
534     /* IUnknown fields */
535     const IKsPropertySetVtbl   *lpVtbl;
536     LONG                        ref;
537 };
538
539 HRESULT IKsPrivatePropertySetImpl_Create(
540     IKsPrivatePropertySetImpl **piks);
541
542 /*****************************************************************************
543  * IDirectSound3DBuffer implementation structure
544  */
545 struct IDirectSound3DBufferImpl
546 {
547     /* IUnknown fields */
548     const IDirectSound3DBufferVtbl *lpVtbl;
549     LONG                        ref;
550     /* IDirectSound3DBufferImpl fields */
551     IDirectSoundBufferImpl*     dsb;
552 };
553
554 HRESULT IDirectSound3DBufferImpl_Create(
555     IDirectSoundBufferImpl *dsb,
556     IDirectSound3DBufferImpl **pds3db);
557 HRESULT IDirectSound3DBufferImpl_Destroy(
558     IDirectSound3DBufferImpl *pds3db);
559
560 /*******************************************************************************
561  * DirectSound ClassFactory implementation structure
562  */
563 struct IClassFactoryImpl
564 {
565     /* IUnknown fields */
566     const IClassFactoryVtbl    *lpVtbl;
567     LONG                        ref;
568 };
569
570 extern IClassFactoryImpl DSOUND_CAPTURE_CF;
571 extern IClassFactoryImpl DSOUND_FULLDUPLEX_CF;
572
573 /*******************************************************************************
574  */
575
576 /* dsound.c */
577
578 HRESULT DSOUND_Create(LPDIRECTSOUND *ppDS, IUnknown *pUnkOuter);
579 HRESULT DSOUND_Create8(LPDIRECTSOUND8 *ppDS, IUnknown *pUnkOuter);
580
581 /* primary.c */
582
583 HRESULT DSOUND_PrimaryCreate(DirectSoundDevice *device);
584 HRESULT DSOUND_PrimaryDestroy(DirectSoundDevice *device);
585 HRESULT DSOUND_PrimaryPlay(DirectSoundDevice *device);
586 HRESULT DSOUND_PrimaryStop(DirectSoundDevice *device);
587 HRESULT DSOUND_PrimaryGetPosition(DirectSoundDevice *device, LPDWORD playpos, LPDWORD writepos);
588 HRESULT DSOUND_PrimarySetFormat(DirectSoundDevice *device, LPCWAVEFORMATEX wfex);
589
590 /* buffer.c */
591
592 DWORD DSOUND_CalcPlayPosition(IDirectSoundBufferImpl *This, DWORD pplay, DWORD pwrite);
593
594 /* mixer.c */
595
596 void DSOUND_CheckEvent(IDirectSoundBufferImpl *dsb, int len);
597 void DSOUND_ForceRemix(IDirectSoundBufferImpl *dsb);
598 void DSOUND_MixCancelAt(IDirectSoundBufferImpl *dsb, DWORD buf_writepos);
599 void DSOUND_WaveQueue(DirectSoundDevice *device, DWORD mixq);
600 void DSOUND_PerformMix(DirectSoundDevice *device);
601 void DSOUND_RecalcVolPan(PDSVOLUMEPAN volpan);
602 void DSOUND_AmpFactorToVolPan(PDSVOLUMEPAN volpan);
603 void DSOUND_RecalcFormat(IDirectSoundBufferImpl *dsb);
604 void CALLBACK DSOUND_timer(UINT timerID, UINT msg, DWORD dwUser, DWORD dw1, DWORD dw2);
605 void CALLBACK DSOUND_callback(HWAVEOUT hwo, UINT msg, DWORD dwUser, DWORD dw1, DWORD dw2);
606
607 /* sound3d.c */
608
609 void DSOUND_Calc3DBuffer(IDirectSoundBufferImpl *dsb);
610
611 /* duplex.c */
612
613 HRESULT DSOUND_FullDuplexCreate(LPDIRECTSOUNDFULLDUPLEX* ppDSFD, IUnknown *pUnkOuter);
614
615 /* capture.c */
616
617 HRESULT WINAPI IDirectSoundCaptureImpl_CreateCaptureBuffer(
618     LPDIRECTSOUNDCAPTURE iface,
619     LPCDSCBUFFERDESC lpcDSCBufferDesc,
620     LPDIRECTSOUNDCAPTUREBUFFER* lplpDSCaptureBuffer,
621     LPUNKNOWN pUnk);
622 HRESULT WINAPI IDirectSoundCaptureImpl_GetCaps(
623     LPDIRECTSOUNDCAPTURE iface,
624     LPDSCCAPS lpDSCCaps);
625 HRESULT WINAPI IDirectSoundCaptureImpl_Initialize(
626     LPDIRECTSOUNDCAPTURE iface,
627     LPCGUID lpcGUID);
628
629 #define STATE_STOPPED   0
630 #define STATE_STARTING  1
631 #define STATE_PLAYING   2
632 #define STATE_CAPTURING 2
633 #define STATE_STOPPING  3
634
635 #define DSOUND_FREQSHIFT (14)
636
637 extern DirectSoundDevice* DSOUND_renderer[MAXWAVEDRIVERS];
638 extern GUID DSOUND_renderer_guids[MAXWAVEDRIVERS];
639
640 extern DirectSoundCaptureDevice * DSOUND_capture[MAXWAVEDRIVERS];
641 extern GUID DSOUND_capture_guids[MAXWAVEDRIVERS];
642
643 HRESULT mmErr(UINT err);
644 void setup_dsound_options(void);
645 const char * get_device_id(LPCGUID pGuid);
646 const char * dumpCooperativeLevel(DWORD level);