2002-06-13 21:15:06 +02:00
|
|
|
/* DirectSound
|
|
|
|
*
|
|
|
|
* Copyright 1998 Marcus Meissner
|
|
|
|
* Copyright 1998 Rob Riggs
|
|
|
|
* Copyright 2000-2001 TransGaming Technologies, Inc.
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Linux does not support better timing than 10ms */
|
|
|
|
#define DS_TIME_RES 10 /* Resolution of multimedia timer */
|
|
|
|
#define DS_TIME_DEL 10 /* Delay of multimedia timer callback, and duration of HEL fragment */
|
|
|
|
|
|
|
|
#define DS_HEL_FRAGS 48 /* HEL only: number of waveOut fragments in primary buffer
|
|
|
|
* (changing this won't help you) */
|
|
|
|
|
2003-03-06 23:46:34 +01:00
|
|
|
/* direct sound hardware acceleration levels */
|
|
|
|
#define DS_HW_ACCEL_FULL 0 /* default on Windows 98 */
|
|
|
|
#define DS_HW_ACCEL_STANDARD 1 /* default on Windows 2000 */
|
|
|
|
#define DS_HW_ACCEL_BASIC 2
|
|
|
|
#define DS_HW_ACCEL_EMULATION 3
|
|
|
|
|
2002-06-13 21:15:06 +02:00
|
|
|
extern int ds_emuldriver;
|
|
|
|
extern int ds_hel_margin;
|
|
|
|
extern int ds_hel_queue;
|
|
|
|
extern int ds_snd_queue_max;
|
|
|
|
extern int ds_snd_queue_min;
|
2003-03-06 23:46:34 +01:00
|
|
|
extern int ds_hw_accel;
|
2003-03-15 01:54:11 +01:00
|
|
|
extern int ds_default_playback;
|
|
|
|
extern int ds_default_capture;
|
2002-06-13 21:15:06 +02:00
|
|
|
|
|
|
|
/*****************************************************************************
|
|
|
|
* Predeclare the interface implementation structures
|
|
|
|
*/
|
2004-07-04 02:13:44 +02:00
|
|
|
typedef struct IDirectSoundImpl IDirectSoundImpl;
|
|
|
|
typedef struct IDirectSound_IUnknown IDirectSound_IUnknown;
|
|
|
|
typedef struct IDirectSound_IDirectSound IDirectSound_IDirectSound;
|
|
|
|
typedef struct IDirectSound8_IUnknown IDirectSound8_IUnknown;
|
|
|
|
typedef struct IDirectSound8_IDirectSound IDirectSound8_IDirectSound;
|
|
|
|
typedef struct IDirectSound8_IDirectSound8 IDirectSound8_IDirectSound8;
|
|
|
|
typedef struct IDirectSoundBufferImpl IDirectSoundBufferImpl;
|
|
|
|
typedef struct IDirectSoundCaptureImpl IDirectSoundCaptureImpl;
|
2003-02-15 01:01:17 +01:00
|
|
|
typedef struct IDirectSoundCaptureBufferImpl IDirectSoundCaptureBufferImpl;
|
2004-07-04 02:13:44 +02:00
|
|
|
typedef struct IDirectSoundFullDuplexImpl IDirectSoundFullDuplexImpl;
|
2006-01-17 16:13:58 +01:00
|
|
|
typedef struct IDirectSoundFullDuplex_IUnknown IDirectSoundFullDuplex_IUnknown;
|
|
|
|
typedef struct IDirectSoundFullDuplex_IDirectSound IDirectSoundFullDuplex_IDirectSound;
|
|
|
|
typedef struct IDirectSoundFullDuplex_IDirectSound8 IDirectSoundFullDuplex_IDirectSound8;
|
|
|
|
typedef struct IDirectSoundFullDuplex_IDirectSoundCapture IDirectSoundFullDuplex_IDirectSoundCapture;
|
2004-07-04 02:13:44 +02:00
|
|
|
typedef struct IDirectSoundNotifyImpl IDirectSoundNotifyImpl;
|
2003-09-02 01:58:43 +02:00
|
|
|
typedef struct IDirectSoundCaptureNotifyImpl IDirectSoundCaptureNotifyImpl;
|
2004-07-04 02:13:44 +02:00
|
|
|
typedef struct IDirectSound3DListenerImpl IDirectSound3DListenerImpl;
|
|
|
|
typedef struct IDirectSound3DBufferImpl IDirectSound3DBufferImpl;
|
|
|
|
typedef struct IKsBufferPropertySetImpl IKsBufferPropertySetImpl;
|
|
|
|
typedef struct IKsPrivatePropertySetImpl IKsPrivatePropertySetImpl;
|
|
|
|
typedef struct PrimaryBufferImpl PrimaryBufferImpl;
|
|
|
|
typedef struct SecondaryBufferImpl SecondaryBufferImpl;
|
|
|
|
typedef struct IClassFactoryImpl IClassFactoryImpl;
|
2005-05-31 11:31:37 +02:00
|
|
|
typedef struct DirectSoundDevice DirectSoundDevice;
|
2005-06-04 11:38:14 +02:00
|
|
|
typedef struct DirectSoundCaptureDevice DirectSoundCaptureDevice;
|
2002-06-13 21:15:06 +02:00
|
|
|
|
|
|
|
/*****************************************************************************
|
|
|
|
* IDirectSound implementation structure
|
|
|
|
*/
|
|
|
|
struct IDirectSoundImpl
|
|
|
|
{
|
2005-07-12 21:21:36 +02:00
|
|
|
LONG ref;
|
2005-05-31 11:31:37 +02:00
|
|
|
|
|
|
|
DirectSoundDevice *device;
|
|
|
|
LPUNKNOWN pUnknown;
|
|
|
|
LPDIRECTSOUND pDS;
|
|
|
|
LPDIRECTSOUND8 pDS8;
|
|
|
|
};
|
|
|
|
|
2006-01-14 17:06:52 +01:00
|
|
|
HRESULT IDirectSoundImpl_Create(
|
|
|
|
LPDIRECTSOUND8 * ppds);
|
|
|
|
|
|
|
|
/*****************************************************************************
|
|
|
|
* IDirectSoundDevice implementation structure
|
|
|
|
*/
|
2005-05-31 11:31:37 +02:00
|
|
|
struct DirectSoundDevice
|
|
|
|
{
|
2005-07-12 21:21:36 +02:00
|
|
|
LONG ref;
|
2005-05-31 11:31:37 +02:00
|
|
|
|
2003-03-15 01:54:11 +01:00
|
|
|
GUID guid;
|
2002-06-13 21:15:06 +02:00
|
|
|
PIDSDRIVER driver;
|
|
|
|
DSDRIVERDESC drvdesc;
|
|
|
|
DSDRIVERCAPS drvcaps;
|
|
|
|
DWORD priolevel;
|
2004-08-18 02:30:37 +02:00
|
|
|
PWAVEFORMATEX pwfx;
|
2002-06-13 21:15:06 +02:00
|
|
|
HWAVEOUT hwo;
|
|
|
|
LPWAVEHDR pwave[DS_HEL_FRAGS];
|
|
|
|
UINT timerID, pwplay, pwwrite, pwqueue, prebuf, precount;
|
|
|
|
DWORD fraglen;
|
|
|
|
PIDSDRIVERBUFFER hwbuf;
|
|
|
|
LPBYTE buffer;
|
|
|
|
DWORD writelead, buflen, state, playpos, mixpos;
|
|
|
|
BOOL need_remix;
|
|
|
|
int nrofbuffers;
|
|
|
|
IDirectSoundBufferImpl** buffers;
|
2004-09-07 21:32:21 +02:00
|
|
|
RTL_RWLOCK buffer_list_lock;
|
2003-02-15 01:01:17 +01:00
|
|
|
CRITICAL_SECTION mixlock;
|
2003-06-28 00:22:15 +02:00
|
|
|
PrimaryBufferImpl* primary;
|
|
|
|
DSBUFFERDESC dsbd;
|
2003-09-02 01:58:43 +02:00
|
|
|
DWORD speaker_config;
|
2005-01-24 12:27:05 +01:00
|
|
|
LPBYTE tmp_buffer;
|
|
|
|
DWORD tmp_buffer_len;
|
2003-06-28 00:22:15 +02:00
|
|
|
|
|
|
|
/* DirectSound3DListener fields */
|
|
|
|
IDirectSound3DListenerImpl* listener;
|
|
|
|
DS3DLISTENER ds3dl;
|
|
|
|
BOOL ds3dl_need_recalc;
|
2002-06-13 21:15:06 +02:00
|
|
|
};
|
|
|
|
|
2003-06-28 00:22:15 +02:00
|
|
|
/* reference counted buffer memory for duplicated buffer memory */
|
|
|
|
typedef struct BufferMemory
|
|
|
|
{
|
2005-07-12 21:21:36 +02:00
|
|
|
LONG ref;
|
2003-06-28 00:22:15 +02:00
|
|
|
LPBYTE memory;
|
|
|
|
} BufferMemory;
|
|
|
|
|
2006-01-14 17:06:52 +01:00
|
|
|
HRESULT DirectSoundDevice_Create(DirectSoundDevice ** ppDevice);
|
|
|
|
ULONG DirectSoundDevice_AddRef(DirectSoundDevice * device);
|
|
|
|
ULONG DirectSoundDevice_Release(DirectSoundDevice * device);
|
2006-01-17 16:10:15 +01:00
|
|
|
HRESULT DirectSoundDevice_Initialize(
|
|
|
|
DirectSoundDevice ** ppDevice,
|
|
|
|
LPCGUID lpcGUID);
|
2006-01-14 17:06:52 +01:00
|
|
|
HRESULT DirectSoundDevice_AddBuffer(
|
2006-01-17 16:10:15 +01:00
|
|
|
DirectSoundDevice * device,
|
2006-01-14 17:06:52 +01:00
|
|
|
IDirectSoundBufferImpl * pDSB);
|
|
|
|
HRESULT DirectSoundDevice_RemoveBuffer(
|
2006-01-17 16:10:15 +01:00
|
|
|
DirectSoundDevice * device,
|
2006-01-14 17:06:52 +01:00
|
|
|
IDirectSoundBufferImpl * pDSB);
|
2006-01-17 16:10:15 +01:00
|
|
|
HRESULT DirectSoundDevice_GetCaps(DirectSoundDevice * device, LPDSCAPS lpDSCaps);
|
|
|
|
HRESULT DirectSoundDevice_CreateSoundBuffer(
|
|
|
|
DirectSoundDevice * device,
|
|
|
|
LPCDSBUFFERDESC dsbd,
|
|
|
|
LPLPDIRECTSOUNDBUFFER ppdsb,
|
|
|
|
LPUNKNOWN lpunk,
|
|
|
|
BOOL from8);
|
|
|
|
HRESULT DirectSoundDevice_DuplicateSoundBuffer(
|
|
|
|
DirectSoundDevice * device,
|
|
|
|
LPDIRECTSOUNDBUFFER psb,
|
|
|
|
LPLPDIRECTSOUNDBUFFER ppdsb);
|
|
|
|
HRESULT DirectSoundDevice_SetCooperativeLevel(
|
|
|
|
DirectSoundDevice * devcie,
|
|
|
|
HWND hwnd,
|
|
|
|
DWORD level);
|
|
|
|
HRESULT DirectSoundDevice_Compact(DirectSoundDevice * device);
|
|
|
|
HRESULT DirectSoundDevice_GetSpeakerConfig(
|
|
|
|
DirectSoundDevice * device,
|
|
|
|
LPDWORD lpdwSpeakerConfig);
|
|
|
|
HRESULT DirectSoundDevice_SetSpeakerConfig(
|
|
|
|
DirectSoundDevice * device,
|
|
|
|
DWORD config);
|
|
|
|
HRESULT DirectSoundDevice_VerifyCertification(
|
|
|
|
DirectSoundDevice * device,
|
|
|
|
LPDWORD pdwCertified);
|
2004-07-19 22:06:22 +02:00
|
|
|
|
2004-07-04 02:13:44 +02:00
|
|
|
/*****************************************************************************
|
|
|
|
* IDirectSound COM components
|
|
|
|
*/
|
|
|
|
struct IDirectSound_IUnknown {
|
2005-06-01 21:57:42 +02:00
|
|
|
const IUnknownVtbl *lpVtbl;
|
2005-07-12 21:21:36 +02:00
|
|
|
LONG ref;
|
2004-07-04 02:13:44 +02:00
|
|
|
LPDIRECTSOUND8 pds;
|
|
|
|
};
|
|
|
|
|
2006-01-03 17:32:50 +01:00
|
|
|
HRESULT IDirectSound_IUnknown_Create(
|
2004-07-04 02:13:44 +02:00
|
|
|
LPDIRECTSOUND8 pds,
|
|
|
|
LPUNKNOWN * ppunk);
|
|
|
|
|
|
|
|
struct IDirectSound_IDirectSound {
|
2005-06-01 21:57:42 +02:00
|
|
|
const IDirectSoundVtbl *lpVtbl;
|
2005-07-12 21:21:36 +02:00
|
|
|
LONG ref;
|
2004-07-04 02:13:44 +02:00
|
|
|
LPDIRECTSOUND8 pds;
|
|
|
|
};
|
|
|
|
|
2006-01-03 17:32:50 +01:00
|
|
|
HRESULT IDirectSound_IDirectSound_Create(
|
2004-07-04 02:13:44 +02:00
|
|
|
LPDIRECTSOUND8 pds,
|
|
|
|
LPDIRECTSOUND * ppds);
|
|
|
|
|
|
|
|
/*****************************************************************************
|
|
|
|
* IDirectSound8 COM components
|
|
|
|
*/
|
|
|
|
struct IDirectSound8_IUnknown {
|
2005-06-01 21:57:42 +02:00
|
|
|
const IUnknownVtbl *lpVtbl;
|
2005-07-12 21:21:36 +02:00
|
|
|
LONG ref;
|
2004-07-04 02:13:44 +02:00
|
|
|
LPDIRECTSOUND8 pds;
|
|
|
|
};
|
|
|
|
|
2006-01-03 17:32:50 +01:00
|
|
|
HRESULT IDirectSound8_IUnknown_Create(
|
2004-07-04 02:13:44 +02:00
|
|
|
LPDIRECTSOUND8 pds,
|
|
|
|
LPUNKNOWN * ppunk);
|
|
|
|
|
|
|
|
struct IDirectSound8_IDirectSound {
|
2005-06-01 21:57:42 +02:00
|
|
|
const IDirectSoundVtbl *lpVtbl;
|
2005-07-12 21:21:36 +02:00
|
|
|
LONG ref;
|
2004-07-04 02:13:44 +02:00
|
|
|
LPDIRECTSOUND8 pds;
|
|
|
|
};
|
|
|
|
|
2006-01-03 17:32:50 +01:00
|
|
|
HRESULT IDirectSound8_IDirectSound_Create(
|
2004-07-04 02:13:44 +02:00
|
|
|
LPDIRECTSOUND8 pds,
|
|
|
|
LPDIRECTSOUND * ppds);
|
|
|
|
|
|
|
|
struct IDirectSound8_IDirectSound8 {
|
2005-06-01 21:57:42 +02:00
|
|
|
const IDirectSound8Vtbl *lpVtbl;
|
2005-07-12 21:21:36 +02:00
|
|
|
LONG ref;
|
2004-07-04 02:13:44 +02:00
|
|
|
LPDIRECTSOUND8 pds;
|
|
|
|
};
|
|
|
|
|
2006-01-03 17:32:50 +01:00
|
|
|
HRESULT IDirectSound8_IDirectSound8_Create(
|
2004-07-04 02:13:44 +02:00
|
|
|
LPDIRECTSOUND8 pds,
|
|
|
|
LPDIRECTSOUND8 * ppds);
|
|
|
|
|
2002-06-13 21:15:06 +02:00
|
|
|
/*****************************************************************************
|
|
|
|
* IDirectSoundBuffer implementation structure
|
|
|
|
*/
|
|
|
|
struct IDirectSoundBufferImpl
|
|
|
|
{
|
|
|
|
/* FIXME: document */
|
|
|
|
/* IUnknown fields */
|
2005-06-01 21:57:42 +02:00
|
|
|
const IDirectSoundBuffer8Vtbl *lpVtbl;
|
2005-07-12 21:21:36 +02:00
|
|
|
LONG ref;
|
2002-06-13 21:15:06 +02:00
|
|
|
/* IDirectSoundBufferImpl fields */
|
2005-10-19 21:21:38 +02:00
|
|
|
SecondaryBufferImpl* secondary;
|
2006-01-06 12:35:20 +01:00
|
|
|
DirectSoundDevice* device;
|
2003-06-28 00:22:15 +02:00
|
|
|
CRITICAL_SECTION lock;
|
|
|
|
PIDSDRIVERBUFFER hwbuf;
|
2004-08-18 02:30:37 +02:00
|
|
|
PWAVEFORMATEX pwfx;
|
2003-06-28 00:22:15 +02:00
|
|
|
BufferMemory* buffer;
|
|
|
|
DWORD playflags,state,leadin;
|
|
|
|
DWORD playpos,startpos,writelead,buflen;
|
|
|
|
DWORD nAvgBytesPerSec;
|
|
|
|
DWORD freq;
|
|
|
|
DSVOLUMEPAN volpan, cvolpan;
|
|
|
|
DSBUFFERDESC dsbd;
|
2002-06-13 21:15:06 +02:00
|
|
|
/* used for frequency conversion (PerfectPitch) */
|
2003-06-28 00:22:15 +02:00
|
|
|
ULONG freqAdjust, freqAcc;
|
2002-06-13 21:15:06 +02:00
|
|
|
/* used for intelligent (well, sort of) prebuffering */
|
2003-06-28 00:22:15 +02:00
|
|
|
DWORD probably_valid_to, last_playpos;
|
|
|
|
DWORD primary_mixpos, buf_mixpos;
|
|
|
|
BOOL need_remix;
|
2003-09-02 01:58:43 +02:00
|
|
|
|
2002-06-13 21:15:06 +02:00
|
|
|
/* IDirectSoundNotifyImpl fields */
|
2003-06-28 00:22:15 +02:00
|
|
|
IDirectSoundNotifyImpl* notify;
|
2003-09-02 01:58:43 +02:00
|
|
|
LPDSBPOSITIONNOTIFY notifies;
|
|
|
|
int nrofnotifies;
|
|
|
|
PIDSDRIVERNOTIFY hwnotify;
|
2003-06-28 00:22:15 +02:00
|
|
|
|
|
|
|
/* DirectSound3DBuffer fields */
|
2003-09-02 01:58:43 +02:00
|
|
|
IDirectSound3DBufferImpl* ds3db;
|
2003-06-28 00:22:15 +02:00
|
|
|
DS3DBUFFER ds3db_ds3db;
|
|
|
|
LONG ds3db_lVolume;
|
|
|
|
BOOL ds3db_need_recalc;
|
2003-09-02 01:58:43 +02:00
|
|
|
|
|
|
|
/* IKsPropertySet fields */
|
|
|
|
IKsBufferPropertySetImpl* iks;
|
2002-06-13 21:15:06 +02:00
|
|
|
};
|
|
|
|
|
2006-01-03 17:32:50 +01:00
|
|
|
HRESULT IDirectSoundBufferImpl_Create(
|
2006-01-06 12:35:20 +01:00
|
|
|
DirectSoundDevice *device,
|
|
|
|
IDirectSoundBufferImpl **ppdsb,
|
2004-01-09 23:06:54 +01:00
|
|
|
LPCDSBUFFERDESC dsbd);
|
2006-01-03 17:32:50 +01:00
|
|
|
HRESULT IDirectSoundBufferImpl_Destroy(
|
2004-07-14 01:35:09 +02:00
|
|
|
IDirectSoundBufferImpl *pdsb);
|
2006-01-14 17:06:52 +01:00
|
|
|
HRESULT IDirectSoundBufferImpl_Duplicate(
|
|
|
|
DirectSoundDevice *device,
|
|
|
|
IDirectSoundBufferImpl **ppdsb,
|
|
|
|
IDirectSoundBufferImpl *pdsb);
|
2002-06-13 21:15:06 +02:00
|
|
|
|
2003-09-02 01:58:43 +02:00
|
|
|
/*****************************************************************************
|
|
|
|
* SecondaryBuffer implementation structure
|
|
|
|
*/
|
|
|
|
struct SecondaryBufferImpl
|
|
|
|
{
|
2005-06-01 21:57:42 +02:00
|
|
|
const IDirectSoundBuffer8Vtbl *lpVtbl;
|
2005-07-12 21:21:36 +02:00
|
|
|
LONG ref;
|
2003-09-02 01:58:43 +02:00
|
|
|
IDirectSoundBufferImpl* dsb;
|
|
|
|
};
|
|
|
|
|
2006-01-03 17:32:50 +01:00
|
|
|
HRESULT SecondaryBufferImpl_Create(
|
2003-09-02 01:58:43 +02:00
|
|
|
IDirectSoundBufferImpl *dsb,
|
|
|
|
SecondaryBufferImpl **pdsb);
|
2006-01-03 17:32:50 +01:00
|
|
|
HRESULT SecondaryBufferImpl_Destroy(
|
2004-07-14 01:35:09 +02:00
|
|
|
SecondaryBufferImpl *pdsb);
|
2003-09-02 01:58:43 +02:00
|
|
|
|
|
|
|
/*****************************************************************************
|
|
|
|
* PrimaryBuffer implementation structure
|
|
|
|
*/
|
|
|
|
struct PrimaryBufferImpl
|
|
|
|
{
|
2005-06-01 21:57:42 +02:00
|
|
|
const IDirectSoundBuffer8Vtbl *lpVtbl;
|
2005-07-12 21:21:36 +02:00
|
|
|
LONG ref;
|
2006-01-06 12:35:20 +01:00
|
|
|
DirectSoundDevice* device;
|
2002-06-13 21:15:06 +02:00
|
|
|
};
|
|
|
|
|
2006-01-03 17:32:50 +01:00
|
|
|
HRESULT PrimaryBufferImpl_Create(
|
2006-01-06 12:35:20 +01:00
|
|
|
DirectSoundDevice * device,
|
|
|
|
PrimaryBufferImpl **ppdsb,
|
2004-01-09 23:06:54 +01:00
|
|
|
LPCDSBUFFERDESC dsbd);
|
2002-06-13 21:15:06 +02:00
|
|
|
|
2003-02-15 01:01:17 +01:00
|
|
|
/*****************************************************************************
|
|
|
|
* IDirectSoundCapture implementation structure
|
|
|
|
*/
|
|
|
|
struct IDirectSoundCaptureImpl
|
|
|
|
{
|
|
|
|
/* IUnknown fields */
|
2005-06-01 21:57:42 +02:00
|
|
|
const IDirectSoundCaptureVtbl *lpVtbl;
|
2005-07-12 21:21:36 +02:00
|
|
|
LONG ref;
|
2003-02-15 01:01:17 +01:00
|
|
|
|
2005-06-04 11:38:14 +02:00
|
|
|
DirectSoundCaptureDevice *device;
|
|
|
|
};
|
|
|
|
|
2006-01-04 14:49:34 +01:00
|
|
|
HRESULT IDirectSoundCaptureImpl_Create(
|
|
|
|
LPDIRECTSOUNDCAPTURE8 * ppds);
|
|
|
|
|
|
|
|
/*****************************************************************************
|
|
|
|
* DirectSoundCaptureDevice implementation structure
|
|
|
|
*/
|
2005-06-04 11:38:14 +02:00
|
|
|
struct DirectSoundCaptureDevice
|
|
|
|
{
|
2003-02-15 01:01:17 +01:00
|
|
|
/* IDirectSoundCaptureImpl fields */
|
2003-03-04 03:12:34 +01:00
|
|
|
GUID guid;
|
2005-07-12 21:21:36 +02:00
|
|
|
LONG ref;
|
2003-02-15 01:01:17 +01:00
|
|
|
|
2003-03-04 03:12:34 +01:00
|
|
|
/* DirectSound driver stuff */
|
|
|
|
PIDSCDRIVER driver;
|
|
|
|
DSDRIVERDESC drvdesc;
|
|
|
|
DSCDRIVERCAPS drvcaps;
|
|
|
|
PIDSCDRIVERBUFFER hwbuf;
|
2003-02-15 01:01:17 +01:00
|
|
|
|
2003-03-04 03:12:34 +01:00
|
|
|
/* wave driver info */
|
|
|
|
HWAVEIN hwi;
|
2003-02-15 01:01:17 +01:00
|
|
|
|
2003-03-04 03:12:34 +01:00
|
|
|
/* more stuff */
|
2003-02-15 01:01:17 +01:00
|
|
|
LPBYTE buffer;
|
|
|
|
DWORD buflen;
|
2003-03-04 03:12:34 +01:00
|
|
|
DWORD read_position;
|
2003-02-15 01:01:17 +01:00
|
|
|
|
2003-10-09 00:35:26 +02:00
|
|
|
PWAVEFORMATEX pwfx;
|
2003-02-15 01:01:17 +01:00
|
|
|
|
2003-03-04 03:12:34 +01:00
|
|
|
IDirectSoundCaptureBufferImpl* capture_buffer;
|
|
|
|
DWORD state;
|
2003-02-15 01:01:17 +01:00
|
|
|
LPWAVEHDR pwave;
|
2003-03-04 03:12:34 +01:00
|
|
|
int nrofpwaves;
|
|
|
|
int index;
|
2003-02-15 01:01:17 +01:00
|
|
|
CRITICAL_SECTION lock;
|
|
|
|
};
|
|
|
|
|
2006-01-04 14:49:34 +01:00
|
|
|
HRESULT DirectSoundCaptureDevice_Create(
|
|
|
|
DirectSoundCaptureDevice ** ppDevice);
|
2006-01-05 13:37:15 +01:00
|
|
|
HRESULT DirectSoundCaptureDevice_Initialize(
|
|
|
|
DirectSoundCaptureDevice ** ppDevice,
|
|
|
|
LPCGUID lpcGUID);
|
2006-01-04 14:49:34 +01:00
|
|
|
ULONG DirectSoundCaptureDevice_AddRef(
|
|
|
|
DirectSoundCaptureDevice * device);
|
|
|
|
ULONG DirectSoundCaptureDevice_Release(
|
|
|
|
DirectSoundCaptureDevice * device);
|
2005-06-04 11:38:14 +02:00
|
|
|
|
2003-02-15 01:01:17 +01:00
|
|
|
/*****************************************************************************
|
|
|
|
* IDirectSoundCaptureBuffer implementation structure
|
|
|
|
*/
|
|
|
|
struct IDirectSoundCaptureBufferImpl
|
|
|
|
{
|
2003-03-04 03:12:34 +01:00
|
|
|
/* IUnknown fields */
|
2005-06-01 21:57:42 +02:00
|
|
|
const IDirectSoundCaptureBuffer8Vtbl *lpVtbl;
|
2005-07-12 21:21:36 +02:00
|
|
|
LONG ref;
|
2003-03-04 03:12:34 +01:00
|
|
|
|
|
|
|
/* IDirectSoundCaptureBufferImpl fields */
|
2006-01-05 13:37:15 +01:00
|
|
|
DirectSoundCaptureDevice* device;
|
2003-03-04 03:12:34 +01:00
|
|
|
/* FIXME: don't need this */
|
2003-06-28 00:22:15 +02:00
|
|
|
LPDSCBUFFERDESC pdscbd;
|
|
|
|
DWORD flags;
|
2003-09-02 01:58:43 +02:00
|
|
|
|
|
|
|
/* IDirectSoundCaptureNotifyImpl fields */
|
|
|
|
IDirectSoundCaptureNotifyImpl* notify;
|
|
|
|
LPDSBPOSITIONNOTIFY notifies;
|
|
|
|
int nrofnotifies;
|
|
|
|
PIDSDRIVERNOTIFY hwnotify;
|
2003-03-04 03:12:34 +01:00
|
|
|
};
|
|
|
|
|
2006-01-05 13:37:15 +01:00
|
|
|
HRESULT IDirectSoundCaptureBufferImpl_Create(
|
|
|
|
DirectSoundCaptureDevice *device,
|
|
|
|
IDirectSoundCaptureBufferImpl ** ppobj,
|
|
|
|
LPCDSCBUFFERDESC lpcDSCBufferDesc);
|
2006-01-04 14:49:34 +01:00
|
|
|
|
2003-03-04 03:12:34 +01:00
|
|
|
/*****************************************************************************
|
|
|
|
* IDirectSoundFullDuplex implementation structure
|
|
|
|
*/
|
|
|
|
struct IDirectSoundFullDuplexImpl
|
|
|
|
{
|
|
|
|
/* IUnknown fields */
|
2005-06-01 21:57:42 +02:00
|
|
|
const IDirectSoundFullDuplexVtbl *lpVtbl;
|
2006-01-17 16:13:58 +01:00
|
|
|
LONG ref;
|
2003-03-04 03:12:34 +01:00
|
|
|
|
|
|
|
/* IDirectSoundFullDuplexImpl fields */
|
2006-01-17 16:13:58 +01:00
|
|
|
DirectSoundDevice *renderer_device;
|
|
|
|
DirectSoundCaptureDevice *capture_device;
|
|
|
|
|
|
|
|
LPUNKNOWN pUnknown;
|
|
|
|
LPDIRECTSOUND pDS;
|
|
|
|
LPDIRECTSOUND8 pDS8;
|
|
|
|
LPDIRECTSOUNDCAPTURE pDSC;
|
2003-02-15 01:01:17 +01:00
|
|
|
};
|
|
|
|
|
2006-01-17 16:13:58 +01:00
|
|
|
/*****************************************************************************
|
|
|
|
* IDirectSoundFullDuplex COM components
|
|
|
|
*/
|
|
|
|
struct IDirectSoundFullDuplex_IUnknown {
|
|
|
|
const IUnknownVtbl *lpVtbl;
|
|
|
|
LONG ref;
|
|
|
|
IDirectSoundFullDuplexImpl *pdsfd;
|
|
|
|
};
|
|
|
|
|
|
|
|
HRESULT IDirectSoundFullDuplex_IUnknown_Create(
|
|
|
|
LPDIRECTSOUNDFULLDUPLEX pdsfd,
|
|
|
|
LPUNKNOWN * ppunk);
|
|
|
|
|
|
|
|
struct IDirectSoundFullDuplex_IDirectSound {
|
|
|
|
const IDirectSoundVtbl *lpVtbl;
|
|
|
|
LONG ref;
|
|
|
|
IDirectSoundFullDuplexImpl *pdsfd;
|
|
|
|
};
|
|
|
|
|
|
|
|
HRESULT IDirectSoundFullDuplex_IDirectSound_Create(
|
|
|
|
LPDIRECTSOUNDFULLDUPLEX pdsfd,
|
|
|
|
LPDIRECTSOUND * ppds);
|
|
|
|
|
|
|
|
struct IDirectSoundFullDuplex_IDirectSound8 {
|
|
|
|
const IDirectSound8Vtbl *lpVtbl;
|
|
|
|
LONG ref;
|
|
|
|
IDirectSoundFullDuplexImpl *pdsfd;
|
|
|
|
};
|
|
|
|
|
|
|
|
HRESULT IDirectSoundFullDuplex_IDirectSound8_Create(
|
|
|
|
LPDIRECTSOUNDFULLDUPLEX pdsfd,
|
|
|
|
LPDIRECTSOUND8 * ppds8);
|
|
|
|
|
|
|
|
struct IDirectSoundFullDuplex_IDirectSoundCapture {
|
|
|
|
const IDirectSoundCaptureVtbl *lpVtbl;
|
|
|
|
LONG ref;
|
|
|
|
IDirectSoundFullDuplexImpl *pdsfd;
|
|
|
|
};
|
|
|
|
|
|
|
|
HRESULT IDirectSoundFullDuplex_IDirectSoundCapture_Create(
|
|
|
|
LPDIRECTSOUNDFULLDUPLEX pdsfd,
|
|
|
|
LPDIRECTSOUNDCAPTURE8 * ppdsc8);
|
|
|
|
|
2002-06-13 21:15:06 +02:00
|
|
|
/*****************************************************************************
|
|
|
|
* IDirectSoundNotify implementation structure
|
|
|
|
*/
|
|
|
|
struct IDirectSoundNotifyImpl
|
|
|
|
{
|
|
|
|
/* IUnknown fields */
|
2005-06-01 21:57:42 +02:00
|
|
|
const IDirectSoundNotifyVtbl *lpVtbl;
|
2005-07-12 21:21:36 +02:00
|
|
|
LONG ref;
|
2003-09-02 01:58:43 +02:00
|
|
|
IDirectSoundBufferImpl* dsb;
|
|
|
|
};
|
2003-05-02 22:16:48 +02:00
|
|
|
|
2006-01-03 17:32:50 +01:00
|
|
|
HRESULT IDirectSoundNotifyImpl_Create(
|
2003-09-02 01:58:43 +02:00
|
|
|
IDirectSoundBufferImpl *dsb,
|
|
|
|
IDirectSoundNotifyImpl **pdsn);
|
2006-01-03 17:32:50 +01:00
|
|
|
HRESULT IDirectSoundNotifyImpl_Destroy(
|
2004-07-14 01:35:09 +02:00
|
|
|
IDirectSoundNotifyImpl *pdsn);
|
2003-09-02 01:58:43 +02:00
|
|
|
|
|
|
|
/*****************************************************************************
|
|
|
|
* IDirectSoundCaptureNotify implementation structure
|
|
|
|
*/
|
|
|
|
struct IDirectSoundCaptureNotifyImpl
|
|
|
|
{
|
|
|
|
/* IUnknown fields */
|
2005-06-01 21:57:42 +02:00
|
|
|
const IDirectSoundNotifyVtbl *lpVtbl;
|
2005-07-12 21:21:36 +02:00
|
|
|
LONG ref;
|
2003-09-02 01:58:43 +02:00
|
|
|
IDirectSoundCaptureBufferImpl* dscb;
|
2002-06-13 21:15:06 +02:00
|
|
|
};
|
|
|
|
|
2006-01-03 17:32:50 +01:00
|
|
|
HRESULT IDirectSoundCaptureNotifyImpl_Create(
|
2003-09-02 01:58:43 +02:00
|
|
|
IDirectSoundCaptureBufferImpl *dscb,
|
|
|
|
IDirectSoundCaptureNotifyImpl ** pdscn);
|
|
|
|
|
2002-06-13 21:15:06 +02:00
|
|
|
/*****************************************************************************
|
|
|
|
* IDirectSound3DListener implementation structure
|
|
|
|
*/
|
|
|
|
struct IDirectSound3DListenerImpl
|
|
|
|
{
|
|
|
|
/* IUnknown fields */
|
2005-06-01 21:57:42 +02:00
|
|
|
const IDirectSound3DListenerVtbl *lpVtbl;
|
2005-07-12 21:21:36 +02:00
|
|
|
LONG ref;
|
2002-06-13 21:15:06 +02:00
|
|
|
/* IDirectSound3DListenerImpl fields */
|
2006-01-06 12:35:20 +01:00
|
|
|
DirectSoundDevice* device;
|
2002-06-13 21:15:06 +02:00
|
|
|
};
|
|
|
|
|
2006-01-03 17:32:50 +01:00
|
|
|
HRESULT IDirectSound3DListenerImpl_Create(
|
2006-01-06 12:35:20 +01:00
|
|
|
DirectSoundDevice *device,
|
2003-09-02 01:58:43 +02:00
|
|
|
IDirectSound3DListenerImpl **pdsl);
|
2002-06-13 21:15:06 +02:00
|
|
|
|
|
|
|
/*****************************************************************************
|
2003-08-20 20:18:23 +02:00
|
|
|
* IKsBufferPropertySet implementation structure
|
2002-06-13 21:15:06 +02:00
|
|
|
*/
|
2003-08-20 20:18:23 +02:00
|
|
|
struct IKsBufferPropertySetImpl
|
2002-06-13 21:15:06 +02:00
|
|
|
{
|
|
|
|
/* IUnknown fields */
|
2005-06-01 21:57:42 +02:00
|
|
|
const IKsPropertySetVtbl *lpVtbl;
|
2005-07-12 21:21:36 +02:00
|
|
|
LONG ref;
|
2002-06-13 21:15:06 +02:00
|
|
|
/* IKsPropertySetImpl fields */
|
|
|
|
IDirectSoundBufferImpl* dsb;
|
|
|
|
};
|
|
|
|
|
2006-01-03 17:32:50 +01:00
|
|
|
HRESULT IKsBufferPropertySetImpl_Create(
|
2003-09-02 01:58:43 +02:00
|
|
|
IDirectSoundBufferImpl *dsb,
|
|
|
|
IKsBufferPropertySetImpl **piks);
|
2006-01-03 17:32:50 +01:00
|
|
|
HRESULT IKsBufferPropertySetImpl_Destroy(
|
2004-07-14 01:35:09 +02:00
|
|
|
IKsBufferPropertySetImpl *piks);
|
2003-08-20 20:18:23 +02:00
|
|
|
|
|
|
|
/*****************************************************************************
|
|
|
|
* IKsPrivatePropertySet implementation structure
|
|
|
|
*/
|
|
|
|
struct IKsPrivatePropertySetImpl
|
|
|
|
{
|
|
|
|
/* IUnknown fields */
|
2005-06-01 21:57:42 +02:00
|
|
|
const IKsPropertySetVtbl *lpVtbl;
|
2005-07-12 21:21:36 +02:00
|
|
|
LONG ref;
|
2003-08-20 20:18:23 +02:00
|
|
|
};
|
|
|
|
|
2006-01-03 17:32:50 +01:00
|
|
|
HRESULT IKsPrivatePropertySetImpl_Create(
|
2003-09-02 01:58:43 +02:00
|
|
|
IKsPrivatePropertySetImpl **piks);
|
2002-06-13 21:15:06 +02:00
|
|
|
|
|
|
|
/*****************************************************************************
|
|
|
|
* IDirectSound3DBuffer implementation structure
|
|
|
|
*/
|
|
|
|
struct IDirectSound3DBufferImpl
|
|
|
|
{
|
|
|
|
/* IUnknown fields */
|
2005-06-01 21:57:42 +02:00
|
|
|
const IDirectSound3DBufferVtbl *lpVtbl;
|
2005-07-12 21:21:36 +02:00
|
|
|
LONG ref;
|
2002-06-13 21:15:06 +02:00
|
|
|
/* IDirectSound3DBufferImpl fields */
|
2003-06-28 00:22:15 +02:00
|
|
|
IDirectSoundBufferImpl* dsb;
|
2002-06-13 21:15:06 +02:00
|
|
|
};
|
|
|
|
|
2006-01-03 17:32:50 +01:00
|
|
|
HRESULT IDirectSound3DBufferImpl_Create(
|
2003-09-02 01:58:43 +02:00
|
|
|
IDirectSoundBufferImpl *dsb,
|
|
|
|
IDirectSound3DBufferImpl **pds3db);
|
2006-01-03 17:32:50 +01:00
|
|
|
HRESULT IDirectSound3DBufferImpl_Destroy(
|
2004-07-14 01:35:09 +02:00
|
|
|
IDirectSound3DBufferImpl *pds3db);
|
2002-06-13 21:15:06 +02:00
|
|
|
|
2003-08-07 00:57:24 +02:00
|
|
|
/*******************************************************************************
|
|
|
|
* DirectSound ClassFactory implementation structure
|
|
|
|
*/
|
|
|
|
struct IClassFactoryImpl
|
|
|
|
{
|
|
|
|
/* IUnknown fields */
|
2005-06-01 21:57:42 +02:00
|
|
|
const IClassFactoryVtbl *lpVtbl;
|
2005-07-12 21:21:36 +02:00
|
|
|
LONG ref;
|
2003-08-07 00:57:24 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
extern IClassFactoryImpl DSOUND_CAPTURE_CF;
|
|
|
|
extern IClassFactoryImpl DSOUND_FULLDUPLEX_CF;
|
|
|
|
|
2006-01-16 20:39:52 +01:00
|
|
|
/*******************************************************************************
|
|
|
|
*/
|
2002-06-13 21:15:06 +02:00
|
|
|
|
2004-09-07 21:32:21 +02:00
|
|
|
/* dsound.c */
|
|
|
|
|
2006-01-14 17:06:52 +01:00
|
|
|
HRESULT DSOUND_Create(LPDIRECTSOUND *ppDS, IUnknown *pUnkOuter);
|
|
|
|
HRESULT DSOUND_Create8(LPDIRECTSOUND8 *ppDS, IUnknown *pUnkOuter);
|
2004-09-07 21:32:21 +02:00
|
|
|
|
2002-06-13 21:15:06 +02:00
|
|
|
/* primary.c */
|
|
|
|
|
2005-05-31 11:31:37 +02:00
|
|
|
HRESULT DSOUND_PrimaryCreate(DirectSoundDevice *device);
|
|
|
|
HRESULT DSOUND_PrimaryDestroy(DirectSoundDevice *device);
|
|
|
|
HRESULT DSOUND_PrimaryPlay(DirectSoundDevice *device);
|
|
|
|
HRESULT DSOUND_PrimaryStop(DirectSoundDevice *device);
|
|
|
|
HRESULT DSOUND_PrimaryGetPosition(DirectSoundDevice *device, LPDWORD playpos, LPDWORD writepos);
|
2006-01-14 17:06:22 +01:00
|
|
|
HRESULT DSOUND_PrimarySetFormat(DirectSoundDevice *device, LPCWAVEFORMATEX wfex);
|
2002-06-13 21:15:06 +02:00
|
|
|
|
|
|
|
/* buffer.c */
|
|
|
|
|
2005-05-09 11:23:54 +02:00
|
|
|
DWORD DSOUND_CalcPlayPosition(IDirectSoundBufferImpl *This, DWORD pplay, DWORD pwrite);
|
2002-06-13 21:15:06 +02:00
|
|
|
|
|
|
|
/* mixer.c */
|
|
|
|
|
|
|
|
void DSOUND_CheckEvent(IDirectSoundBufferImpl *dsb, int len);
|
|
|
|
void DSOUND_ForceRemix(IDirectSoundBufferImpl *dsb);
|
|
|
|
void DSOUND_MixCancelAt(IDirectSoundBufferImpl *dsb, DWORD buf_writepos);
|
2005-05-31 11:31:37 +02:00
|
|
|
void DSOUND_WaveQueue(DirectSoundDevice *device, DWORD mixq);
|
|
|
|
void DSOUND_PerformMix(DirectSoundDevice *device);
|
2006-01-16 20:39:52 +01:00
|
|
|
void DSOUND_RecalcVolPan(PDSVOLUMEPAN volpan);
|
|
|
|
void DSOUND_AmpFactorToVolPan(PDSVOLUMEPAN volpan);
|
|
|
|
void DSOUND_RecalcFormat(IDirectSoundBufferImpl *dsb);
|
2002-06-13 21:15:06 +02:00
|
|
|
void CALLBACK DSOUND_timer(UINT timerID, UINT msg, DWORD dwUser, DWORD dw1, DWORD dw2);
|
|
|
|
void CALLBACK DSOUND_callback(HWAVEOUT hwo, UINT msg, DWORD dwUser, DWORD dw1, DWORD dw2);
|
|
|
|
|
2003-06-28 00:22:15 +02:00
|
|
|
/* sound3d.c */
|
|
|
|
|
|
|
|
void DSOUND_Calc3DBuffer(IDirectSoundBufferImpl *dsb);
|
|
|
|
|
2006-01-17 16:13:58 +01:00
|
|
|
/* duplex.c */
|
|
|
|
|
|
|
|
HRESULT DSOUND_FullDuplexCreate(LPDIRECTSOUNDFULLDUPLEX* ppDSFD, IUnknown *pUnkOuter);
|
|
|
|
|
2006-01-16 20:39:14 +01:00
|
|
|
/* capture.c */
|
|
|
|
|
|
|
|
HRESULT WINAPI IDirectSoundCaptureImpl_CreateCaptureBuffer(
|
|
|
|
LPDIRECTSOUNDCAPTURE iface,
|
|
|
|
LPCDSCBUFFERDESC lpcDSCBufferDesc,
|
|
|
|
LPDIRECTSOUNDCAPTUREBUFFER* lplpDSCaptureBuffer,
|
|
|
|
LPUNKNOWN pUnk);
|
|
|
|
HRESULT WINAPI IDirectSoundCaptureImpl_GetCaps(
|
|
|
|
LPDIRECTSOUNDCAPTURE iface,
|
|
|
|
LPDSCCAPS lpDSCCaps);
|
|
|
|
HRESULT WINAPI IDirectSoundCaptureImpl_Initialize(
|
|
|
|
LPDIRECTSOUNDCAPTURE iface,
|
|
|
|
LPCGUID lpcGUID);
|
|
|
|
|
2003-02-15 01:01:17 +01:00
|
|
|
#define STATE_STOPPED 0
|
|
|
|
#define STATE_STARTING 1
|
|
|
|
#define STATE_PLAYING 2
|
|
|
|
#define STATE_CAPTURING 2
|
|
|
|
#define STATE_STOPPING 3
|
2002-06-13 21:15:06 +02:00
|
|
|
|
|
|
|
#define DSOUND_FREQSHIFT (14)
|
|
|
|
|
2005-05-31 11:31:37 +02:00
|
|
|
extern DirectSoundDevice* DSOUND_renderer[MAXWAVEDRIVERS];
|
2005-03-15 16:40:35 +01:00
|
|
|
extern GUID DSOUND_renderer_guids[MAXWAVEDRIVERS];
|
2005-06-04 11:38:14 +02:00
|
|
|
|
|
|
|
extern DirectSoundCaptureDevice * DSOUND_capture[MAXWAVEDRIVERS];
|
2005-03-15 16:40:35 +01:00
|
|
|
extern GUID DSOUND_capture_guids[MAXWAVEDRIVERS];
|
2004-08-20 22:01:31 +02:00
|
|
|
|
2006-01-16 20:39:52 +01:00
|
|
|
HRESULT mmErr(UINT err);
|
|
|
|
void setup_dsound_options(void);
|
|
|
|
const char * get_device_id(LPCGUID pGuid);
|
|
|
|
const char * dumpCooperativeLevel(DWORD level);
|