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
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2002-06-13 21:15:06 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* Linux does not support better timing than 10ms */
|
2007-06-13 17:05:49 +02:00
|
|
|
#define DS_TIME_RES 2 /* Resolution of multimedia timer */
|
2002-06-13 21:15:06 +02:00
|
|
|
#define DS_TIME_DEL 10 /* Delay of multimedia timer callback, and duration of HEL fragment */
|
|
|
|
|
2007-07-29 23:47:01 +02:00
|
|
|
#include "wine/list.h"
|
|
|
|
|
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;
|
2007-07-30 16:20:08 +02:00
|
|
|
extern int ds_hel_buflen;
|
2002-06-13 21:15:06 +02:00
|
|
|
extern int ds_snd_queue_max;
|
2007-07-30 16:12:29 +02:00
|
|
|
extern int ds_snd_queue_min;
|
2008-03-04 05:18:04 +01:00
|
|
|
extern int ds_snd_shadow_maxsize;
|
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;
|
2006-04-06 02:48:44 +02:00
|
|
|
extern int ds_default_sample_rate;
|
|
|
|
extern int ds_default_bits_per_sample;
|
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;
|
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
|
|
|
|
2007-11-07 20:31:53 +01:00
|
|
|
/* dsound_convert.h */
|
|
|
|
typedef void (*bitsconvertfunc)(const void *, void *);
|
|
|
|
extern const bitsconvertfunc convertbpp[4][4];
|
2007-11-07 20:32:09 +01:00
|
|
|
typedef void (*mixfunc)(const void *, void *, unsigned);
|
|
|
|
extern const mixfunc mixfunctions[4];
|
|
|
|
typedef void (*normfunc)(const void *, void *, unsigned);
|
|
|
|
extern const normfunc normfunctions[4];
|
2007-11-07 20:31:53 +01:00
|
|
|
|
2006-01-14 17:06:52 +01:00
|
|
|
/*****************************************************************************
|
|
|
|
* 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;
|
2007-07-30 16:44:50 +02:00
|
|
|
LPWAVEHDR pwave;
|
|
|
|
UINT timerID, pwplay, pwqueue, prebuf, helfrags;
|
2002-06-13 21:15:06 +02:00
|
|
|
DWORD fraglen;
|
|
|
|
PIDSDRIVERBUFFER hwbuf;
|
|
|
|
LPBYTE buffer;
|
|
|
|
DWORD writelead, buflen, state, playpos, mixpos;
|
|
|
|
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;
|
2007-11-07 20:32:22 +01:00
|
|
|
LPBYTE tmp_buffer, mix_buffer;
|
|
|
|
DWORD tmp_buffer_len, mix_buffer_len;
|
|
|
|
|
2008-09-28 20:47:28 +02:00
|
|
|
DSVOLUMEPAN volpan;
|
|
|
|
|
2007-11-07 20:32:22 +01:00
|
|
|
mixfunc mixfunction;
|
|
|
|
normfunc normfunction;
|
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;
|
2007-07-29 23:47:01 +02:00
|
|
|
struct list buffers;
|
2003-06-28 00:22:15 +02:00
|
|
|
} BufferMemory;
|
|
|
|
|
2006-01-14 17:06:52 +01:00
|
|
|
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);
|
2004-07-04 02:13:44 +02:00
|
|
|
|
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;
|
2007-07-29 21:01:43 +02:00
|
|
|
RTL_RWLOCK lock;
|
2003-06-28 00:22:15 +02:00
|
|
|
PIDSDRIVERBUFFER hwbuf;
|
2004-08-18 02:30:37 +02:00
|
|
|
PWAVEFORMATEX pwfx;
|
2003-06-28 00:22:15 +02:00
|
|
|
BufferMemory* buffer;
|
2007-07-29 23:47:01 +02:00
|
|
|
LPBYTE tmp_buffer;
|
2003-06-28 00:22:15 +02:00
|
|
|
DWORD playflags,state,leadin;
|
2007-07-29 23:47:01 +02:00
|
|
|
DWORD writelead,buflen;
|
2003-06-28 00:22:15 +02:00
|
|
|
DWORD nAvgBytesPerSec;
|
2007-07-29 23:47:01 +02:00
|
|
|
DWORD freq, tmp_buffer_len, max_buffer_len;
|
2007-06-13 17:05:49 +02:00
|
|
|
DSVOLUMEPAN volpan;
|
2003-06-28 00:22:15 +02:00
|
|
|
DSBUFFERDESC dsbd;
|
2002-06-13 21:15:06 +02:00
|
|
|
/* used for frequency conversion (PerfectPitch) */
|
2008-03-04 05:18:04 +01:00
|
|
|
ULONG freqneeded, freqAdjust, freqAcc, freqAccNext, resampleinmixer;
|
2007-07-29 23:47:01 +02:00
|
|
|
/* used for mixing */
|
|
|
|
DWORD primary_mixpos, buf_mixpos, sec_mixpos;
|
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;
|
2007-11-07 20:31:53 +01:00
|
|
|
bitsconvertfunc convert;
|
2007-07-29 23:47:01 +02:00
|
|
|
struct list entry;
|
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);
|
|
|
|
|
|
|
|
/*****************************************************************************
|
|
|
|
* PrimaryBuffer implementation structure
|
|
|
|
*/
|
|
|
|
struct PrimaryBufferImpl
|
|
|
|
{
|
2007-05-13 12:58:36 +02:00
|
|
|
const IDirectSoundBufferVtbl *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
|
|
|
|
2006-01-04 14:49:34 +01:00
|
|
|
/*****************************************************************************
|
|
|
|
* 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-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-05 13:37:15 +01:00
|
|
|
HRESULT DirectSoundCaptureDevice_Initialize(
|
|
|
|
DirectSoundCaptureDevice ** ppDevice,
|
|
|
|
LPCGUID lpcGUID);
|
2006-01-04 14:49:34 +01:00
|
|
|
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;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct IDirectSoundFullDuplex_IDirectSound {
|
|
|
|
const IDirectSoundVtbl *lpVtbl;
|
|
|
|
LONG ref;
|
|
|
|
IDirectSoundFullDuplexImpl *pdsfd;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct IDirectSoundFullDuplex_IDirectSound8 {
|
|
|
|
const IDirectSound8Vtbl *lpVtbl;
|
|
|
|
LONG ref;
|
|
|
|
IDirectSoundFullDuplexImpl *pdsfd;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct IDirectSoundFullDuplex_IDirectSoundCapture {
|
|
|
|
const IDirectSoundCaptureVtbl *lpVtbl;
|
|
|
|
LONG ref;
|
|
|
|
IDirectSoundFullDuplexImpl *pdsfd;
|
|
|
|
};
|
|
|
|
|
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(
|
2006-08-18 07:13:31 +02:00
|
|
|
REFIID riid,
|
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
|
|
|
|
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-08-18 07:13:31 +02:00
|
|
|
HRESULT DSOUND_Create(REFIID riid, LPDIRECTSOUND *ppDS);
|
|
|
|
HRESULT DSOUND_Create8(REFIID riid, LPDIRECTSOUND8 *ppDS);
|
2004-09-07 21:32:21 +02:00
|
|
|
|
2002-06-13 21:15:06 +02:00
|
|
|
/* primary.c */
|
|
|
|
|
2007-09-29 01:54:03 +02:00
|
|
|
DWORD DSOUND_fraglen(DWORD nSamplesPerSec, DWORD nBlockAlign);
|
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);
|
2007-08-27 17:20:38 +02:00
|
|
|
HRESULT DSOUND_PrimarySetFormat(DirectSoundDevice *device, LPCWAVEFORMATEX wfex, BOOL forced);
|
2007-08-27 17:07:14 +02:00
|
|
|
HRESULT DSOUND_ReopenDevice(DirectSoundDevice *device, BOOL forcewave);
|
2002-06-13 21:15:06 +02:00
|
|
|
|
2006-08-18 07:13:31 +02:00
|
|
|
/* duplex.c */
|
|
|
|
|
|
|
|
HRESULT DSOUND_FullDuplexCreate(REFIID riid, LPDIRECTSOUNDFULLDUPLEX* ppDSFD);
|
|
|
|
|
2002-06-13 21:15:06 +02:00
|
|
|
/* mixer.c */
|
2007-11-07 20:32:22 +01:00
|
|
|
DWORD DSOUND_bufpos_to_mixpos(const DirectSoundDevice* device, DWORD pos);
|
2007-07-29 21:39:46 +02:00
|
|
|
void DSOUND_CheckEvent(const IDirectSoundBufferImpl *dsb, DWORD playpos, int len);
|
2006-01-16 20:39:52 +01:00
|
|
|
void DSOUND_RecalcVolPan(PDSVOLUMEPAN volpan);
|
|
|
|
void DSOUND_AmpFactorToVolPan(PDSVOLUMEPAN volpan);
|
|
|
|
void DSOUND_RecalcFormat(IDirectSoundBufferImpl *dsb);
|
2008-03-04 05:18:04 +01:00
|
|
|
void DSOUND_MixToTemporary(const IDirectSoundBufferImpl *dsb, DWORD writepos, DWORD mixlen, BOOL inmixer);
|
2007-07-29 23:47:01 +02:00
|
|
|
DWORD DSOUND_secpos_to_bufpos(const IDirectSoundBufferImpl *dsb, DWORD secpos, DWORD secmixpos, DWORD* overshot);
|
|
|
|
|
2006-11-12 14:39:11 +01:00
|
|
|
void CALLBACK DSOUND_timer(UINT timerID, UINT msg, DWORD_PTR dwUser, DWORD_PTR dw1, DWORD_PTR dw2);
|
2008-08-10 07:52:09 +02:00
|
|
|
void CALLBACK DSOUND_callback(HWAVEOUT hwo, UINT msg, DWORD_PTR dwUser, DWORD_PTR dw1, DWORD_PTR dw2);
|
2002-06-13 21:15:06 +02:00
|
|
|
|
2003-06-28 00:22:15 +02:00
|
|
|
/* sound3d.c */
|
|
|
|
|
|
|
|
void DSOUND_Calc3DBuffer(IDirectSoundBufferImpl *dsb);
|
|
|
|
|
2006-01-16 20:39:14 +01:00
|
|
|
/* capture.c */
|
2006-08-18 07:13:31 +02:00
|
|
|
|
|
|
|
HRESULT DSOUND_CaptureCreate(REFIID riid, LPDIRECTSOUNDCAPTURE *ppDSC);
|
|
|
|
HRESULT DSOUND_CaptureCreate8(REFIID riid, LPDIRECTSOUNDCAPTURE8 *ppDSC8);
|
2006-01-16 20:39:14 +01:00
|
|
|
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
|
|
|
|
2007-07-29 23:47:01 +02:00
|
|
|
#define DSOUND_FREQSHIFT (20)
|
2002-06-13 21:15:06 +02:00
|
|
|
|
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 * dumpCooperativeLevel(DWORD level);
|