ReactOS 0.4.15-dev-8413-gc1c91f2
dsound_private.h
Go to the documentation of this file.
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#ifndef _DSOUND_PRIVATE_H_
23#define _DSOUND_PRIVATE_H_
24
25#include <wine/config.h>
26
27#include <assert.h>
28#include <math.h>
29#include <stdarg.h>
30
31#define WIN32_NO_STATUS
32#define _INC_WINDOWS
33#define COM_NO_WINDOWS_H
34
35#define COBJMACROS
36#define NONAMELESSSTRUCT
37#define NONAMELESSUNION
38
39#include <windef.h>
40#include <winbase.h>
41#include <winnls.h>
42#include <wingdi.h>
43#include <winternl.h>
44#include <objbase.h>
45#include <audioclient.h>
46#include <mmddk.h>
47#include <dsound.h>
48#include <dsconf.h>
49#include <dsdriver.h>
50#include <vfwmsgs.h>
51
52#include <wine/debug.h>
53#include <wine/list.h>
54
56
57/* Linux does not support better timing than 10ms */
58#define DS_TIME_RES 2 /* Resolution of multimedia timer */
59#define DS_TIME_DEL 10 /* Delay of multimedia timer callback, and duration of HEL fragment */
60
61/* direct sound hardware acceleration levels */
62#define DS_HW_ACCEL_FULL 0 /* default on Windows 98 */
63#define DS_HW_ACCEL_STANDARD 1 /* default on Windows 2000 */
64#define DS_HW_ACCEL_BASIC 2
65#define DS_HW_ACCEL_EMULATION 3
66
75
76/*****************************************************************************
77 * Predeclare the interface implementation structures
78 */
95
96/* dsound_convert.h */
97typedef void (*bitsconvertfunc)(const void *, void *, UINT, UINT, INT, UINT, UINT);
99typedef void (*mixfunc)(const void *, void *, unsigned);
100extern const mixfunc mixfunctions[4] DECLSPEC_HIDDEN;
101typedef void (*normfunc)(const void *, void *, unsigned);
103
104/*****************************************************************************
105 * IDirectSoundDevice implementation structure
106 */
108{
110
117 HWAVEOUT hwo;
132
134
137
138 /* DirectSound3DListener fields */
142};
143
144/* reference counted buffer memory for duplicated buffer memory */
145typedef struct BufferMemory
146{
149 struct list buffers;
151
154 DirectSoundDevice ** ppDevice,
155 LPCGUID lpcGUID) DECLSPEC_HIDDEN;
165 LPCDSBUFFERDESC dsbd,
167 LPUNKNOWN lpunk,
168 BOOL from8) DECLSPEC_HIDDEN;
174 DirectSoundDevice * devcie,
175 HWND hwnd,
180 LPDWORD lpdwSpeakerConfig) DECLSPEC_HIDDEN;
185 LPDWORD pdwCertified) DECLSPEC_HIDDEN;
186
187/*****************************************************************************
188 * IDirectSoundBuffer implementation structure
189 */
191{
192 IDirectSoundBuffer8 IDirectSoundBuffer8_iface;
193 LONG numIfaces; /* "in use interfaces" refcount */
195 /* IDirectSoundBufferImpl fields */
208 /* used for frequency conversion (PerfectPitch) */
210 /* used for mixing */
212
213 /* IDirectSoundNotifyImpl fields */
218
219 /* DirectSound3DBuffer fields */
224
225 /* IKsPropertySet fields */
228 struct list entry;
229};
230
242
243/*****************************************************************************
244 * DirectSoundCaptureDevice implementation structure
245 */
247{
248 /* IDirectSoundCaptureImpl fields */
251
252 /* DirectSound driver stuff */
257
258 /* wave driver info */
259 HWAVEIN hwi;
260
261 /* more stuff */
264
266
271 int index;
273};
274
275/*****************************************************************************
276 * IDirectSoundCaptureBuffer implementation structure
277 */
279{
280 /* IUnknown fields */
281 const IDirectSoundCaptureBuffer8Vtbl *lpVtbl;
283
284 /* IDirectSoundCaptureBufferImpl fields */
286 /* FIXME: don't need this */
289
290 /* IDirectSoundCaptureNotifyImpl fields */
295};
296
297/*****************************************************************************
298 * IDirectSound3DListener implementation structure
299 */
301{
302 /* IUnknown fields */
303 const IDirectSound3DListenerVtbl *lpVtbl;
305 /* IDirectSound3DListenerImpl fields */
307};
308
312
313/*****************************************************************************
314 * IKsBufferPropertySet implementation structure
315 */
317{
318 /* IUnknown fields */
319 const IKsPropertySetVtbl *lpVtbl;
321 /* IKsPropertySetImpl fields */
323};
324
330
332
333/*****************************************************************************
334 * IDirectSound3DBuffer implementation structure
335 */
337{
338 /* IUnknown fields */
339 const IDirectSound3DBufferVtbl *lpVtbl;
341 /* IDirectSound3DBufferImpl fields */
343};
344
350
351/*******************************************************************************
352 */
353
354/* dsound.c */
355
358
359/* primary.c */
360
361DWORD DSOUND_fraglen(DWORD nSamplesPerSec, DWORD nBlockAlign) DECLSPEC_HIDDEN;
370 const DSBUFFERDESC *dsbd) DECLSPEC_HIDDEN;
373
374/* duplex.c */
375
377
378/* mixer.c */
384void DSOUND_MixToTemporary(const IDirectSoundBufferImpl *dsb, DWORD writepos, DWORD mixlen, BOOL inmixer) DECLSPEC_HIDDEN;
386
388void CALLBACK DSOUND_callback(HWAVEOUT hwo, UINT msg, DWORD_PTR dwUser, DWORD_PTR dw1, DWORD_PTR dw2) DECLSPEC_HIDDEN;
389
390/* sound3d.c */
391
393
394/* capture.c */
395
398
399#define STATE_STOPPED 0
400#define STATE_STARTING 1
401#define STATE_PLAYING 2
402#define STATE_CAPTURING 2
403#define STATE_STOPPING 3
404
405#define DSOUND_FREQSHIFT (20)
406
409
412
416
417#endif /* _DSOUND_PRIVATE_H_ */
#define msg(x)
Definition: auth_time.c:54
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
Definition: list.h:37
DirectSoundCaptureDevice * DSOUND_capture[MAXWAVEDRIVERS]
Definition: capture.c:971
#define CALLBACK
Definition: compat.h:35
struct IDsCaptureDriver * PIDSCDRIVER
Definition: dsdriver.h:45
struct IDsDriver * PIDSDRIVER
Definition: dsdriver.h:33
struct IDsDriverBuffer * PIDSDRIVERBUFFER
Definition: dsdriver.h:36
struct IDsDriverNotify * PIDSDRIVERNOTIFY
Definition: dsdriver.h:42
struct IDsCaptureDriverBuffer * PIDSCDRIVERBUFFER
Definition: dsdriver.h:48
struct IDirectSoundCapture * LPDIRECTSOUNDCAPTURE
Definition: dsound.h:92
struct IDirectSoundBuffer * LPDIRECTSOUNDBUFFER
Definition: dsound.h:76
struct IDirectSoundFullDuplex * LPDIRECTSOUNDFULLDUPLEX
Definition: dsound.h:103
struct IDirectSoundBuffer ** LPLPDIRECTSOUNDBUFFER
Definition: dsound.h:76
struct IDirectSound * LPDIRECTSOUND
Definition: dsound.h:70
struct IDirectSound8 * LPDIRECTSOUND8
Definition: dsound.h:73
struct IDirectSoundCapture * LPDIRECTSOUNDCAPTURE8
Definition: dsound.h:94
const mixfunc mixfunctions[4]
const normfunc normfunctions[4]
const bitsconvertfunc convertbpp[5][4]
GUID DSOUND_renderer_guids[MAXWAVEDRIVERS]
Definition: dsound_main.c:41
int ds_snd_queue_min
Definition: dsound_main.c:76
GUID DSOUND_capture_guids[MAXWAVEDRIVERS]
Definition: dsound_main.c:42
int ds_snd_shadow_maxsize
Definition: dsound_main.c:77
int ds_hw_accel
Definition: dsound_main.c:78
int ds_snd_queue_max
Definition: dsound_main.c:75
int ds_hel_buflen
Definition: dsound_main.c:74
int ds_default_sample_rate
Definition: dsound_main.c:79
int ds_default_bits_per_sample
Definition: dsound_main.c:80
DirectSoundDevice * DSOUND_renderer[MAXWAVEDRIVERS]
Definition: dsound_main.c:40
int ds_emuldriver
Definition: dsound_main.c:73
int ds_emuldriver DECLSPEC_HIDDEN
HRESULT DirectSoundDevice_GetCaps(DirectSoundDevice *device, LPDSCAPS lpDSCaps) DECLSPEC_HIDDEN
Definition: dsound.c:1272
HRESULT IDirectSoundBufferImpl_Destroy(IDirectSoundBufferImpl *pdsb) DECLSPEC_HIDDEN
Definition: buffer.c:1137
void secondarybuffer_destroy(IDirectSoundBufferImpl *This) DECLSPEC_HIDDEN
Definition: buffer.c:1113
HRESULT IKsPrivatePropertySetImpl_Create(REFIID riid, IKsPropertySet **piks) DECLSPEC_HIDDEN
Definition: propset.c:615
void setup_dsound_options(void) DECLSPEC_HIDDEN
Definition: dsound_main.c:102
HRESULT DSOUND_ReopenDevice(DirectSoundDevice *device, BOOL forcewave) DECLSPEC_HIDDEN
Definition: primary.c:73
HRESULT DSOUND_PrimaryStop(DirectSoundDevice *device) DECLSPEC_HIDDEN
Definition: primary.c:363
void(* bitsconvertfunc)(const void *, void *, UINT, UINT, INT, UINT, UINT)
DWORD DSOUND_secpos_to_bufpos(const IDirectSoundBufferImpl *dsb, DWORD secpos, DWORD secmixpos, DWORD *overshot) DECLSPEC_HIDDEN
Definition: mixer.c:99
HRESULT DirectSoundDevice_Compact(DirectSoundDevice *device) DECLSPEC_HIDDEN
Definition: dsound.c:1683
HRESULT IDirectSound3DBufferImpl_Create(IDirectSoundBufferImpl *dsb, IDirectSound3DBufferImpl **pds3db) DECLSPEC_HIDDEN
Definition: sound3d.c:667
void DSOUND_Calc3DBuffer(IDirectSoundBufferImpl *dsb) DECLSPEC_HIDDEN
Definition: sound3d.c:141
HRESULT DSOUND_PrimaryPlay(DirectSoundDevice *device) DECLSPEC_HIDDEN
Definition: primary.c:345
HRESULT DSOUND_Create8(REFIID riid, LPDIRECTSOUND8 *ppDS) DECLSPEC_HIDDEN
Definition: dsound.c:1050
HRESULT DSOUND_Create(REFIID riid, LPDIRECTSOUND *ppDS) DECLSPEC_HIDDEN
Definition: dsound.c:963
HRESULT DirectSoundDevice_GetSpeakerConfig(DirectSoundDevice *device, LPDWORD lpdwSpeakerConfig) DECLSPEC_HIDDEN
Definition: dsound.c:1701
HRESULT DirectSoundDevice_AddBuffer(DirectSoundDevice *device, IDirectSoundBufferImpl *pDSB) DECLSPEC_HIDDEN
Definition: dsound.c:1761
HRESULT primarybuffer_SetFormat(DirectSoundDevice *device, LPCWAVEFORMATEX wfex) DECLSPEC_HIDDEN
Definition: primary.c:460
void CALLBACK DSOUND_timer(UINT timerID, UINT msg, DWORD_PTR dwUser, DWORD_PTR dw1, DWORD_PTR dw2) DECLSPEC_HIDDEN
Definition: mixer.c:984
HRESULT IDirectSoundBufferImpl_Duplicate(DirectSoundDevice *device, IDirectSoundBufferImpl **ppdsb, IDirectSoundBufferImpl *pdsb) DECLSPEC_HIDDEN
Definition: buffer.c:1169
DWORD DSOUND_bufpos_to_mixpos(const DirectSoundDevice *device, DWORD pos) DECLSPEC_HIDDEN
Definition: mixer.c:84
ULONG DirectSoundDevice_Release(DirectSoundDevice *device) DECLSPEC_HIDDEN
Definition: dsound.c:1216
void(* normfunc)(const void *, void *, unsigned)
HRESULT DirectSoundDevice_DuplicateSoundBuffer(DirectSoundDevice *device, LPDIRECTSOUNDBUFFER psb, LPLPDIRECTSOUNDBUFFER ppdsb) DECLSPEC_HIDDEN
Definition: dsound.c:1621
void DSOUND_AmpFactorToVolPan(PDSVOLUMEPAN volpan) DECLSPEC_HIDDEN
Definition: mixer.c:46
HRESULT DSOUND_PrimaryGetPosition(DirectSoundDevice *device, LPDWORD playpos, LPDWORD writepos) DECLSPEC_HIDDEN
Definition: primary.c:402
HRESULT DirectSoundDevice_SetCooperativeLevel(DirectSoundDevice *devcie, HWND hwnd, DWORD level) DECLSPEC_HIDDEN
Definition: dsound.c:1662
HRESULT DSOUND_CaptureCreate8(REFIID riid, LPDIRECTSOUNDCAPTURE8 *ppDSC8) DECLSPEC_HIDDEN
Definition: capture.c:1365
HRESULT IKsBufferPropertySetImpl_Create(IDirectSoundBufferImpl *dsb, IKsBufferPropertySetImpl **piks) DECLSPEC_HIDDEN
Definition: buffer.c:1390
void CALLBACK DSOUND_callback(HWAVEOUT hwo, UINT msg, DWORD_PTR dwUser, DWORD_PTR dw1, DWORD_PTR dw2) DECLSPEC_HIDDEN
Definition: mixer.c:1011
LPWAVEFORMATEX DSOUND_CopyFormat(LPCWAVEFORMATEX wfex) DECLSPEC_HIDDEN
Definition: primary.c:437
void DSOUND_MixToTemporary(const IDirectSoundBufferImpl *dsb, DWORD writepos, DWORD mixlen, BOOL inmixer) DECLSPEC_HIDDEN
Definition: mixer.c:332
HRESULT IKsBufferPropertySetImpl_Destroy(IKsBufferPropertySetImpl *piks) DECLSPEC_HIDDEN
Definition: buffer.c:1416
void DSOUND_RecalcVolPan(PDSVOLUMEPAN volpan) DECLSPEC_HIDDEN
Definition: mixer.c:27
HRESULT DirectSoundDevice_RemoveBuffer(DirectSoundDevice *device, IDirectSoundBufferImpl *pDSB) DECLSPEC_HIDDEN
Definition: dsound.c:1796
const char * dumpCooperativeLevel(DWORD level) DECLSPEC_HIDDEN
Definition: dsound.c:92
void(* mixfunc)(const void *, void *, unsigned)
HRESULT IDirectSound3DListenerImpl_Create(DirectSoundDevice *device, IDirectSound3DListenerImpl **pdsl) DECLSPEC_HIDDEN
Definition: sound3d.c:1034
DWORD DSOUND_fraglen(DWORD nSamplesPerSec, DWORD nBlockAlign) DECLSPEC_HIDDEN
Definition: primary.c:36
HRESULT IDirectSound3DBufferImpl_Destroy(IDirectSound3DBufferImpl *pds3db) DECLSPEC_HIDDEN
Definition: sound3d.c:709
HRESULT IDirectSoundBufferImpl_Create(DirectSoundDevice *device, IDirectSoundBufferImpl **ppdsb, LPCDSBUFFERDESC dsbd) DECLSPEC_HIDDEN
Definition: buffer.c:931
void DSOUND_CheckEvent(const IDirectSoundBufferImpl *dsb, DWORD playpos, int len) DECLSPEC_HIDDEN
Definition: mixer.c:221
HRESULT DirectSoundDevice_SetSpeakerConfig(DirectSoundDevice *device, DWORD config) DECLSPEC_HIDDEN
Definition: dsound.c:1722
HRESULT DSOUND_PrimaryCreate(DirectSoundDevice *device) DECLSPEC_HIDDEN
Definition: primary.c:304
HRESULT primarybuffer_create(DirectSoundDevice *device, IDirectSoundBufferImpl **ppdsb, const DSBUFFERDESC *dsbd) DECLSPEC_HIDDEN
Definition: primary.c:1223
HRESULT DSOUND_FullDuplexCreate(REFIID riid, LPDIRECTSOUNDFULLDUPLEX *ppDSFD) DECLSPEC_HIDDEN
Definition: duplex.c:604
void DSOUND_RecalcFormat(IDirectSoundBufferImpl *dsb) DECLSPEC_HIDDEN
Definition: mixer.c:162
void primarybuffer_destroy(IDirectSoundBufferImpl *This) DECLSPEC_HIDDEN
Definition: primary.c:763
HRESULT mmErr(UINT err) DECLSPEC_HIDDEN
Definition: dsound_main.c:44
HRESULT DSOUND_PrimaryDestroy(DirectSoundDevice *device) DECLSPEC_HIDDEN
Definition: primary.c:321
HRESULT DirectSoundDevice_VerifyCertification(DirectSoundDevice *device, LPDWORD pdwCertified) DECLSPEC_HIDDEN
Definition: dsound.c:1738
HRESULT DSOUND_CaptureCreate(REFIID riid, LPDIRECTSOUNDCAPTURE *ppDSC) DECLSPEC_HIDDEN
Definition: capture.c:1336
HRESULT DirectSoundDevice_Initialize(DirectSoundDevice **ppDevice, LPCGUID lpcGUID) DECLSPEC_HIDDEN
Definition: dsound.c:1326
HRESULT DirectSoundDevice_CreateSoundBuffer(DirectSoundDevice *device, LPCDSBUFFERDESC dsbd, LPLPDIRECTSOUNDBUFFER ppdsb, LPUNKNOWN lpunk, BOOL from8) DECLSPEC_HIDDEN
Definition: dsound.c:1482
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint level
Definition: gl.h:1546
GLenum GLsizei len
Definition: glext.h:6722
const GLuint * buffers
Definition: glext.h:5916
REFIID riid
Definition: atlbase.h:39
static unsigned(__cdecl *hash_bstr)(bstr_t s)
unsigned int UINT
Definition: ndis.h:50
static LPUNKNOWN
Definition: ndr_ole.c:49
long LONG
Definition: pedump.c:60
#define INT
Definition: polytest.cpp:20
#define REFIID
Definition: guiddef.h:118
#define err(...)
#define MAXWAVEDRIVERS
Definition: mmddk.h:37
IDirectSoundCaptureBufferImpl * capture_buffer
PIDSCDRIVERBUFFER hwbuf
RTL_RWLOCK buffer_list_lock
PIDSDRIVERBUFFER hwbuf
CRITICAL_SECTION mixlock
DS3DLISTENER ds3dl
DSVOLUMEPAN volpan
PWAVEFORMATEX pwfx
IDirectSound3DListenerImpl * listener
IDirectSoundBufferImpl * primary
DSDRIVERCAPS drvcaps
IDirectSoundBufferImpl ** buffers
DSDRIVERDESC drvdesc
IDirectSoundBufferImpl * dsb
const IDirectSound3DBufferVtbl * lpVtbl
DirectSoundDevice * device
const IDirectSound3DListenerVtbl * lpVtbl
IDirectSoundNotifyImpl * notify
IDirectSound3DBufferImpl * ds3db
bitsconvertfunc convert
IKsBufferPropertySetImpl * iks
PIDSDRIVERBUFFER hwbuf
DirectSoundDevice * device
LPDSBPOSITIONNOTIFY notifies
IDirectSoundBuffer8 IDirectSoundBuffer8_iface
PIDSDRIVERNOTIFY hwnotify
DirectSoundCaptureDevice * device
IDirectSoundCaptureNotifyImpl * notify
LPDSBPOSITIONNOTIFY notifies
const IDirectSoundCaptureBuffer8Vtbl * lpVtbl
IDirectSoundBufferImpl * dsb
const IKsPropertySetVtbl * lpVtbl
Definition: devices.h:37
uint32_t DWORD_PTR
Definition: typedefs.h:65
unsigned char * LPBYTE
Definition: typedefs.h:53
uint32_t * LPDWORD
Definition: typedefs.h:59
uint32_t ULONG
Definition: typedefs.h:59
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023