ReactOS 0.4.15-dev-8116-gf69e256
dsound.c File Reference
#include "dsound_private.h"
Include dependency graph for dsound.c:

Go to the source code of this file.

Classes

struct  IDirectSound_IUnknown
 
struct  IDirectSound_IDirectSound
 
struct  IDirectSound8_IUnknown
 
struct  IDirectSound8_IDirectSound
 
struct  IDirectSound8_IDirectSound8
 
struct  IDirectSoundImpl
 

Macros

#define LE(x)   case x: return #x
 
#define FE(x)   { x, #x },
 
#define FE(x)   { x, #x },
 

Functions

static HRESULT IDirectSound_IUnknown_Create (LPDIRECTSOUND8 pds, LPUNKNOWN *ppunk)
 
static HRESULT IDirectSound_IDirectSound_Create (LPDIRECTSOUND8 pds, LPDIRECTSOUND *ppds)
 
static HRESULT IDirectSound8_IUnknown_Create (LPDIRECTSOUND8 pds, LPUNKNOWN *ppunk)
 
static ULONG WINAPI IDirectSound8_IUnknown_AddRef (LPUNKNOWN iface)
 
static HRESULT IDirectSound8_IDirectSound_Create (LPDIRECTSOUND8 pds, LPDIRECTSOUND *ppds)
 
static ULONG WINAPI IDirectSound8_IDirectSound_AddRef (LPDIRECTSOUND iface)
 
static HRESULT IDirectSound8_IDirectSound8_Create (LPDIRECTSOUND8 pds, LPDIRECTSOUND8 *ppds)
 
static ULONG WINAPI IDirectSound8_IDirectSound8_AddRef (LPDIRECTSOUND8 iface)
 
static HRESULT IDirectSoundImpl_Create (LPDIRECTSOUND8 *ppds)
 
static ULONG WINAPI IDirectSound_IUnknown_AddRef (LPUNKNOWN iface)
 
static ULONG WINAPI IDirectSound_IDirectSound_AddRef (LPDIRECTSOUND iface)
 
const chardumpCooperativeLevel (DWORD level)
 
static void _dump_DSCAPS (DWORD xmask)
 
static void _dump_DSBCAPS (DWORD xmask)
 
static HRESULT DSOUND_QueryInterface (LPDIRECTSOUND8 iface, REFIID riid, LPVOID *ppobj)
 
static HRESULT DSOUND_QueryInterface8 (LPDIRECTSOUND8 iface, REFIID riid, LPVOID *ppobj)
 
static ULONG IDirectSoundImpl_AddRef (LPDIRECTSOUND8 iface)
 
static ULONG IDirectSoundImpl_Release (LPDIRECTSOUND8 iface)
 
static HRESULT WINAPI IDirectSound_IUnknown_QueryInterface (LPUNKNOWN iface, REFIID riid, LPVOID *ppobj)
 
static ULONG WINAPI IDirectSound_IUnknown_Release (LPUNKNOWN iface)
 
static HRESULT WINAPI IDirectSound_IDirectSound_QueryInterface (LPDIRECTSOUND iface, REFIID riid, LPVOID *ppobj)
 
static ULONG WINAPI IDirectSound_IDirectSound_Release (LPDIRECTSOUND iface)
 
static HRESULT WINAPI IDirectSound_IDirectSound_CreateSoundBuffer (LPDIRECTSOUND iface, LPCDSBUFFERDESC dsbd, LPLPDIRECTSOUNDBUFFER ppdsb, LPUNKNOWN lpunk)
 
static HRESULT WINAPI IDirectSound_IDirectSound_GetCaps (LPDIRECTSOUND iface, LPDSCAPS lpDSCaps)
 
static HRESULT WINAPI IDirectSound_IDirectSound_DuplicateSoundBuffer (LPDIRECTSOUND iface, LPDIRECTSOUNDBUFFER psb, LPLPDIRECTSOUNDBUFFER ppdsb)
 
static HRESULT WINAPI IDirectSound_IDirectSound_SetCooperativeLevel (LPDIRECTSOUND iface, HWND hwnd, DWORD level)
 
static HRESULT WINAPI IDirectSound_IDirectSound_Compact (LPDIRECTSOUND iface)
 
static HRESULT WINAPI IDirectSound_IDirectSound_GetSpeakerConfig (LPDIRECTSOUND iface, LPDWORD lpdwSpeakerConfig)
 
static HRESULT WINAPI IDirectSound_IDirectSound_SetSpeakerConfig (LPDIRECTSOUND iface, DWORD config)
 
static HRESULT WINAPI IDirectSound_IDirectSound_Initialize (LPDIRECTSOUND iface, LPCGUID lpcGuid)
 
static HRESULT WINAPI IDirectSound8_IUnknown_QueryInterface (LPUNKNOWN iface, REFIID riid, LPVOID *ppobj)
 
static ULONG WINAPI IDirectSound8_IUnknown_Release (LPUNKNOWN iface)
 
static HRESULT WINAPI IDirectSound8_IDirectSound_QueryInterface (LPDIRECTSOUND iface, REFIID riid, LPVOID *ppobj)
 
static ULONG WINAPI IDirectSound8_IDirectSound_Release (LPDIRECTSOUND iface)
 
static HRESULT WINAPI IDirectSound8_IDirectSound_CreateSoundBuffer (LPDIRECTSOUND iface, LPCDSBUFFERDESC dsbd, LPLPDIRECTSOUNDBUFFER ppdsb, LPUNKNOWN lpunk)
 
static HRESULT WINAPI IDirectSound8_IDirectSound_GetCaps (LPDIRECTSOUND iface, LPDSCAPS lpDSCaps)
 
static HRESULT WINAPI IDirectSound8_IDirectSound_DuplicateSoundBuffer (LPDIRECTSOUND iface, LPDIRECTSOUNDBUFFER psb, LPLPDIRECTSOUNDBUFFER ppdsb)
 
static HRESULT WINAPI IDirectSound8_IDirectSound_SetCooperativeLevel (LPDIRECTSOUND iface, HWND hwnd, DWORD level)
 
static HRESULT WINAPI IDirectSound8_IDirectSound_Compact (LPDIRECTSOUND iface)
 
static HRESULT WINAPI IDirectSound8_IDirectSound_GetSpeakerConfig (LPDIRECTSOUND iface, LPDWORD lpdwSpeakerConfig)
 
static HRESULT WINAPI IDirectSound8_IDirectSound_SetSpeakerConfig (LPDIRECTSOUND iface, DWORD config)
 
static HRESULT WINAPI IDirectSound8_IDirectSound_Initialize (LPDIRECTSOUND iface, LPCGUID lpcGuid)
 
static HRESULT WINAPI IDirectSound8_IDirectSound8_QueryInterface (LPDIRECTSOUND8 iface, REFIID riid, LPVOID *ppobj)
 
static ULONG WINAPI IDirectSound8_IDirectSound8_Release (LPDIRECTSOUND8 iface)
 
static HRESULT WINAPI IDirectSound8_IDirectSound8_CreateSoundBuffer (LPDIRECTSOUND8 iface, LPCDSBUFFERDESC dsbd, LPLPDIRECTSOUNDBUFFER ppdsb, LPUNKNOWN lpunk)
 
static HRESULT WINAPI IDirectSound8_IDirectSound8_GetCaps (LPDIRECTSOUND8 iface, LPDSCAPS lpDSCaps)
 
static HRESULT WINAPI IDirectSound8_IDirectSound8_DuplicateSoundBuffer (LPDIRECTSOUND8 iface, LPDIRECTSOUNDBUFFER psb, LPLPDIRECTSOUNDBUFFER ppdsb)
 
static HRESULT WINAPI IDirectSound8_IDirectSound8_SetCooperativeLevel (LPDIRECTSOUND8 iface, HWND hwnd, DWORD level)
 
static HRESULT WINAPI IDirectSound8_IDirectSound8_Compact (LPDIRECTSOUND8 iface)
 
static HRESULT WINAPI IDirectSound8_IDirectSound8_GetSpeakerConfig (LPDIRECTSOUND8 iface, LPDWORD lpdwSpeakerConfig)
 
static HRESULT WINAPI IDirectSound8_IDirectSound8_SetSpeakerConfig (LPDIRECTSOUND8 iface, DWORD config)
 
static HRESULT WINAPI IDirectSound8_IDirectSound8_Initialize (LPDIRECTSOUND8 iface, LPCGUID lpcGuid)
 
static HRESULT WINAPI IDirectSound8_IDirectSound8_VerifyCertification (LPDIRECTSOUND8 iface, LPDWORD pdwCertified)
 
HRESULT DSOUND_Create (REFIID riid, LPDIRECTSOUND *ppDS)
 
HRESULT WINAPI DirectSoundCreate (LPCGUID lpcGUID, LPDIRECTSOUND *ppDS, IUnknown *pUnkOuter)
 
HRESULT DSOUND_Create8 (REFIID riid, LPDIRECTSOUND8 *ppDS)
 
HRESULT WINAPI DirectSoundCreate8 (LPCGUID lpcGUID, LPDIRECTSOUND8 *ppDS, IUnknown *pUnkOuter)
 
static HRESULT DirectSoundDevice_Create (DirectSoundDevice **ppDevice)
 
static ULONG DirectSoundDevice_AddRef (DirectSoundDevice *device)
 
ULONG DirectSoundDevice_Release (DirectSoundDevice *device)
 
HRESULT DirectSoundDevice_GetCaps (DirectSoundDevice *device, LPDSCAPS lpDSCaps)
 
HRESULT DirectSoundDevice_Initialize (DirectSoundDevice **ppDevice, LPCGUID lpcGUID)
 
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 *device, 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)
 
HRESULT DirectSoundDevice_AddBuffer (DirectSoundDevice *device, IDirectSoundBufferImpl *pDSB)
 
HRESULT DirectSoundDevice_RemoveBuffer (DirectSoundDevice *device, IDirectSoundBufferImpl *pDSB)
 

Variables

static const IUnknownVtbl DirectSound_Unknown_Vtbl
 
static const IDirectSoundVtbl DirectSound_DirectSound_Vtbl
 
static const IUnknownVtbl DirectSound8_Unknown_Vtbl
 
static const IDirectSoundVtbl DirectSound8_DirectSound_Vtbl
 
static const IDirectSound8Vtbl DirectSound8_DirectSound8_Vtbl
 

Macro Definition Documentation

◆ FE [1/2]

#define FE (   x)    { x, #x },

◆ FE [2/2]

#define FE (   x)    { x, #x },

◆ LE

#define LE (   x)    case x: return #x

Function Documentation

◆ _dump_DSBCAPS()

static void _dump_DSBCAPS ( DWORD  xmask)
static

Definition at line 131 of file dsound.c.

131 {
132 struct {
133 DWORD mask;
134 const char *name;
135 } flags[] = {
136#define FE(x) { x, #x },
150#undef FE
151 };
152 unsigned int i;
153
154 for (i=0;i<sizeof(flags)/sizeof(flags[0]);i++)
155 if ((flags[i].mask & xmask) == flags[i].mask)
156 TRACE("%s ",flags[i].name);
157}
#define FE(x)
#define DSBCAPS_GLOBALFOCUS
Definition: dsound.h:219
#define DSBCAPS_CTRLVOLUME
Definition: dsound.h:213
#define DSBCAPS_MUTE3DATMAXDISTANCE
Definition: dsound.h:221
#define DSBCAPS_STICKYFOCUS
Definition: dsound.h:218
#define DSBCAPS_GETCURRENTPOSITION2
Definition: dsound.h:220
#define DSBCAPS_CTRLPAN
Definition: dsound.h:212
#define DSBCAPS_STATIC
Definition: dsound.h:207
#define DSBCAPS_CTRLPOSITIONNOTIFY
Definition: dsound.h:215
#define DSBCAPS_LOCSOFTWARE
Definition: dsound.h:209
#define DSBCAPS_CTRLFREQUENCY
Definition: dsound.h:211
#define DSBCAPS_CTRL3D
Definition: dsound.h:210
#define DSBCAPS_LOCHARDWARE
Definition: dsound.h:208
#define DSBCAPS_PRIMARYBUFFER
Definition: dsound.h:206
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLint GLuint mask
Definition: glext.h:6028
GLbitfield flags
Definition: glext.h:7161
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define TRACE(s)
Definition: solgame.cpp:4
Definition: name.c:39

Referenced by DirectSoundDevice_CreateSoundBuffer().

◆ _dump_DSCAPS()

static void _dump_DSCAPS ( DWORD  xmask)
static

Definition at line 105 of file dsound.c.

105 {
106 struct {
107 DWORD mask;
108 const char *name;
109 } flags[] = {
110#define FE(x) { x, #x },
122#undef FE
123 };
124 unsigned int i;
125
126 for (i=0;i<sizeof(flags)/sizeof(flags[0]);i++)
127 if ((flags[i].mask & xmask) == flags[i].mask)
128 TRACE("%s ",flags[i].name);
129}
#define DSCAPS_SECONDARYSTEREO
Definition: dsound.h:151
#define DSCAPS_CERTIFIED
Definition: dsound.h:149
#define DSCAPS_CONTINUOUSRATE
Definition: dsound.h:147
#define DSCAPS_SECONDARYMONO
Definition: dsound.h:150
#define DSCAPS_SECONDARY8BIT
Definition: dsound.h:152
#define DSCAPS_PRIMARY8BIT
Definition: dsound.h:145
#define DSCAPS_SECONDARY16BIT
Definition: dsound.h:153
#define DSCAPS_PRIMARYMONO
Definition: dsound.h:143
#define DSCAPS_EMULDRIVER
Definition: dsound.h:148
#define DSCAPS_PRIMARY16BIT
Definition: dsound.h:146
#define DSCAPS_PRIMARYSTEREO
Definition: dsound.h:144

Referenced by DirectSoundDevice_GetCaps().

◆ DirectSoundCreate()

HRESULT WINAPI DirectSoundCreate ( LPCGUID  lpcGUID,
LPDIRECTSOUND ppDS,
IUnknown pUnkOuter 
)

Definition at line 1012 of file dsound.c.

1016{
1017 HRESULT hr;
1018 LPDIRECTSOUND pDS;
1019
1020 TRACE("(%s,%p,%p)\n",debugstr_guid(lpcGUID),ppDS,pUnkOuter);
1021
1022 if (ppDS == NULL) {
1023 WARN("invalid parameter: ppDS == NULL\n");
1024 return DSERR_INVALIDPARAM;
1025 }
1026
1027 if (pUnkOuter != NULL) {
1028 WARN("invalid parameter: pUnkOuter != NULL\n");
1029 *ppDS = 0;
1030 return DSERR_INVALIDPARAM;
1031 }
1032
1033 hr = DSOUND_Create(&IID_IDirectSound, &pDS);
1034 if (hr == DS_OK) {
1035 hr = IDirectSound_Initialize(pDS, lpcGUID);
1036 if (hr != DS_OK) {
1039 pDS = 0;
1040 } else
1041 hr = DS_OK;
1042 }
1043 }
1044
1045 *ppDS = pDS;
1046
1047 return hr;
1048}
#define WARN(fmt,...)
Definition: debug.h:115
#define NULL
Definition: types.h:112
HRESULT DSOUND_Create(REFIID riid, LPDIRECTSOUND *ppDS)
Definition: dsound.c:963
#define DSERR_ALREADYINITIALIZED
Definition: dsound.h:129
#define IDirectSound_Initialize(p, a)
Definition: dsound.h:462
struct IDirectSound * LPDIRECTSOUND
Definition: dsound.h:70
#define DS_OK
Definition: dsound.h:116
#define DSERR_INVALIDPARAM
Definition: dsound.h:121
#define IDirectSound_Release(p)
Definition: dsound.h:453
#define debugstr_guid
Definition: kernel32.h:35
HRESULT hr
Definition: shlfolder.c:183

◆ DirectSoundCreate8()

HRESULT WINAPI DirectSoundCreate8 ( LPCGUID  lpcGUID,
LPDIRECTSOUND8 ppDS,
IUnknown pUnkOuter 
)

Definition at line 1100 of file dsound.c.

1104{
1105 HRESULT hr;
1106 LPDIRECTSOUND8 pDS;
1107
1108 TRACE("(%s,%p,%p)\n",debugstr_guid(lpcGUID),ppDS,pUnkOuter);
1109
1110 if (ppDS == NULL) {
1111 WARN("invalid parameter: ppDS == NULL\n");
1112 return DSERR_INVALIDPARAM;
1113 }
1114
1115 if (pUnkOuter != NULL) {
1116 WARN("invalid parameter: pUnkOuter != NULL\n");
1117 *ppDS = 0;
1118 return DSERR_INVALIDPARAM;
1119 }
1120
1121 hr = DSOUND_Create8(&IID_IDirectSound8, &pDS);
1122 if (hr == DS_OK) {
1123 hr = IDirectSound8_Initialize(pDS, lpcGUID);
1124 if (hr != DS_OK) {
1127 pDS = 0;
1128 } else
1129 hr = DS_OK;
1130 }
1131 }
1132
1133 *ppDS = pDS;
1134
1135 return hr;
1136}
HRESULT DSOUND_Create8(REFIID riid, LPDIRECTSOUND8 *ppDS)
Definition: dsound.c:1050
struct IDirectSound8 * LPDIRECTSOUND8
Definition: dsound.h:73
#define IDirectSound8_Release(p)
Definition: dsound.h:507
#define IDirectSound8_Initialize(p, a)
Definition: dsound.h:516

◆ DirectSoundDevice_AddBuffer()

HRESULT DirectSoundDevice_AddBuffer ( DirectSoundDevice device,
IDirectSoundBufferImpl pDSB 
)

Definition at line 1761 of file dsound.c.

1764{
1765 IDirectSoundBufferImpl **newbuffers;
1766 HRESULT hr = DS_OK;
1767
1768 TRACE("(%p, %p)\n", device, pDSB);
1769
1770 RtlAcquireResourceExclusive(&(device->buffer_list_lock), TRUE);
1771
1772 if (device->buffers)
1773 newbuffers = HeapReAlloc(GetProcessHeap(),0,device->buffers,sizeof(IDirectSoundBufferImpl*)*(device->nrofbuffers+1));
1774 else
1775 newbuffers = HeapAlloc(GetProcessHeap(),0,sizeof(IDirectSoundBufferImpl*)*(device->nrofbuffers+1));
1776
1777 if (newbuffers) {
1778 device->buffers = newbuffers;
1779 device->buffers[device->nrofbuffers] = pDSB;
1780 device->nrofbuffers++;
1781 TRACE("buffer count is now %d\n", device->nrofbuffers);
1782 } else {
1783 ERR("out of memory for buffer list! Current buffer count is %d\n", device->nrofbuffers);
1785 }
1786
1787 RtlReleaseResource(&(device->buffer_list_lock));
1788
1789 return hr;
1790}
#define ERR(fmt,...)
Definition: debug.h:113
#define TRUE
Definition: types.h:120
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapReAlloc
Definition: compat.h:734
#define DSERR_OUTOFMEMORY
Definition: dsound.h:125
NTSYSAPI BOOLEAN NTAPI RtlAcquireResourceExclusive(_In_ PRTL_RESOURCE Resource, _In_ BOOLEAN Wait)
NTSYSAPI VOID NTAPI RtlReleaseResource(_In_ PRTL_RESOURCE Resource)
Definition: devices.h:37

Referenced by IDirectSoundBufferImpl_Create(), and IDirectSoundBufferImpl_Duplicate().

◆ DirectSoundDevice_AddRef()

static ULONG DirectSoundDevice_AddRef ( DirectSoundDevice device)
static

Definition at line 1209 of file dsound.c.

1210{
1212 TRACE("(%p) ref was %d\n", device, ref - 1);
1213 return ref;
1214}
#define InterlockedIncrement
Definition: armddk.h:53
Definition: send.c:48
uint32_t ULONG
Definition: typedefs.h:59

Referenced by DirectSoundDevice_Initialize().

◆ DirectSoundDevice_Compact()

HRESULT DirectSoundDevice_Compact ( DirectSoundDevice device)

Definition at line 1683 of file dsound.c.

1685{
1686 TRACE("(%p)\n", device);
1687
1688 if (device == NULL) {
1689 WARN("not initialized\n");
1690 return DSERR_UNINITIALIZED;
1691 }
1692
1693 if (device->priolevel < DSSCL_PRIORITY) {
1694 WARN("incorrect priority level\n");
1695 return DSERR_PRIOLEVELNEEDED;
1696 }
1697
1698 return DS_OK;
1699}
#define DSERR_UNINITIALIZED
Definition: dsound.h:133
#define DSSCL_PRIORITY
Definition: dsound.h:248
#define DSERR_PRIOLEVELNEEDED
Definition: dsound.h:124

Referenced by IDirectSound8_IDirectSound8_Compact(), IDirectSound8_IDirectSound_Compact(), and IDirectSound_IDirectSound_Compact().

◆ DirectSoundDevice_Create()

static HRESULT DirectSoundDevice_Create ( DirectSoundDevice **  ppDevice)
static

Definition at line 1141 of file dsound.c.

1142{
1144 TRACE("(%p)\n", ppDevice);
1145
1146 /* Allocate memory */
1148 if (device == NULL) {
1149 WARN("out of memory\n");
1150 return DSERR_OUTOFMEMORY;
1151 }
1152
1153 device->ref = 1;
1154 device->priolevel = DSSCL_NORMAL;
1155 device->state = STATE_STOPPED;
1156 device->speaker_config = DSSPEAKER_STEREO | (DSSPEAKER_GEOMETRY_NARROW << 16);
1157
1158 /* 3D listener initial parameters */
1159 device->ds3dl.dwSize = sizeof(DS3DLISTENER);
1160 device->ds3dl.vPosition.x = 0.0;
1161 device->ds3dl.vPosition.y = 0.0;
1162 device->ds3dl.vPosition.z = 0.0;
1163 device->ds3dl.vVelocity.x = 0.0;
1164 device->ds3dl.vVelocity.y = 0.0;
1165 device->ds3dl.vVelocity.z = 0.0;
1166 device->ds3dl.vOrientFront.x = 0.0;
1167 device->ds3dl.vOrientFront.y = 0.0;
1168 device->ds3dl.vOrientFront.z = 1.0;
1169 device->ds3dl.vOrientTop.x = 0.0;
1170 device->ds3dl.vOrientTop.y = 1.0;
1171 device->ds3dl.vOrientTop.z = 0.0;
1172 device->ds3dl.flDistanceFactor = DS3D_DEFAULTDISTANCEFACTOR;
1173 device->ds3dl.flRolloffFactor = DS3D_DEFAULTROLLOFFFACTOR;
1174 device->ds3dl.flDopplerFactor = DS3D_DEFAULTDOPPLERFACTOR;
1175
1176 device->prebuf = ds_snd_queue_max;
1177 device->guid = GUID_NULL;
1178
1179 /* Set default wave format (may need it for waveOutOpen) */
1181 if (device->pwfx == NULL) {
1182 WARN("out of memory\n");
1184 return DSERR_OUTOFMEMORY;
1185 }
1186
1187 /* We rely on the sound driver to return the actual sound format of
1188 * the device if it does not support 22050x8x2 and is given the
1189 * WAVE_DIRECTSOUND flag.
1190 */
1191 device->pwfx->wFormatTag = WAVE_FORMAT_PCM;
1192 device->pwfx->nSamplesPerSec = ds_default_sample_rate;
1193 device->pwfx->wBitsPerSample = ds_default_bits_per_sample;
1194 device->pwfx->nChannels = 2;
1195 device->pwfx->nBlockAlign = device->pwfx->wBitsPerSample * device->pwfx->nChannels / 8;
1196 device->pwfx->nAvgBytesPerSec = device->pwfx->nSamplesPerSec * device->pwfx->nBlockAlign;
1197 device->pwfx->cbSize = 0;
1198
1199 InitializeCriticalSection(&(device->mixlock));
1200 device->mixlock.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": DirectSoundDevice.mixlock");
1201
1202 RtlInitializeResource(&(device->buffer_list_lock));
1203
1204 *ppDevice = device;
1205
1206 return DS_OK;
1207}
#define WAVE_FORMAT_PCM
Definition: constants.h:425
#define HeapFree(x, y, z)
Definition: compat.h:735
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define DSSPEAKER_STEREO
Definition: dsound.h:308
#define DSSCL_NORMAL
Definition: dsound.h:247
#define DS3D_DEFAULTROLLOFFFACTOR
Definition: dsound.h:923
#define DSSPEAKER_GEOMETRY_NARROW
Definition: dsound.h:318
#define DS3D_DEFAULTDOPPLERFACTOR
Definition: dsound.h:927
struct _DS3DLISTENER DS3DLISTENER
#define DS3D_DEFAULTDISTANCEFACTOR
Definition: dsound.h:919
int ds_snd_queue_max
Definition: dsound_main.c:75
int ds_default_sample_rate
Definition: dsound_main.c:79
int ds_default_bits_per_sample
Definition: dsound_main.c:80
#define STATE_STOPPED
#define GUID_NULL
Definition: ks.h:106
NTSYSAPI VOID NTAPI RtlInitializeResource(_In_ PRTL_RESOURCE Resource)
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
Definition: synch.c:751
#define DWORD_PTR
Definition: treelist.c:76

Referenced by DirectSoundDevice_Initialize().

◆ DirectSoundDevice_CreateSoundBuffer()

HRESULT DirectSoundDevice_CreateSoundBuffer ( DirectSoundDevice device,
LPCDSBUFFERDESC  dsbd,
LPLPDIRECTSOUNDBUFFER  ppdsb,
LPUNKNOWN  lpunk,
BOOL  from8 
)

Definition at line 1482 of file dsound.c.

1488{
1489 HRESULT hres = DS_OK;
1490 TRACE("(%p,%p,%p,%p)\n",device,dsbd,ppdsb,lpunk);
1491
1492 if (device == NULL) {
1493 WARN("not initialized\n");
1494 return DSERR_UNINITIALIZED;
1495 }
1496
1497 if (dsbd == NULL) {
1498 WARN("invalid parameter: dsbd == NULL\n");
1499 return DSERR_INVALIDPARAM;
1500 }
1501
1502 if (dsbd->dwSize != sizeof(DSBUFFERDESC) &&
1503 dsbd->dwSize != sizeof(DSBUFFERDESC1)) {
1504 WARN("invalid parameter: dsbd\n");
1505 return DSERR_INVALIDPARAM;
1506 }
1507
1508 if (ppdsb == NULL) {
1509 WARN("invalid parameter: ppdsb == NULL\n");
1510 return DSERR_INVALIDPARAM;
1511 }
1512 *ppdsb = NULL;
1513
1514 if (TRACE_ON(dsound)) {
1515 TRACE("(structsize=%d)\n",dsbd->dwSize);
1516 TRACE("(flags=0x%08x:\n",dsbd->dwFlags);
1517 _dump_DSBCAPS(dsbd->dwFlags);
1518 TRACE(")\n");
1519 TRACE("(bufferbytes=%d)\n",dsbd->dwBufferBytes);
1520 TRACE("(lpwfxFormat=%p)\n",dsbd->lpwfxFormat);
1521 }
1522
1523 if (dsbd->dwFlags & DSBCAPS_PRIMARYBUFFER) {
1524 if (dsbd->lpwfxFormat != NULL) {
1525 WARN("invalid parameter: dsbd->lpwfxFormat must be NULL for "
1526 "primary buffer\n");
1527 return DSERR_INVALIDPARAM;
1528 }
1529
1530 if (device->primary) {
1531 WARN("Primary Buffer already created\n");
1533 *ppdsb = (LPDIRECTSOUNDBUFFER)(device->primary);
1534 } else {
1535 hres = primarybuffer_create(device, &device->primary, dsbd);
1536 if (device->primary) {
1537 *ppdsb = (IDirectSoundBuffer*)&device->primary->IDirectSoundBuffer8_iface;
1538 device->primary->dsbd.dwFlags &= ~(DSBCAPS_LOCHARDWARE | DSBCAPS_LOCSOFTWARE);
1539 if (device->hwbuf)
1540 device->primary->dsbd.dwFlags |= DSBCAPS_LOCHARDWARE;
1541 else
1542 device->primary->dsbd.dwFlags |= DSBCAPS_LOCSOFTWARE;
1543 } else
1544 WARN("primarybuffer_create() failed\n");
1545 }
1546 } else {
1548 WAVEFORMATEXTENSIBLE *pwfxe;
1549
1550 if (dsbd->lpwfxFormat == NULL) {
1551 WARN("invalid parameter: dsbd->lpwfxFormat can't be NULL for "
1552 "secondary buffer\n");
1553 return DSERR_INVALIDPARAM;
1554 }
1555 pwfxe = (WAVEFORMATEXTENSIBLE*)dsbd->lpwfxFormat;
1556
1557 if (pwfxe->Format.wBitsPerSample != 16 && pwfxe->Format.wBitsPerSample != 8 && pwfxe->Format.wFormatTag != WAVE_FORMAT_EXTENSIBLE)
1558 {
1559 WARN("wBitsPerSample=%d needs a WAVEFORMATEXTENSIBLE\n", dsbd->lpwfxFormat->wBitsPerSample);
1560 return DSERR_CONTROLUNAVAIL;
1561 }
1563 {
1564 /* check if cbSize is at least 22 bytes */
1565 if (pwfxe->Format.cbSize < (sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX)))
1566 {
1567 WARN("Too small a cbSize %u\n", pwfxe->Format.cbSize);
1568 return DSERR_INVALIDPARAM;
1569 }
1570
1571 /* cbSize should be 22 bytes, with one possible exception */
1572 if (pwfxe->Format.cbSize > (sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX)) &&
1574 pwfxe->Format.cbSize == sizeof(WAVEFORMATEXTENSIBLE)))
1575 {
1576 WARN("Too big a cbSize %u\n", pwfxe->Format.cbSize);
1577 return DSERR_CONTROLUNAVAIL;
1578 }
1579
1581 {
1582 if (!IsEqualGUID(&pwfxe->SubFormat, &GUID_NULL))
1583 FIXME("SubFormat %s not supported right now.\n", debugstr_guid(&pwfxe->SubFormat));
1584 return DSERR_INVALIDPARAM;
1585 }
1587 {
1588 WARN("Samples.wValidBitsPerSample(%d) > Format.wBitsPerSample (%d)\n", pwfxe->Samples.wValidBitsPerSample, pwfxe->Format.wBitsPerSample);
1589 return DSERR_INVALIDPARAM;
1590 }
1592 {
1593 FIXME("Non-packed formats not supported right now: %d/%d\n", pwfxe->Samples.wValidBitsPerSample, dsbd->lpwfxFormat->wBitsPerSample);
1594 return DSERR_CONTROLUNAVAIL;
1595 }
1596 }
1597
1598 TRACE("(formattag=0x%04x,chans=%d,samplerate=%d,"
1599 "bytespersec=%d,blockalign=%d,bitspersamp=%d,cbSize=%d)\n",
1603 dsbd->lpwfxFormat->nBlockAlign,
1605
1606 if (from8 && (dsbd->dwFlags & DSBCAPS_CTRL3D) && (dsbd->lpwfxFormat->nChannels != 1)) {
1607 WARN("invalid parameter: 3D buffer format must be mono\n");
1608 return DSERR_INVALIDPARAM;
1609 }
1610
1612 if (dsb)
1613 *ppdsb = (IDirectSoundBuffer*)&dsb->IDirectSoundBuffer8_iface;
1614 else
1615 WARN("IDirectSoundBufferImpl_Create failed\n");
1616 }
1617
1618 return hres;
1619}
#define FIXME(fmt,...)
Definition: debug.h:114
HRESULT IDirectSoundBufferImpl_Create(DirectSoundDevice *device, IDirectSoundBufferImpl **pdsb, LPCDSBUFFERDESC dsbd)
Definition: buffer.c:931
static void _dump_DSBCAPS(DWORD xmask)
Definition: dsound.c:131
#define TRACE_ON(x)
Definition: compat.h:75
#define IDirectSoundBuffer_AddRef(p)
Definition: dsound.h:573
struct IDirectSoundBuffer * LPDIRECTSOUNDBUFFER
Definition: dsound.h:76
#define DSERR_CONTROLUNAVAIL
Definition: dsound.h:120
struct IDirectSoundBuffer8 * LPDIRECTSOUNDBUFFER8
Definition: dsound.h:79
HRESULT primarybuffer_create(DirectSoundDevice *device, IDirectSoundBufferImpl **ppdsb, const DSBUFFERDESC *dsbd) DECLSPEC_HIDDEN
Definition: primary.c:1223
#define KSDATAFORMAT_SUBTYPE_PCM
Definition: ksmedia.h:1021
#define WAVE_FORMAT_EXTENSIBLE
Definition: ksmedia.h:651
#define KSDATAFORMAT_SUBTYPE_IEEE_FLOAT
Definition: ksmedia.h:1026
if(dx< 0)
Definition: linetemp.h:194
HRESULT hres
Definition: protocol.c:465
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
IDirectSoundBuffer8 IDirectSoundBuffer8_iface
WAVEFORMATEX Format
Definition: ksmedia.h:638
WORD wValidBitsPerSample
Definition: ksmedia.h:641
union WAVEFORMATEXTENSIBLE::@3034 Samples
WORD wBitsPerSample
Definition: audioclient.idl:45
DWORD dwSize
Definition: dsound.h:288
DWORD dwFlags
Definition: dsound.h:289
DWORD dwBufferBytes
Definition: dsound.h:290
LPWAVEFORMATEX lpwfxFormat
Definition: dsound.h:292
WORD nBlockAlign
Definition: mmreg.h:82
WORD cbSize
Definition: mmreg.h:84
DWORD nAvgBytesPerSec
Definition: mmreg.h:81
DWORD nSamplesPerSec
Definition: mmreg.h:80
WORD nChannels
Definition: mmreg.h:79
WORD wFormatTag
Definition: mmreg.h:78
WORD wBitsPerSample
Definition: mmreg.h:83

Referenced by IDirectSound8_IDirectSound8_CreateSoundBuffer(), IDirectSound8_IDirectSound_CreateSoundBuffer(), and IDirectSound_IDirectSound_CreateSoundBuffer().

◆ DirectSoundDevice_DuplicateSoundBuffer()

HRESULT DirectSoundDevice_DuplicateSoundBuffer ( DirectSoundDevice device,
LPDIRECTSOUNDBUFFER  psb,
LPLPDIRECTSOUNDBUFFER  ppdsb 
)

Definition at line 1621 of file dsound.c.

1625{
1626 HRESULT hres = DS_OK;
1628 TRACE("(%p,%p,%p)\n",device,psb,ppdsb);
1629
1630 if (device == NULL) {
1631 WARN("not initialized\n");
1632 return DSERR_UNINITIALIZED;
1633 }
1634
1635 if (psb == NULL) {
1636 WARN("invalid parameter: psb == NULL\n");
1637 return DSERR_INVALIDPARAM;
1638 }
1639
1640 if (ppdsb == NULL) {
1641 WARN("invalid parameter: ppdsb == NULL\n");
1642 return DSERR_INVALIDPARAM;
1643 }
1644
1645 /* make sure we have a secondary buffer */
1646 if (psb == (IDirectSoundBuffer *)&device->primary->IDirectSoundBuffer8_iface) {
1647 WARN("trying to duplicate primary buffer\n");
1648 *ppdsb = NULL;
1649 return DSERR_INVALIDCALL;
1650 }
1651
1652 /* duplicate the actual buffer implementation */
1654 if (hres == DS_OK)
1655 *ppdsb = (IDirectSoundBuffer*)&dsb->IDirectSoundBuffer8_iface;
1656 else
1657 WARN("IDirectSoundBufferImpl_Duplicate failed\n");
1658
1659 return hres;
1660}
HRESULT IDirectSoundBufferImpl_Duplicate(DirectSoundDevice *device, IDirectSoundBufferImpl **ppdsb, IDirectSoundBufferImpl *pdsb)
Definition: buffer.c:1169
#define DSERR_INVALIDCALL
Definition: dsound.h:122

Referenced by IDirectSound8_IDirectSound8_DuplicateSoundBuffer(), IDirectSound8_IDirectSound_DuplicateSoundBuffer(), and IDirectSound_IDirectSound_DuplicateSoundBuffer().

◆ DirectSoundDevice_GetCaps()

HRESULT DirectSoundDevice_GetCaps ( DirectSoundDevice device,
LPDSCAPS  lpDSCaps 
)

Definition at line 1272 of file dsound.c.

1275{
1276 TRACE("(%p,%p)\n",device,lpDSCaps);
1277
1278 if (device == NULL) {
1279 WARN("not initialized\n");
1280 return DSERR_UNINITIALIZED;
1281 }
1282
1283 if (lpDSCaps == NULL) {
1284 WARN("invalid parameter: lpDSCaps = NULL\n");
1285 return DSERR_INVALIDPARAM;
1286 }
1287
1288 /* check if there is enough room */
1289 if (lpDSCaps->dwSize < sizeof(*lpDSCaps)) {
1290 WARN("invalid parameter: lpDSCaps->dwSize = %d\n", lpDSCaps->dwSize);
1291 return DSERR_INVALIDPARAM;
1292 }
1293
1294 lpDSCaps->dwFlags = device->drvcaps.dwFlags;
1295 if (TRACE_ON(dsound)) {
1296 TRACE("(flags=0x%08x:\n",lpDSCaps->dwFlags);
1297 _dump_DSCAPS(lpDSCaps->dwFlags);
1298 TRACE(")\n");
1299 }
1300 lpDSCaps->dwMinSecondarySampleRate = device->drvcaps.dwMinSecondarySampleRate;
1301 lpDSCaps->dwMaxSecondarySampleRate = device->drvcaps.dwMaxSecondarySampleRate;
1302 lpDSCaps->dwPrimaryBuffers = device->drvcaps.dwPrimaryBuffers;
1303 lpDSCaps->dwMaxHwMixingAllBuffers = device->drvcaps.dwMaxHwMixingAllBuffers;
1304 lpDSCaps->dwMaxHwMixingStaticBuffers = device->drvcaps.dwMaxHwMixingStaticBuffers;
1305 lpDSCaps->dwMaxHwMixingStreamingBuffers = device->drvcaps.dwMaxHwMixingStreamingBuffers;
1306 lpDSCaps->dwFreeHwMixingAllBuffers = device->drvcaps.dwFreeHwMixingAllBuffers;
1307 lpDSCaps->dwFreeHwMixingStaticBuffers = device->drvcaps.dwFreeHwMixingStaticBuffers;
1308 lpDSCaps->dwFreeHwMixingStreamingBuffers = device->drvcaps.dwFreeHwMixingStreamingBuffers;
1309 lpDSCaps->dwMaxHw3DAllBuffers = device->drvcaps.dwMaxHw3DAllBuffers;
1310 lpDSCaps->dwMaxHw3DStaticBuffers = device->drvcaps.dwMaxHw3DStaticBuffers;
1311 lpDSCaps->dwMaxHw3DStreamingBuffers = device->drvcaps.dwMaxHw3DStreamingBuffers;
1312 lpDSCaps->dwFreeHw3DAllBuffers = device->drvcaps.dwFreeHw3DAllBuffers;
1313 lpDSCaps->dwFreeHw3DStaticBuffers = device->drvcaps.dwFreeHw3DStaticBuffers;
1314 lpDSCaps->dwFreeHw3DStreamingBuffers = device->drvcaps.dwFreeHw3DStreamingBuffers;
1315 lpDSCaps->dwTotalHwMemBytes = device->drvcaps.dwTotalHwMemBytes;
1316 lpDSCaps->dwFreeHwMemBytes = device->drvcaps.dwFreeHwMemBytes;
1317 lpDSCaps->dwMaxContigFreeHwMemBytes = device->drvcaps.dwMaxContigFreeHwMemBytes;
1318
1319 /* driver doesn't have these */
1320 lpDSCaps->dwUnlockTransferRateHwBuffers = 4096; /* But we have none... */
1321 lpDSCaps->dwPlayCpuOverheadSwBuffers = 1; /* 1% */
1322
1323 return DS_OK;
1324}
static void _dump_DSCAPS(DWORD xmask)
Definition: dsound.c:105
DWORD dwFlags
Definition: dsound.h:163
DWORD dwMaxContigFreeHwMemBytes
Definition: dsound.h:181
DWORD dwUnlockTransferRateHwBuffers
Definition: dsound.h:182
DWORD dwMaxHwMixingStreamingBuffers
Definition: dsound.h:169
DWORD dwMaxHw3DStreamingBuffers
Definition: dsound.h:175
DWORD dwPrimaryBuffers
Definition: dsound.h:166
DWORD dwMaxSecondarySampleRate
Definition: dsound.h:165
DWORD dwFreeHw3DStreamingBuffers
Definition: dsound.h:178
DWORD dwMaxHw3DStaticBuffers
Definition: dsound.h:174
DWORD dwFreeHw3DStaticBuffers
Definition: dsound.h:177
DWORD dwTotalHwMemBytes
Definition: dsound.h:179
DWORD dwFreeHwMixingStaticBuffers
Definition: dsound.h:171
DWORD dwFreeHwMixingStreamingBuffers
Definition: dsound.h:172
DWORD dwMinSecondarySampleRate
Definition: dsound.h:164
DWORD dwMaxHwMixingAllBuffers
Definition: dsound.h:167
DWORD dwPlayCpuOverheadSwBuffers
Definition: dsound.h:183
DWORD dwMaxHwMixingStaticBuffers
Definition: dsound.h:168
DWORD dwSize
Definition: dsound.h:162
DWORD dwFreeHwMixingAllBuffers
Definition: dsound.h:170
DWORD dwMaxHw3DAllBuffers
Definition: dsound.h:173
DWORD dwFreeHwMemBytes
Definition: dsound.h:180
DWORD dwFreeHw3DAllBuffers
Definition: dsound.h:176

Referenced by IDirectSound8_IDirectSound8_GetCaps(), IDirectSound8_IDirectSound_GetCaps(), and IDirectSound_IDirectSound_GetCaps().

◆ DirectSoundDevice_GetSpeakerConfig()

HRESULT DirectSoundDevice_GetSpeakerConfig ( DirectSoundDevice device,
LPDWORD  lpdwSpeakerConfig 
)

Definition at line 1701 of file dsound.c.

1704{
1705 TRACE("(%p, %p)\n", device, lpdwSpeakerConfig);
1706
1707 if (device == NULL) {
1708 WARN("not initialized\n");
1709 return DSERR_UNINITIALIZED;
1710 }
1711
1712 if (lpdwSpeakerConfig == NULL) {
1713 WARN("invalid parameter: lpdwSpeakerConfig == NULL\n");
1714 return DSERR_INVALIDPARAM;
1715 }
1716
1717 WARN("not fully functional\n");
1718 *lpdwSpeakerConfig = device->speaker_config;
1719 return DS_OK;
1720}

Referenced by IDirectSound8_IDirectSound8_GetSpeakerConfig(), IDirectSound8_IDirectSound_GetSpeakerConfig(), and IDirectSound_IDirectSound_GetSpeakerConfig().

◆ DirectSoundDevice_Initialize()

HRESULT DirectSoundDevice_Initialize ( DirectSoundDevice **  ppDevice,
LPCGUID  lpcGUID 
)

Definition at line 1326 of file dsound.c.

1327{
1328 HRESULT hr = DS_OK;
1329 unsigned wod, wodn;
1330 BOOLEAN found = FALSE;
1331 GUID devGUID;
1332 DirectSoundDevice * device = *ppDevice;
1333 TRACE("(%p,%s)\n",ppDevice,debugstr_guid(lpcGUID));
1334
1335 if (*ppDevice != NULL) {
1336 WARN("already initialized\n");
1338 }
1339
1340 /* Default device? */
1341 if (!lpcGUID || IsEqualGUID(lpcGUID, &GUID_NULL))
1342 lpcGUID = &DSDEVID_DefaultPlayback;
1343
1344 if (GetDeviceID(lpcGUID, &devGUID) != DS_OK) {
1345 WARN("invalid parameter: lpcGUID\n");
1346 return DSERR_INVALIDPARAM;
1347 }
1348
1349 /* Enumerate WINMM audio devices and find the one we want */
1350 wodn = waveOutGetNumDevs();
1351 if (!wodn) {
1352 WARN("no driver\n");
1353 return DSERR_NODRIVER;
1354 }
1355
1356 for (wod=0; wod<wodn; wod++) {
1357 if (IsEqualGUID( &devGUID, &DSOUND_renderer_guids[wod])) {
1358 found = TRUE;
1359 break;
1360 }
1361 }
1362
1363 if (found == FALSE) {
1364 WARN("No device found matching given ID!\n");
1365 return DSERR_NODRIVER;
1366 }
1367
1368 if (DSOUND_renderer[wod]) {
1369 if (IsEqualGUID(&devGUID, &DSOUND_renderer[wod]->guid)) {
1370 device = DSOUND_renderer[wod];
1372 *ppDevice = device;
1373 return DS_OK;
1374 } else {
1375 ERR("device GUID doesn't match\n");
1376 hr = DSERR_GENERIC;
1377 return hr;
1378 }
1379 } else {
1381 if (hr != DS_OK) {
1382 WARN("DirectSoundDevice_Create failed\n");
1383 return hr;
1384 }
1385 }
1386
1387 *ppDevice = device;
1388 device->guid = devGUID;
1389 device->driver = NULL;
1390
1391 device->drvdesc.dnDevNode = wod;
1393 if (FAILED(hr))
1394 {
1395 WARN("DSOUND_ReopenDevice failed: %08x\n", hr);
1396 return hr;
1397 }
1398
1399 if (device->driver) {
1400 /* the driver is now open, so it's now allowed to call GetCaps */
1401 hr = IDsDriver_GetCaps(device->driver,&(device->drvcaps));
1402 if (hr != DS_OK) {
1403 WARN("IDsDriver_GetCaps failed\n");
1404 return hr;
1405 }
1406 } else {
1407 WAVEOUTCAPSA woc;
1408 hr = mmErr(waveOutGetDevCapsA(device->drvdesc.dnDevNode, &woc, sizeof(woc)));
1409 if (hr != DS_OK) {
1410 WARN("waveOutGetDevCaps failed\n");
1411 return hr;
1412 }
1413 ZeroMemory(&device->drvcaps, sizeof(device->drvcaps));
1414 if ((woc.dwFormats & WAVE_FORMAT_1M08) ||
1415 (woc.dwFormats & WAVE_FORMAT_2M08) ||
1416 (woc.dwFormats & WAVE_FORMAT_4M08) ||
1417 (woc.dwFormats & WAVE_FORMAT_48M08) ||
1418 (woc.dwFormats & WAVE_FORMAT_96M08)) {
1419 device->drvcaps.dwFlags |= DSCAPS_PRIMARY8BIT;
1420 device->drvcaps.dwFlags |= DSCAPS_PRIMARYMONO;
1421 }
1422 if ((woc.dwFormats & WAVE_FORMAT_1M16) ||
1423 (woc.dwFormats & WAVE_FORMAT_2M16) ||
1424 (woc.dwFormats & WAVE_FORMAT_4M16) ||
1425 (woc.dwFormats & WAVE_FORMAT_48M16) ||
1426 (woc.dwFormats & WAVE_FORMAT_96M16)) {
1427 device->drvcaps.dwFlags |= DSCAPS_PRIMARY16BIT;
1428 device->drvcaps.dwFlags |= DSCAPS_PRIMARYMONO;
1429 }
1430 if ((woc.dwFormats & WAVE_FORMAT_1S08) ||
1431 (woc.dwFormats & WAVE_FORMAT_2S08) ||
1432 (woc.dwFormats & WAVE_FORMAT_4S08) ||
1433 (woc.dwFormats & WAVE_FORMAT_48S08) ||
1434 (woc.dwFormats & WAVE_FORMAT_96S08)) {
1435 device->drvcaps.dwFlags |= DSCAPS_PRIMARY8BIT;
1436 device->drvcaps.dwFlags |= DSCAPS_PRIMARYSTEREO;
1437 }
1438 if ((woc.dwFormats & WAVE_FORMAT_1S16) ||
1439 (woc.dwFormats & WAVE_FORMAT_2S16) ||
1440 (woc.dwFormats & WAVE_FORMAT_4S16) ||
1441 (woc.dwFormats & WAVE_FORMAT_48S16) ||
1442 (woc.dwFormats & WAVE_FORMAT_96S16)) {
1443 device->drvcaps.dwFlags |= DSCAPS_PRIMARY16BIT;
1444 device->drvcaps.dwFlags |= DSCAPS_PRIMARYSTEREO;
1445 }
1446 if (ds_emuldriver)
1447 device->drvcaps.dwFlags |= DSCAPS_EMULDRIVER;
1448 device->drvcaps.dwMinSecondarySampleRate = DSBFREQUENCY_MIN;
1449 device->drvcaps.dwMaxSecondarySampleRate = DSBFREQUENCY_MAX;
1450 ZeroMemory(&device->volpan, sizeof(device->volpan));
1451 }
1452
1454 if (hr == DS_OK) {
1455 UINT triggertime = DS_TIME_DEL, res = DS_TIME_RES, id;
1456 TIMECAPS time;
1457
1458 DSOUND_renderer[device->drvdesc.dnDevNode] = device;
1459 timeGetDevCaps(&time, sizeof(TIMECAPS));
1460 TRACE("Minimum timer resolution: %u, max timer: %u\n", time.wPeriodMin, time.wPeriodMax);
1461 if (triggertime < time.wPeriodMin)
1462 triggertime = time.wPeriodMin;
1463 if (res < time.wPeriodMin)
1464 res = time.wPeriodMin;
1466 WARN("Could not set minimum resolution, don't expect sound\n");
1467 id = timeSetEvent(triggertime, res, DSOUND_timer, (DWORD_PTR)device, TIME_PERIODIC | TIME_KILL_SYNCHRONOUS);
1468 if (!id)
1469 {
1470 WARN("Timer not created! Retrying without TIME_KILL_SYNCHRONOUS\n");
1472 if (!id) ERR("Could not create timer, sound playback will not occur\n");
1473 }
1474 DSOUND_renderer[device->drvdesc.dnDevNode]->timerID = id;
1475 } else {
1476 WARN("DSOUND_PrimaryCreate failed\n");
1477 }
1478
1479 return hr;
1480}
unsigned char BOOLEAN
#define FALSE
Definition: types.h:117
HRESULT WINAPI GetDeviceID(LPCGUID pGuidSrc, LPGUID pGuidDest)
Definition: dsound.c:53
static HRESULT DirectSoundDevice_Create(DirectSoundDevice **ppDevice)
Definition: dsound.c:1141
static ULONG DirectSoundDevice_AddRef(DirectSoundDevice *device)
Definition: dsound.c:1209
MMRESULT WINAPI timeBeginPeriod(UINT wPeriod)
Definition: time.c:423
MMRESULT WINAPI timeGetDevCaps(LPTIMECAPS lpCaps, UINT wSize)
Definition: time.c:401
MMRESULT WINAPI timeSetEvent(UINT wDelay, UINT wResol, LPTIMECALLBACK lpFunc, DWORD_PTR dwUser, UINT wFlags)
Definition: time.c:360
#define IDsDriver_GetCaps(p, a)
Definition: dsdriver.h:162
#define DSBFREQUENCY_MAX
Definition: dsound.h:232
#define DSERR_GENERIC
Definition: dsound.h:123
#define DSERR_NODRIVER
Definition: dsound.h:128
#define DSBFREQUENCY_MIN
Definition: dsound.h:231
GUID DSOUND_renderer_guids[MAXWAVEDRIVERS]
Definition: dsound_main.c:41
HRESULT mmErr(UINT err)
Definition: dsound_main.c:44
DirectSoundDevice * DSOUND_renderer[MAXWAVEDRIVERS]
Definition: dsound_main.c:40
int ds_emuldriver
Definition: dsound_main.c:73
HRESULT DSOUND_ReopenDevice(DirectSoundDevice *device, BOOL forcewave) DECLSPEC_HIDDEN
Definition: primary.c:73
#define DS_TIME_RES
void CALLBACK DSOUND_timer(UINT timerID, UINT msg, DWORD_PTR dwUser, DWORD_PTR dw1, DWORD_PTR dw2) DECLSPEC_HIDDEN
Definition: mixer.c:984
#define DS_TIME_DEL
HRESULT DSOUND_PrimaryCreate(DirectSoundDevice *device) DECLSPEC_HIDDEN
Definition: primary.c:304
GLuint res
Definition: glext.h:9613
GLuint id
Definition: glext.h:5910
#define FAILED(hr)
Definition: intsafe.h:51
const GUID * guid
__u16 time
Definition: mkdosfs.c:8
#define WAVE_FORMAT_2S08
Definition: mmsystem.h:211
#define WAVE_FORMAT_1M08
Definition: mmsystem.h:206
#define WAVE_FORMAT_2M08
Definition: mmsystem.h:210
#define TIME_PERIODIC
Definition: mmsystem.h:422
#define WAVE_FORMAT_2M16
Definition: mmsystem.h:212
#define WAVE_FORMAT_4S08
Definition: mmsystem.h:215
#define WAVE_FORMAT_1S08
Definition: mmsystem.h:207
#define WAVE_FORMAT_4M16
Definition: mmsystem.h:216
#define WAVE_FORMAT_1S16
Definition: mmsystem.h:209
#define WAVE_FORMAT_4M08
Definition: mmsystem.h:214
#define WAVE_FORMAT_4S16
Definition: mmsystem.h:217
#define WAVE_FORMAT_1M16
Definition: mmsystem.h:208
#define WAVE_FORMAT_2S16
Definition: mmsystem.h:213
#define TIMERR_NOCANDO
Definition: mmsystem.h:419
unsigned int UINT
Definition: ndis.h:50
uint32_t DWORD_PTR
Definition: typedefs.h:65
#define ZeroMemory
Definition: winbase.h:1712
UINT WINAPI waveOutGetDevCapsA(UINT_PTR uDeviceID, LPWAVEOUTCAPSA lpCaps, UINT uSize)
Definition: winmm.c:2145
UINT WINAPI waveOutGetNumDevs(void)
Definition: winmm.c:2137
#define WAVE_FORMAT_48S16
Definition: winmm_test.h:23
#define WAVE_FORMAT_48M16
Definition: winmm_test.h:22
#define WAVE_FORMAT_96S08
Definition: winmm_test.h:25
#define WAVE_FORMAT_96M16
Definition: winmm_test.h:26
#define WAVE_FORMAT_96S16
Definition: winmm_test.h:27
#define WAVE_FORMAT_48M08
Definition: winmm_test.h:20
#define WAVE_FORMAT_48S08
Definition: winmm_test.h:21
#define WAVE_FORMAT_96M08
Definition: winmm_test.h:24

Referenced by IDirectSound8_IDirectSound8_Initialize(), IDirectSound8_IDirectSound_Initialize(), and IDirectSound_IDirectSound_Initialize().

◆ DirectSoundDevice_Release()

ULONG DirectSoundDevice_Release ( DirectSoundDevice device)

Definition at line 1216 of file dsound.c.

1217{
1218 HRESULT hr;
1220 TRACE("(%p) ref was %u\n", device, ref + 1);
1221 if (!ref) {
1222 int i;
1223 timeKillEvent(device->timerID);
1225
1226 /* The kill event should have allowed the timer process to expire
1227 * but try to grab the lock just in case. Can't hold lock because
1228 * IDirectSoundBufferImpl_Destroy also grabs the lock */
1229 RtlAcquireResourceShared(&(device->buffer_list_lock), TRUE);
1230 RtlReleaseResource(&(device->buffer_list_lock));
1231
1232 /* It is allowed to release this object even when buffers are playing */
1233 if (device->buffers) {
1234 WARN("%d secondary buffers not released\n", device->nrofbuffers);
1235 for( i=0;i<device->nrofbuffers;i++)
1237 }
1238
1239 if (device->primary) {
1240 WARN("primary buffer not released\n");
1242 }
1243
1245 if (hr != DS_OK)
1246 WARN("DSOUND_PrimaryDestroy failed\n");
1247
1248 if (device->driver)
1249 IDsDriver_Close(device->driver);
1250
1251 if (device->drvdesc.dwFlags & DSDDESC_DOMMSYSTEMOPEN)
1252 waveOutClose(device->hwo);
1253
1254 if (device->driver)
1255 IDsDriver_Release(device->driver);
1256
1257 DSOUND_renderer[device->drvdesc.dnDevNode] = NULL;
1258
1259 HeapFree(GetProcessHeap(), 0, device->tmp_buffer);
1260 HeapFree(GetProcessHeap(), 0, device->mix_buffer);
1261 if (device->drvdesc.dwFlags & DSDDESC_USESYSTEMMEMORY)
1262 HeapFree(GetProcessHeap(), 0, device->buffer);
1263 RtlDeleteResource(&device->buffer_list_lock);
1264 device->mixlock.DebugInfo->Spare[0] = 0;
1265 DeleteCriticalSection(&device->mixlock);
1267 TRACE("(%p) released\n", device);
1268 }
1269 return ref;
1270}
#define InterlockedDecrement
Definition: armddk.h:52
HRESULT IDirectSoundBufferImpl_Destroy(IDirectSoundBufferImpl *pdsb)
Definition: buffer.c:1137
MMRESULT WINAPI timeKillEvent(UINT wID)
Definition: time.c:370
MMRESULT WINAPI timeEndPeriod(UINT wPeriod)
Definition: time.c:446
#define IDsDriver_Close(p)
Definition: dsdriver.h:161
#define DSDDESC_DOMMSYSTEMOPEN
Definition: dsdriver.h:50
#define DSDDESC_USESYSTEMMEMORY
Definition: dsdriver.h:52
#define IDsDriver_Release(p)
Definition: dsdriver.h:157
#define IDirectSoundBuffer8_Release(p)
Definition: dsound.h:660
HRESULT DSOUND_PrimaryDestroy(DirectSoundDevice *device) DECLSPEC_HIDDEN
Definition: primary.c:321
NTSYSAPI BOOLEAN NTAPI RtlAcquireResourceShared(_In_ PRTL_RESOURCE Resource, _In_ BOOLEAN Wait)
NTSYSAPI VOID NTAPI RtlDeleteResource(_In_ PRTL_RESOURCE Resource)
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
UINT WINAPI waveOutClose(HWAVEOUT hWaveOut)
Definition: winmm.c:2257

Referenced by IDirectSoundImpl_Release().

◆ DirectSoundDevice_RemoveBuffer()

HRESULT DirectSoundDevice_RemoveBuffer ( DirectSoundDevice device,
IDirectSoundBufferImpl pDSB 
)

Definition at line 1796 of file dsound.c.

1799{
1800 int i;
1801 HRESULT hr = DS_OK;
1802
1803 TRACE("(%p, %p)\n", device, pDSB);
1804
1805 RtlAcquireResourceExclusive(&(device->buffer_list_lock), TRUE);
1806
1807 for (i = 0; i < device->nrofbuffers; i++)
1808 if (device->buffers[i] == pDSB)
1809 break;
1810
1811 if (i < device->nrofbuffers) {
1812 /* Put the last buffer of the list in the (now empty) position */
1813 device->buffers[i] = device->buffers[device->nrofbuffers - 1];
1814 device->nrofbuffers--;
1815 device->buffers = HeapReAlloc(GetProcessHeap(),0,device->buffers,sizeof(LPDIRECTSOUNDBUFFER8)*device->nrofbuffers);
1816 TRACE("buffer count is now %d\n", device->nrofbuffers);
1817 }
1818
1819 if (device->nrofbuffers == 0) {
1820 HeapFree(GetProcessHeap(),0,device->buffers);
1821 device->buffers = NULL;
1822 }
1823
1824 RtlReleaseResource(&(device->buffer_list_lock));
1825
1826 return hr;
1827}

Referenced by secondarybuffer_destroy().

◆ DirectSoundDevice_SetCooperativeLevel()

HRESULT DirectSoundDevice_SetCooperativeLevel ( DirectSoundDevice device,
HWND  hwnd,
DWORD  level 
)

Definition at line 1662 of file dsound.c.

1666{
1667 TRACE("(%p,%p,%s)\n",device,hwnd,dumpCooperativeLevel(level));
1668
1669 if (device == NULL) {
1670 WARN("not initialized\n");
1671 return DSERR_UNINITIALIZED;
1672 }
1673
1675 WARN("level=%s not fully supported\n",
1676 level==DSSCL_PRIORITY ? "DSSCL_PRIORITY" : "DSSCL_EXCLUSIVE");
1677 }
1678
1679 device->priolevel = level;
1680 return DS_OK;
1681}
const char * dumpCooperativeLevel(DWORD level)
Definition: dsound.c:92
#define DSSCL_EXCLUSIVE
Definition: dsound.h:249
GLint level
Definition: gl.h:1546
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023

Referenced by IDirectSound8_IDirectSound8_SetCooperativeLevel(), IDirectSound8_IDirectSound_SetCooperativeLevel(), and IDirectSound_IDirectSound_SetCooperativeLevel().

◆ DirectSoundDevice_SetSpeakerConfig()

HRESULT DirectSoundDevice_SetSpeakerConfig ( DirectSoundDevice device,
DWORD  config 
)

Definition at line 1722 of file dsound.c.

1725{
1726 TRACE("(%p,0x%08x)\n",device,config);
1727
1728 if (device == NULL) {
1729 WARN("not initialized\n");
1730 return DSERR_UNINITIALIZED;
1731 }
1732
1733 device->speaker_config = config;
1734 WARN("not fully functional\n");
1735 return DS_OK;
1736}
struct config_s config

Referenced by IDirectSound8_IDirectSound8_SetSpeakerConfig(), IDirectSound8_IDirectSound_SetSpeakerConfig(), and IDirectSound_IDirectSound_SetSpeakerConfig().

◆ DirectSoundDevice_VerifyCertification()

HRESULT DirectSoundDevice_VerifyCertification ( DirectSoundDevice device,
LPDWORD  pdwCertified 
)

Definition at line 1738 of file dsound.c.

1741{
1742 TRACE("(%p, %p)\n",device,pdwCertified);
1743
1744 if (device == NULL) {
1745 WARN("not initialized\n");
1746 return DSERR_UNINITIALIZED;
1747 }
1748
1749 if (device->drvcaps.dwFlags & DSCAPS_CERTIFIED)
1750 *pdwCertified = DS_CERTIFIED;
1751 else
1752 *pdwCertified = DS_UNCERTIFIED;
1753
1754 return DS_OK;
1755}
#define DS_UNCERTIFIED
Definition: dsound.h:327
#define DS_CERTIFIED
Definition: dsound.h:326

Referenced by IDirectSound8_IDirectSound8_VerifyCertification().

◆ DSOUND_Create()

HRESULT DSOUND_Create ( REFIID  riid,
LPDIRECTSOUND ppDS 
)

Definition at line 963 of file dsound.c.

966{
967 LPDIRECTSOUND8 pDS;
968 HRESULT hr;
969 TRACE("(%s, %p)\n", debugstr_guid(riid), ppDS);
970
971 if (!IsEqualIID(riid, &IID_IUnknown) &&
972 !IsEqualIID(riid, &IID_IDirectSound)) {
973 *ppDS = 0;
974 return E_NOINTERFACE;
975 }
976
977 /* Get dsound configuration */
979
981 if (hr == DS_OK) {
983 if (*ppDS)
985 else {
986 WARN("IDirectSound_IDirectSound_Create failed\n");
988 }
989 } else {
990 WARN("IDirectSoundImpl_Create failed\n");
991 *ppDS = 0;
992 }
993
994 return hr;
995}
const GUID IID_IUnknown
static ULONG WINAPI IDirectSound_IDirectSound_AddRef(LPDIRECTSOUND iface)
Definition: dsound.c:401
static HRESULT IDirectSoundImpl_Create(LPDIRECTSOUND8 *ppds)
Definition: dsound.c:287
static HRESULT IDirectSound_IDirectSound_Create(LPDIRECTSOUND8 pds, LPDIRECTSOUND *ppds)
Definition: dsound.c:515
void setup_dsound_options(void)
Definition: dsound_main.c:102
REFIID riid
Definition: atlbase.h:39
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define E_NOINTERFACE
Definition: winerror.h:2364

Referenced by DirectSoundCreate().

◆ DSOUND_Create8()

HRESULT DSOUND_Create8 ( REFIID  riid,
LPDIRECTSOUND8 ppDS 
)

Definition at line 1050 of file dsound.c.

1053{
1054 LPDIRECTSOUND8 pDS;
1055 HRESULT hr;
1056 TRACE("(%s, %p)\n", debugstr_guid(riid), ppDS);
1057
1058 if (!IsEqualIID(riid, &IID_IUnknown) &&
1059 !IsEqualIID(riid, &IID_IDirectSound) &&
1060 !IsEqualIID(riid, &IID_IDirectSound8)) {
1061 *ppDS = 0;
1062 return E_NOINTERFACE;
1063 }
1064
1065 /* Get dsound configuration */
1067
1069 if (hr == DS_OK) {
1071 if (*ppDS)
1073 else {
1074 WARN("IDirectSound8_IDirectSound8_Create failed\n");
1076 }
1077 } else {
1078 WARN("IDirectSoundImpl_Create failed\n");
1079 *ppDS = 0;
1080 }
1081
1082 return hr;
1083}
static HRESULT IDirectSound8_IDirectSound8_Create(LPDIRECTSOUND8 pds, LPDIRECTSOUND8 *ppds)
Definition: dsound.c:928
static ULONG WINAPI IDirectSound8_IDirectSound8_AddRef(LPDIRECTSOUND8 iface)
Definition: dsound.c:804

Referenced by DirectSoundCreate8(), and IDirectSoundFullDuplexImpl_Initialize().

◆ DSOUND_QueryInterface()

static HRESULT DSOUND_QueryInterface ( LPDIRECTSOUND8  iface,
REFIID  riid,
LPVOID ppobj 
)
static

Definition at line 162 of file dsound.c.

166{
168 TRACE("(%p,%s,%p)\n",This,debugstr_guid(riid),ppobj);
169
170 if (ppobj == NULL) {
171 WARN("invalid parameter\n");
172 return E_INVALIDARG;
173 }
174
176 if (!This->pUnknown) {
177 IDirectSound_IUnknown_Create(iface, &This->pUnknown);
178 if (!This->pUnknown) {
179 WARN("IDirectSound_IUnknown_Create() failed\n");
180 *ppobj = NULL;
181 return E_NOINTERFACE;
182 }
183 }
185 *ppobj = This->pUnknown;
186 return S_OK;
187 } else if (IsEqualIID(riid, &IID_IDirectSound)) {
188 if (!This->pDS) {
190 if (!This->pDS) {
191 WARN("IDirectSound_IDirectSound_Create() failed\n");
192 *ppobj = NULL;
193 return E_NOINTERFACE;
194 }
195 }
197 *ppobj = This->pDS;
198 return S_OK;
199 }
200
201 *ppobj = NULL;
202 WARN("Unknown IID %s\n",debugstr_guid(riid));
203 return E_NOINTERFACE;
204}
#define E_INVALIDARG
Definition: ddrawi.h:101
static HRESULT IDirectSound_IUnknown_Create(LPDIRECTSOUND8 pds, LPUNKNOWN *ppunk)
Definition: dsound.c:353
static ULONG WINAPI IDirectSound_IUnknown_AddRef(LPUNKNOWN iface)
Definition: dsound.c:322
#define S_OK
Definition: intsafe.h:52

Referenced by IDirectSound_IDirectSound_QueryInterface(), and IDirectSound_IUnknown_QueryInterface().

◆ DSOUND_QueryInterface8()

static HRESULT DSOUND_QueryInterface8 ( LPDIRECTSOUND8  iface,
REFIID  riid,
LPVOID ppobj 
)
static

Definition at line 206 of file dsound.c.

210{
212 TRACE("(%p,%s,%p)\n",This,debugstr_guid(riid),ppobj);
213
214 if (ppobj == NULL) {
215 WARN("invalid parameter\n");
216 return E_INVALIDARG;
217 }
218
220 if (!This->pUnknown) {
221 IDirectSound8_IUnknown_Create(iface, &This->pUnknown);
222 if (!This->pUnknown) {
223 WARN("IDirectSound8_IUnknown_Create() failed\n");
224 *ppobj = NULL;
225 return E_NOINTERFACE;
226 }
227 }
229 *ppobj = This->pUnknown;
230 return S_OK;
231 } else if (IsEqualIID(riid, &IID_IDirectSound)) {
232 if (!This->pDS) {
234 if (!This->pDS) {
235 WARN("IDirectSound8_IDirectSound_Create() failed\n");
236 *ppobj = NULL;
237 return E_NOINTERFACE;
238 }
239 }
241 *ppobj = This->pDS;
242 return S_OK;
243 } else if (IsEqualIID(riid, &IID_IDirectSound8)) {
244 if (!This->pDS8) {
246 if (!This->pDS8) {
247 WARN("IDirectSound8_IDirectSound8_Create() failed\n");
248 *ppobj = NULL;
249 return E_NOINTERFACE;
250 }
251 }
253 *ppobj = This->pDS8;
254 return S_OK;
255 }
256
257 *ppobj = NULL;
258 WARN("Unknown IID %s\n",debugstr_guid(riid));
259 return E_NOINTERFACE;
260}
static ULONG WINAPI IDirectSound8_IDirectSound_AddRef(LPDIRECTSOUND iface)
Definition: dsound.c:642
static ULONG WINAPI IDirectSound8_IUnknown_AddRef(LPUNKNOWN iface)
Definition: dsound.c:563
static HRESULT IDirectSound8_IUnknown_Create(LPDIRECTSOUND8 pds, LPUNKNOWN *ppunk)
Definition: dsound.c:594
static HRESULT IDirectSound8_IDirectSound_Create(LPDIRECTSOUND8 pds, LPDIRECTSOUND *ppds)
Definition: dsound.c:756

Referenced by IDirectSound8_IDirectSound8_QueryInterface(), IDirectSound8_IDirectSound_QueryInterface(), and IDirectSound8_IUnknown_QueryInterface().

◆ dumpCooperativeLevel()

const char * dumpCooperativeLevel ( DWORD  level)

Definition at line 92 of file dsound.c.

93{
94#define LE(x) case x: return #x
95 switch (level) {
100 }
101#undef LE
102 return wine_dbg_sprintf("Unknown(%08x)", level);
103}
#define LE(x)
const char * wine_dbg_sprintf(const char *format,...)
Definition: compat.c:296
#define DSSCL_WRITEPRIMARY
Definition: dsound.h:250

Referenced by DirectSoundDevice_SetCooperativeLevel(), IDirectSound8_IDirectSound8_SetCooperativeLevel(), IDirectSound8_IDirectSound_SetCooperativeLevel(), IDirectSound_IDirectSound_SetCooperativeLevel(), and IDirectSoundFullDuplex_IDirectSound8_SetCooperativeLevel().

◆ IDirectSound8_IDirectSound8_AddRef()

static ULONG WINAPI IDirectSound8_IDirectSound8_AddRef ( LPDIRECTSOUND8  iface)
static

Definition at line 804 of file dsound.c.

806{
809 TRACE("(%p) ref was %d\n", This, ref - 1);
810 return ref;
811}

Referenced by DSOUND_Create8(), and DSOUND_QueryInterface8().

◆ IDirectSound8_IDirectSound8_Compact()

static HRESULT WINAPI IDirectSound8_IDirectSound8_Compact ( LPDIRECTSOUND8  iface)
static

Definition at line 868 of file dsound.c.

870{
872 TRACE("(%p)\n", This);
873 return DirectSoundDevice_Compact(((IDirectSoundImpl *)This->pds)->device);
874}
HRESULT DirectSoundDevice_Compact(DirectSoundDevice *device)
Definition: dsound.c:1683

◆ IDirectSound8_IDirectSound8_Create()

static HRESULT IDirectSound8_IDirectSound8_Create ( LPDIRECTSOUND8  pds,
LPDIRECTSOUND8 ppds 
)
static

Definition at line 928 of file dsound.c.

931{
933 TRACE("(%p,%p)\n",pds,ppds);
934
935 if (ppds == NULL) {
936 ERR("invalid parameter: ppds == NULL\n");
937 return DSERR_INVALIDPARAM;
938 }
939
940 if (pds == NULL) {
941 ERR("invalid parameter: pds == NULL\n");
942 *ppds = NULL;
943 return DSERR_INVALIDPARAM;
944 }
945
946 pdsds = HeapAlloc(GetProcessHeap(),0,sizeof(*pdsds));
947 if (pdsds == NULL) {
948 WARN("out of memory\n");
949 *ppds = NULL;
950 return DSERR_OUTOFMEMORY;
951 }
952
954 pdsds->ref = 0;
955 pdsds->pds = pds;
956
958 *ppds = (LPDIRECTSOUND8)pdsds;
959
960 return DS_OK;
961}
static ULONG IDirectSoundImpl_AddRef(LPDIRECTSOUND8 iface)
Definition: dsound.c:262
static const IDirectSound8Vtbl DirectSound8_DirectSound8_Vtbl
Definition: dsound.c:912
LPDIRECTSOUND8 pds
Definition: dsound.c:68
const IDirectSound8Vtbl * lpVtbl
Definition: dsound.c:66

Referenced by DSOUND_Create8(), and DSOUND_QueryInterface8().

◆ IDirectSound8_IDirectSound8_CreateSoundBuffer()

static HRESULT WINAPI IDirectSound8_IDirectSound8_CreateSoundBuffer ( LPDIRECTSOUND8  iface,
LPCDSBUFFERDESC  dsbd,
LPLPDIRECTSOUNDBUFFER  ppdsb,
LPUNKNOWN  lpunk 
)
static

Definition at line 828 of file dsound.c.

833{
835 TRACE("(%p,%p,%p,%p)\n",This,dsbd,ppdsb,lpunk);
836 return DirectSoundDevice_CreateSoundBuffer(((IDirectSoundImpl *)This->pds)->device,dsbd,ppdsb,lpunk,TRUE);
837}
HRESULT DirectSoundDevice_CreateSoundBuffer(DirectSoundDevice *device, LPCDSBUFFERDESC dsbd, LPLPDIRECTSOUNDBUFFER ppdsb, LPUNKNOWN lpunk, BOOL from8)
Definition: dsound.c:1482

◆ IDirectSound8_IDirectSound8_DuplicateSoundBuffer()

static HRESULT WINAPI IDirectSound8_IDirectSound8_DuplicateSoundBuffer ( LPDIRECTSOUND8  iface,
LPDIRECTSOUNDBUFFER  psb,
LPLPDIRECTSOUNDBUFFER  ppdsb 
)
static

Definition at line 848 of file dsound.c.

852{
854 TRACE("(%p,%p,%p)\n",This,psb,ppdsb);
855 return DirectSoundDevice_DuplicateSoundBuffer(((IDirectSoundImpl *)This->pds)->device,psb,ppdsb);
856}
HRESULT DirectSoundDevice_DuplicateSoundBuffer(DirectSoundDevice *device, LPDIRECTSOUNDBUFFER psb, LPLPDIRECTSOUNDBUFFER ppdsb)
Definition: dsound.c:1621

◆ IDirectSound8_IDirectSound8_GetCaps()

static HRESULT WINAPI IDirectSound8_IDirectSound8_GetCaps ( LPDIRECTSOUND8  iface,
LPDSCAPS  lpDSCaps 
)
static

Definition at line 839 of file dsound.c.

842{
844 TRACE("(%p,%p)\n",This,lpDSCaps);
845 return DirectSoundDevice_GetCaps(((IDirectSoundImpl *)This->pds)->device, lpDSCaps);
846}
HRESULT DirectSoundDevice_GetCaps(DirectSoundDevice *device, LPDSCAPS lpDSCaps)
Definition: dsound.c:1272

◆ IDirectSound8_IDirectSound8_GetSpeakerConfig()

static HRESULT WINAPI IDirectSound8_IDirectSound8_GetSpeakerConfig ( LPDIRECTSOUND8  iface,
LPDWORD  lpdwSpeakerConfig 
)
static

Definition at line 876 of file dsound.c.

879{
881 TRACE("(%p, %p)\n", This, lpdwSpeakerConfig);
882 return DirectSoundDevice_GetSpeakerConfig(((IDirectSoundImpl *)This->pds)->device,lpdwSpeakerConfig);
883}
HRESULT DirectSoundDevice_GetSpeakerConfig(DirectSoundDevice *device, LPDWORD lpdwSpeakerConfig)
Definition: dsound.c:1701

◆ IDirectSound8_IDirectSound8_Initialize()

static HRESULT WINAPI IDirectSound8_IDirectSound8_Initialize ( LPDIRECTSOUND8  iface,
LPCGUID  lpcGuid 
)
static

Definition at line 894 of file dsound.c.

897{
899 TRACE("(%p, %s)\n", This, debugstr_guid(lpcGuid));
900 return DirectSoundDevice_Initialize(&((IDirectSoundImpl *)This->pds)->device,lpcGuid);
901}
HRESULT DirectSoundDevice_Initialize(DirectSoundDevice **ppDevice, LPCGUID lpcGUID)
Definition: dsound.c:1326

◆ IDirectSound8_IDirectSound8_QueryInterface()

static HRESULT WINAPI IDirectSound8_IDirectSound8_QueryInterface ( LPDIRECTSOUND8  iface,
REFIID  riid,
LPVOID ppobj 
)
static

Definition at line 794 of file dsound.c.

798{
800 TRACE("(%p,%s,%p)\n",This,debugstr_guid(riid),ppobj);
801 return DSOUND_QueryInterface8(This->pds, riid, ppobj);
802}
static HRESULT DSOUND_QueryInterface8(LPDIRECTSOUND8 iface, REFIID riid, LPVOID *ppobj)
Definition: dsound.c:206

◆ IDirectSound8_IDirectSound8_Release()

static ULONG WINAPI IDirectSound8_IDirectSound8_Release ( LPDIRECTSOUND8  iface)
static

Definition at line 813 of file dsound.c.

815{
818 TRACE("(%p) ref was %d\n", This, ref + 1);
819 if (!ref) {
820 ((IDirectSoundImpl*)This->pds)->pDS8 = NULL;
823 TRACE("(%p) released\n", This);
824 }
825 return ref;
826}
static ULONG IDirectSoundImpl_Release(LPDIRECTSOUND8 iface)
Definition: dsound.c:271

◆ IDirectSound8_IDirectSound8_SetCooperativeLevel()

static HRESULT WINAPI IDirectSound8_IDirectSound8_SetCooperativeLevel ( LPDIRECTSOUND8  iface,
HWND  hwnd,
DWORD  level 
)
static

Definition at line 858 of file dsound.c.

862{
864 TRACE("(%p,%p,%s)\n",This,hwnd,dumpCooperativeLevel(level));
866}
HRESULT DirectSoundDevice_SetCooperativeLevel(DirectSoundDevice *device, HWND hwnd, DWORD level)
Definition: dsound.c:1662

◆ IDirectSound8_IDirectSound8_SetSpeakerConfig()

static HRESULT WINAPI IDirectSound8_IDirectSound8_SetSpeakerConfig ( LPDIRECTSOUND8  iface,
DWORD  config 
)
static

Definition at line 885 of file dsound.c.

888{
890 TRACE("(%p,0x%08x)\n",This,config);
892}
HRESULT DirectSoundDevice_SetSpeakerConfig(DirectSoundDevice *device, DWORD config)
Definition: dsound.c:1722

◆ IDirectSound8_IDirectSound8_VerifyCertification()

static HRESULT WINAPI IDirectSound8_IDirectSound8_VerifyCertification ( LPDIRECTSOUND8  iface,
LPDWORD  pdwCertified 
)
static

Definition at line 903 of file dsound.c.

906{
908 TRACE("(%p, %p)\n", This, pdwCertified);
909 return DirectSoundDevice_VerifyCertification(((IDirectSoundImpl *)This->pds)->device,pdwCertified);
910}
HRESULT DirectSoundDevice_VerifyCertification(DirectSoundDevice *device, LPDWORD pdwCertified)
Definition: dsound.c:1738

◆ IDirectSound8_IDirectSound_AddRef()

static ULONG WINAPI IDirectSound8_IDirectSound_AddRef ( LPDIRECTSOUND  iface)
static

Definition at line 642 of file dsound.c.

644{
647 TRACE("(%p) ref was %d\n", This, ref - 1);
648 return ref;
649}

Referenced by DSOUND_QueryInterface8().

◆ IDirectSound8_IDirectSound_Compact()

static HRESULT WINAPI IDirectSound8_IDirectSound_Compact ( LPDIRECTSOUND  iface)
static

Definition at line 706 of file dsound.c.

708{
710 TRACE("(%p)\n", This);
711 return DirectSoundDevice_Compact(((IDirectSoundImpl *)This->pds)->device);
712}

◆ IDirectSound8_IDirectSound_Create()

static HRESULT IDirectSound8_IDirectSound_Create ( LPDIRECTSOUND8  pds,
LPDIRECTSOUND ppds 
)
static

Definition at line 756 of file dsound.c.

759{
761 TRACE("(%p,%p)\n",pds,ppds);
762
763 if (ppds == NULL) {
764 ERR("invalid parameter: ppds == NULL\n");
765 return DSERR_INVALIDPARAM;
766 }
767
768 if (pds == NULL) {
769 ERR("invalid parameter: pds == NULL\n");
770 *ppds = NULL;
771 return DSERR_INVALIDPARAM;
772 }
773
774 pdsds = HeapAlloc(GetProcessHeap(),0,sizeof(*pdsds));
775 if (pdsds == NULL) {
776 WARN("out of memory\n");
777 *ppds = NULL;
778 return DSERR_OUTOFMEMORY;
779 }
780
782 pdsds->ref = 0;
783 pdsds->pds = pds;
784
786 *ppds = (LPDIRECTSOUND)pdsds;
787
788 return DS_OK;
789}
static const IDirectSoundVtbl DirectSound8_DirectSound_Vtbl
Definition: dsound.c:741
const IDirectSoundVtbl * lpVtbl
Definition: dsound.c:57
LPDIRECTSOUND8 pds
Definition: dsound.c:59

Referenced by DSOUND_QueryInterface8().

◆ IDirectSound8_IDirectSound_CreateSoundBuffer()

static HRESULT WINAPI IDirectSound8_IDirectSound_CreateSoundBuffer ( LPDIRECTSOUND  iface,
LPCDSBUFFERDESC  dsbd,
LPLPDIRECTSOUNDBUFFER  ppdsb,
LPUNKNOWN  lpunk 
)
static

Definition at line 666 of file dsound.c.

671{
673 TRACE("(%p,%p,%p,%p)\n",This,dsbd,ppdsb,lpunk);
674 return DirectSoundDevice_CreateSoundBuffer(((IDirectSoundImpl *)This->pds)->device,dsbd,ppdsb,lpunk,TRUE);
675}

◆ IDirectSound8_IDirectSound_DuplicateSoundBuffer()

static HRESULT WINAPI IDirectSound8_IDirectSound_DuplicateSoundBuffer ( LPDIRECTSOUND  iface,
LPDIRECTSOUNDBUFFER  psb,
LPLPDIRECTSOUNDBUFFER  ppdsb 
)
static

Definition at line 686 of file dsound.c.

690{
692 TRACE("(%p,%p,%p)\n",This,psb,ppdsb);
693 return DirectSoundDevice_DuplicateSoundBuffer(((IDirectSoundImpl *)This->pds)->device,psb,ppdsb);
694}

◆ IDirectSound8_IDirectSound_GetCaps()

static HRESULT WINAPI IDirectSound8_IDirectSound_GetCaps ( LPDIRECTSOUND  iface,
LPDSCAPS  lpDSCaps 
)
static

Definition at line 677 of file dsound.c.

680{
682 TRACE("(%p,%p)\n",This,lpDSCaps);
683 return DirectSoundDevice_GetCaps(((IDirectSoundImpl *)This->pds)->device, lpDSCaps);
684}

◆ IDirectSound8_IDirectSound_GetSpeakerConfig()

static HRESULT WINAPI IDirectSound8_IDirectSound_GetSpeakerConfig ( LPDIRECTSOUND  iface,
LPDWORD  lpdwSpeakerConfig 
)
static

Definition at line 714 of file dsound.c.

717{
719 TRACE("(%p, %p)\n", This, lpdwSpeakerConfig);
720 return DirectSoundDevice_GetSpeakerConfig(((IDirectSoundImpl *)This->pds)->device,lpdwSpeakerConfig);
721}

◆ IDirectSound8_IDirectSound_Initialize()

static HRESULT WINAPI IDirectSound8_IDirectSound_Initialize ( LPDIRECTSOUND  iface,
LPCGUID  lpcGuid 
)
static

Definition at line 732 of file dsound.c.

735{
737 TRACE("(%p, %s)\n", This, debugstr_guid(lpcGuid));
738 return DirectSoundDevice_Initialize(&((IDirectSoundImpl *)This->pds)->device,lpcGuid);
739}

◆ IDirectSound8_IDirectSound_QueryInterface()

static HRESULT WINAPI IDirectSound8_IDirectSound_QueryInterface ( LPDIRECTSOUND  iface,
REFIID  riid,
LPVOID ppobj 
)
static

Definition at line 632 of file dsound.c.

636{
638 TRACE("(%p,%s,%p)\n",This,debugstr_guid(riid),ppobj);
639 return DSOUND_QueryInterface8(This->pds, riid, ppobj);
640}

◆ IDirectSound8_IDirectSound_Release()

static ULONG WINAPI IDirectSound8_IDirectSound_Release ( LPDIRECTSOUND  iface)
static

Definition at line 651 of file dsound.c.

653{
656 TRACE("(%p) ref was %d\n", This, ref + 1);
657 if (!ref) {
658 ((IDirectSoundImpl*)This->pds)->pDS = NULL;
661 TRACE("(%p) released\n", This);
662 }
663 return ref;
664}

◆ IDirectSound8_IDirectSound_SetCooperativeLevel()

static HRESULT WINAPI IDirectSound8_IDirectSound_SetCooperativeLevel ( LPDIRECTSOUND  iface,
HWND  hwnd,
DWORD  level 
)
static

Definition at line 696 of file dsound.c.

◆ IDirectSound8_IDirectSound_SetSpeakerConfig()

static HRESULT WINAPI IDirectSound8_IDirectSound_SetSpeakerConfig ( LPDIRECTSOUND  iface,
DWORD  config 
)
static

Definition at line 723 of file dsound.c.

726{
728 TRACE("(%p,0x%08x)\n",This,config);
730}

◆ IDirectSound8_IUnknown_AddRef()

static ULONG WINAPI IDirectSound8_IUnknown_AddRef ( LPUNKNOWN  iface)
static

Definition at line 563 of file dsound.c.

565{
568 TRACE("(%p) ref was %d\n", This, ref - 1);
569 return ref;
570}

Referenced by DSOUND_QueryInterface8().

◆ IDirectSound8_IUnknown_Create()

static HRESULT IDirectSound8_IUnknown_Create ( LPDIRECTSOUND8  pds,
LPUNKNOWN ppunk 
)
static

Definition at line 594 of file dsound.c.

597{
598 IDirectSound8_IUnknown * pdsunk;
599 TRACE("(%p,%p)\n",pds,ppunk);
600
601 if (ppunk == NULL) {
602 ERR("invalid parameter: ppunk == NULL\n");
603 return DSERR_INVALIDPARAM;
604 }
605
606 if (pds == NULL) {
607 ERR("invalid parameter: pds == NULL\n");
608 *ppunk = NULL;
609 return DSERR_INVALIDPARAM;
610 }
611
612 pdsunk = HeapAlloc(GetProcessHeap(),0,sizeof(*pdsunk));
613 if (pdsunk == NULL) {
614 WARN("out of memory\n");
615 *ppunk = NULL;
616 return DSERR_OUTOFMEMORY;
617 }
618
620 pdsunk->ref = 0;
621 pdsunk->pds = pds;
622
624 *ppunk = (LPUNKNOWN)pdsunk;
625
626 return DS_OK;
627}
static const IUnknownVtbl DirectSound8_Unknown_Vtbl
Definition: dsound.c:587
static LPUNKNOWN
Definition: ndr_ole.c:49
const IUnknownVtbl * lpVtbl
Definition: dsound.c:48
LPDIRECTSOUND8 pds
Definition: dsound.c:50

Referenced by DSOUND_QueryInterface8().

◆ IDirectSound8_IUnknown_QueryInterface()

static HRESULT WINAPI IDirectSound8_IUnknown_QueryInterface ( LPUNKNOWN  iface,
REFIID  riid,
LPVOID ppobj 
)
static

Definition at line 553 of file dsound.c.

557{
559 TRACE("(%p,%s,%p)\n",This,debugstr_guid(riid),ppobj);
560 return DSOUND_QueryInterface8(This->pds, riid, ppobj);
561}

◆ IDirectSound8_IUnknown_Release()

static ULONG WINAPI IDirectSound8_IUnknown_Release ( LPUNKNOWN  iface)
static

Definition at line 572 of file dsound.c.

574{
577 TRACE("(%p) ref was %d\n", This, ref + 1);
578 if (!ref) {
579 ((IDirectSoundImpl*)This->pds)->pUnknown = NULL;
582 TRACE("(%p) released\n", This);
583 }
584 return ref;
585}

◆ IDirectSound_IDirectSound_AddRef()

static ULONG WINAPI IDirectSound_IDirectSound_AddRef ( LPDIRECTSOUND  iface)
static

Definition at line 401 of file dsound.c.

403{
406 TRACE("(%p) ref was %d\n", This, ref - 1);
407 return ref;
408}

Referenced by DSOUND_Create(), and DSOUND_QueryInterface().

◆ IDirectSound_IDirectSound_Compact()

static HRESULT WINAPI IDirectSound_IDirectSound_Compact ( LPDIRECTSOUND  iface)
static

Definition at line 465 of file dsound.c.

467{
469 TRACE("(%p)\n", This);
470 return DirectSoundDevice_Compact(((IDirectSoundImpl *)This->pds)->device);
471}

◆ IDirectSound_IDirectSound_Create()

static HRESULT IDirectSound_IDirectSound_Create ( LPDIRECTSOUND8  pds,
LPDIRECTSOUND ppds 
)
static

Definition at line 515 of file dsound.c.

518{
520 TRACE("(%p,%p)\n",pds,ppds);
521
522 if (ppds == NULL) {
523 ERR("invalid parameter: ppds == NULL\n");
524 return DSERR_INVALIDPARAM;
525 }
526
527 if (pds == NULL) {
528 ERR("invalid parameter: pds == NULL\n");
529 *ppds = NULL;
530 return DSERR_INVALIDPARAM;
531 }
532
533 pdsds = HeapAlloc(GetProcessHeap(),0,sizeof(*pdsds));
534 if (pdsds == NULL) {
535 WARN("out of memory\n");
536 *ppds = NULL;
537 return DSERR_OUTOFMEMORY;
538 }
539
541 pdsds->ref = 0;
542 pdsds->pds = pds;
543
545 *ppds = (LPDIRECTSOUND)pdsds;
546
547 return DS_OK;
548}
static const IDirectSoundVtbl DirectSound_DirectSound_Vtbl
Definition: dsound.c:500
LPDIRECTSOUND8 pds
Definition: dsound.c:39
const IDirectSoundVtbl * lpVtbl
Definition: dsound.c:37

Referenced by DSOUND_Create(), and DSOUND_QueryInterface().

◆ IDirectSound_IDirectSound_CreateSoundBuffer()

static HRESULT WINAPI IDirectSound_IDirectSound_CreateSoundBuffer ( LPDIRECTSOUND  iface,
LPCDSBUFFERDESC  dsbd,
LPLPDIRECTSOUNDBUFFER  ppdsb,
LPUNKNOWN  lpunk 
)
static

Definition at line 425 of file dsound.c.

430{
432 TRACE("(%p,%p,%p,%p)\n",This,dsbd,ppdsb,lpunk);
433 return DirectSoundDevice_CreateSoundBuffer(((IDirectSoundImpl *)This->pds)->device,dsbd,ppdsb,lpunk,FALSE);
434}

◆ IDirectSound_IDirectSound_DuplicateSoundBuffer()

static HRESULT WINAPI IDirectSound_IDirectSound_DuplicateSoundBuffer ( LPDIRECTSOUND  iface,
LPDIRECTSOUNDBUFFER  psb,
LPLPDIRECTSOUNDBUFFER  ppdsb 
)
static

Definition at line 445 of file dsound.c.

449{
451 TRACE("(%p,%p,%p)\n",This,psb,ppdsb);
452 return DirectSoundDevice_DuplicateSoundBuffer(((IDirectSoundImpl *)This->pds)->device,psb,ppdsb);
453}

◆ IDirectSound_IDirectSound_GetCaps()

static HRESULT WINAPI IDirectSound_IDirectSound_GetCaps ( LPDIRECTSOUND  iface,
LPDSCAPS  lpDSCaps 
)
static

Definition at line 436 of file dsound.c.

439{
441 TRACE("(%p,%p)\n",This,lpDSCaps);
442 return DirectSoundDevice_GetCaps(((IDirectSoundImpl *)This->pds)->device, lpDSCaps);
443}

◆ IDirectSound_IDirectSound_GetSpeakerConfig()

static HRESULT WINAPI IDirectSound_IDirectSound_GetSpeakerConfig ( LPDIRECTSOUND  iface,
LPDWORD  lpdwSpeakerConfig 
)
static

Definition at line 473 of file dsound.c.

476{
478 TRACE("(%p, %p)\n", This, lpdwSpeakerConfig);
479 return DirectSoundDevice_GetSpeakerConfig(((IDirectSoundImpl *)This->pds)->device,lpdwSpeakerConfig);
480}

◆ IDirectSound_IDirectSound_Initialize()

static HRESULT WINAPI IDirectSound_IDirectSound_Initialize ( LPDIRECTSOUND  iface,
LPCGUID  lpcGuid 
)
static

Definition at line 491 of file dsound.c.

494{
496 TRACE("(%p, %s)\n", This, debugstr_guid(lpcGuid));
497 return DirectSoundDevice_Initialize(&((IDirectSoundImpl *)This->pds)->device,lpcGuid);
498}

◆ IDirectSound_IDirectSound_QueryInterface()

static HRESULT WINAPI IDirectSound_IDirectSound_QueryInterface ( LPDIRECTSOUND  iface,
REFIID  riid,
LPVOID ppobj 
)
static

Definition at line 391 of file dsound.c.

395{
397 TRACE("(%p,%s,%p)\n",This,debugstr_guid(riid),ppobj);
398 return DSOUND_QueryInterface(This->pds, riid, ppobj);
399}
static HRESULT DSOUND_QueryInterface(LPDIRECTSOUND8 iface, REFIID riid, LPVOID *ppobj)
Definition: dsound.c:162

◆ IDirectSound_IDirectSound_Release()

static ULONG WINAPI IDirectSound_IDirectSound_Release ( LPDIRECTSOUND  iface)
static

Definition at line 410 of file dsound.c.

412{
415 TRACE("(%p) ref was %d\n", This, ref + 1);
416 if (!ref) {
417 ((IDirectSoundImpl*)This->pds)->pDS = NULL;
420 TRACE("(%p) released\n", This);
421 }
422 return ref;
423}

◆ IDirectSound_IDirectSound_SetCooperativeLevel()

static HRESULT WINAPI IDirectSound_IDirectSound_SetCooperativeLevel ( LPDIRECTSOUND  iface,
HWND  hwnd,
DWORD  level 
)
static

Definition at line 455 of file dsound.c.

◆ IDirectSound_IDirectSound_SetSpeakerConfig()

static HRESULT WINAPI IDirectSound_IDirectSound_SetSpeakerConfig ( LPDIRECTSOUND  iface,
DWORD  config 
)
static

Definition at line 482 of file dsound.c.

485{
487 TRACE("(%p,0x%08x)\n",This,config);
489}

◆ IDirectSound_IUnknown_AddRef()

static ULONG WINAPI IDirectSound_IUnknown_AddRef ( LPUNKNOWN  iface)
static

Definition at line 322 of file dsound.c.

324{
327 TRACE("(%p) ref was %d\n", This, ref - 1);
328 return ref;
329}

Referenced by DSOUND_QueryInterface().

◆ IDirectSound_IUnknown_Create()

static HRESULT IDirectSound_IUnknown_Create ( LPDIRECTSOUND8  pds,
LPUNKNOWN ppunk 
)
static

Definition at line 353 of file dsound.c.

356{
357 IDirectSound_IUnknown * pdsunk;
358 TRACE("(%p,%p)\n",pds,ppunk);
359
360 if (ppunk == NULL) {
361 ERR("invalid parameter: ppunk == NULL\n");
362 return DSERR_INVALIDPARAM;
363 }
364
365 if (pds == NULL) {
366 ERR("invalid parameter: pds == NULL\n");
367 *ppunk = NULL;
368 return DSERR_INVALIDPARAM;
369 }
370
371 pdsunk = HeapAlloc(GetProcessHeap(),0,sizeof(*pdsunk));
372 if (pdsunk == NULL) {
373 WARN("out of memory\n");
374 *ppunk = NULL;
375 return DSERR_OUTOFMEMORY;
376 }
377
379 pdsunk->ref = 0;
380 pdsunk->pds = pds;
381
383 *ppunk = (LPUNKNOWN)pdsunk;
384
385 return DS_OK;
386}
static const IUnknownVtbl DirectSound_Unknown_Vtbl
Definition: dsound.c:346
const IUnknownVtbl * lpVtbl
Definition: dsound.c:29
LPDIRECTSOUND8 pds
Definition: dsound.c:31

Referenced by DSOUND_QueryInterface().

◆ IDirectSound_IUnknown_QueryInterface()

static HRESULT WINAPI IDirectSound_IUnknown_QueryInterface ( LPUNKNOWN  iface,
REFIID  riid,
LPVOID ppobj 
)
static

Definition at line 312 of file dsound.c.

316{
318 TRACE("(%p,%s,%p)\n",This,debugstr_guid(riid),ppobj);
319 return DSOUND_QueryInterface(This->pds, riid, ppobj);
320}

◆ IDirectSound_IUnknown_Release()

static ULONG WINAPI IDirectSound_IUnknown_Release ( LPUNKNOWN  iface)
static

Definition at line 331 of file dsound.c.

333{
336 TRACE("(%p) ref was %d\n", This, ref + 1);
337 if (!ref) {
338 ((IDirectSoundImpl*)This->pds)->pUnknown = NULL;
341 TRACE("(%p) released\n", This);
342 }
343 return ref;
344}

◆ IDirectSoundImpl_AddRef()

static ULONG IDirectSoundImpl_AddRef ( LPDIRECTSOUND8  iface)
static

◆ IDirectSoundImpl_Create()

static HRESULT IDirectSoundImpl_Create ( LPDIRECTSOUND8 ppds)
static

Definition at line 287 of file dsound.c.

289{
290 IDirectSoundImpl* pDS;
291 TRACE("(%p)\n",ppDS);
292
293 /* Allocate memory */
295 if (pDS == NULL) {
296 WARN("out of memory\n");
297 *ppDS = NULL;
298 return DSERR_OUTOFMEMORY;
299 }
300
301 pDS->ref = 0;
302 pDS->device = NULL;
303
304 *ppDS = (LPDIRECTSOUND8)pDS;
305
306 return DS_OK;
307}
DirectSoundDevice * device
Definition: dsound.c:81

Referenced by DSOUND_Create(), and DSOUND_Create8().

◆ IDirectSoundImpl_Release()

static ULONG IDirectSoundImpl_Release ( LPDIRECTSOUND8  iface)
static

Definition at line 271 of file dsound.c.

273{
276 TRACE("(%p) ref was %d\n", This, ref + 1);
277
278 if (!ref) {
279 if (This->device)
282 TRACE("(%p) released\n", This);
283 }
284 return ref;
285}
ULONG DirectSoundDevice_Release(DirectSoundDevice *device)
Definition: dsound.c:1216

Referenced by IDirectSound8_IDirectSound8_Release(), IDirectSound8_IDirectSound_Release(), IDirectSound8_IUnknown_Release(), IDirectSound_IDirectSound_Release(), and IDirectSound_IUnknown_Release().

Variable Documentation

◆ DirectSound8_DirectSound8_Vtbl

const IDirectSound8Vtbl DirectSound8_DirectSound8_Vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI IDirectSound8_IDirectSound8_SetSpeakerConfig(LPDIRECTSOUND8 iface, DWORD config)
Definition: dsound.c:885
static HRESULT WINAPI IDirectSound8_IDirectSound8_CreateSoundBuffer(LPDIRECTSOUND8 iface, LPCDSBUFFERDESC dsbd, LPLPDIRECTSOUNDBUFFER ppdsb, LPUNKNOWN lpunk)
Definition: dsound.c:828
static HRESULT WINAPI IDirectSound8_IDirectSound8_DuplicateSoundBuffer(LPDIRECTSOUND8 iface, LPDIRECTSOUNDBUFFER psb, LPLPDIRECTSOUNDBUFFER ppdsb)
Definition: dsound.c:848
static HRESULT WINAPI IDirectSound8_IDirectSound8_Compact(LPDIRECTSOUND8 iface)
Definition: dsound.c:868
static HRESULT WINAPI IDirectSound8_IDirectSound8_QueryInterface(LPDIRECTSOUND8 iface, REFIID riid, LPVOID *ppobj)
Definition: dsound.c:794
static HRESULT WINAPI IDirectSound8_IDirectSound8_GetSpeakerConfig(LPDIRECTSOUND8 iface, LPDWORD lpdwSpeakerConfig)
Definition: dsound.c:876
static ULONG WINAPI IDirectSound8_IDirectSound8_Release(LPDIRECTSOUND8 iface)
Definition: dsound.c:813
static HRESULT WINAPI IDirectSound8_IDirectSound8_SetCooperativeLevel(LPDIRECTSOUND8 iface, HWND hwnd, DWORD level)
Definition: dsound.c:858
static HRESULT WINAPI IDirectSound8_IDirectSound8_Initialize(LPDIRECTSOUND8 iface, LPCGUID lpcGuid)
Definition: dsound.c:894
static HRESULT WINAPI IDirectSound8_IDirectSound8_GetCaps(LPDIRECTSOUND8 iface, LPDSCAPS lpDSCaps)
Definition: dsound.c:839
static HRESULT WINAPI IDirectSound8_IDirectSound8_VerifyCertification(LPDIRECTSOUND8 iface, LPDWORD pdwCertified)
Definition: dsound.c:903

Definition at line 912 of file dsound.c.

Referenced by IDirectSound8_IDirectSound8_Create().

◆ DirectSound8_DirectSound_Vtbl

const IDirectSoundVtbl DirectSound8_DirectSound_Vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI IDirectSound8_IDirectSound_GetSpeakerConfig(LPDIRECTSOUND iface, LPDWORD lpdwSpeakerConfig)
Definition: dsound.c:714
static HRESULT WINAPI IDirectSound8_IDirectSound_Compact(LPDIRECTSOUND iface)
Definition: dsound.c:706
static HRESULT WINAPI IDirectSound8_IDirectSound_QueryInterface(LPDIRECTSOUND iface, REFIID riid, LPVOID *ppobj)
Definition: dsound.c:632
static HRESULT WINAPI IDirectSound8_IDirectSound_Initialize(LPDIRECTSOUND iface, LPCGUID lpcGuid)
Definition: dsound.c:732
static HRESULT WINAPI IDirectSound8_IDirectSound_SetCooperativeLevel(LPDIRECTSOUND iface, HWND hwnd, DWORD level)
Definition: dsound.c:696
static HRESULT WINAPI IDirectSound8_IDirectSound_SetSpeakerConfig(LPDIRECTSOUND iface, DWORD config)
Definition: dsound.c:723
static HRESULT WINAPI IDirectSound8_IDirectSound_DuplicateSoundBuffer(LPDIRECTSOUND iface, LPDIRECTSOUNDBUFFER psb, LPLPDIRECTSOUNDBUFFER ppdsb)
Definition: dsound.c:686
static ULONG WINAPI IDirectSound8_IDirectSound_Release(LPDIRECTSOUND iface)
Definition: dsound.c:651
static HRESULT WINAPI IDirectSound8_IDirectSound_GetCaps(LPDIRECTSOUND iface, LPDSCAPS lpDSCaps)
Definition: dsound.c:677
static HRESULT WINAPI IDirectSound8_IDirectSound_CreateSoundBuffer(LPDIRECTSOUND iface, LPCDSBUFFERDESC dsbd, LPLPDIRECTSOUNDBUFFER ppdsb, LPUNKNOWN lpunk)
Definition: dsound.c:666

Definition at line 741 of file dsound.c.

Referenced by IDirectSound8_IDirectSound_Create().

◆ DirectSound8_Unknown_Vtbl

const IUnknownVtbl DirectSound8_Unknown_Vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI IDirectSound8_IUnknown_QueryInterface(LPUNKNOWN iface, REFIID riid, LPVOID *ppobj)
Definition: dsound.c:553
static ULONG WINAPI IDirectSound8_IUnknown_Release(LPUNKNOWN iface)
Definition: dsound.c:572

Definition at line 587 of file dsound.c.

Referenced by IDirectSound8_IUnknown_Create().

◆ DirectSound_DirectSound_Vtbl

const IDirectSoundVtbl DirectSound_DirectSound_Vtbl
static
Initial value:
=
{
}
static ULONG WINAPI IDirectSound_IDirectSound_Release(LPDIRECTSOUND iface)
Definition: dsound.c:410
static HRESULT WINAPI IDirectSound_IDirectSound_Initialize(LPDIRECTSOUND iface, LPCGUID lpcGuid)
Definition: dsound.c:491
static HRESULT WINAPI IDirectSound_IDirectSound_SetSpeakerConfig(LPDIRECTSOUND iface, DWORD config)
Definition: dsound.c:482
static HRESULT WINAPI IDirectSound_IDirectSound_QueryInterface(LPDIRECTSOUND iface, REFIID riid, LPVOID *ppobj)
Definition: dsound.c:391
static HRESULT WINAPI IDirectSound_IDirectSound_Compact(LPDIRECTSOUND iface)
Definition: dsound.c:465
static HRESULT WINAPI IDirectSound_IDirectSound_DuplicateSoundBuffer(LPDIRECTSOUND iface, LPDIRECTSOUNDBUFFER psb, LPLPDIRECTSOUNDBUFFER ppdsb)
Definition: dsound.c:445
static HRESULT WINAPI IDirectSound_IDirectSound_SetCooperativeLevel(LPDIRECTSOUND iface, HWND hwnd, DWORD level)
Definition: dsound.c:455
static HRESULT WINAPI IDirectSound_IDirectSound_GetCaps(LPDIRECTSOUND iface, LPDSCAPS lpDSCaps)
Definition: dsound.c:436
static HRESULT WINAPI IDirectSound_IDirectSound_GetSpeakerConfig(LPDIRECTSOUND iface, LPDWORD lpdwSpeakerConfig)
Definition: dsound.c:473
static HRESULT WINAPI IDirectSound_IDirectSound_CreateSoundBuffer(LPDIRECTSOUND iface, LPCDSBUFFERDESC dsbd, LPLPDIRECTSOUNDBUFFER ppdsb, LPUNKNOWN lpunk)
Definition: dsound.c:425

Definition at line 500 of file dsound.c.

Referenced by IDirectSound_IDirectSound_Create().

◆ DirectSound_Unknown_Vtbl

const IUnknownVtbl DirectSound_Unknown_Vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI IDirectSound_IUnknown_QueryInterface(LPUNKNOWN iface, REFIID riid, LPVOID *ppobj)
Definition: dsound.c:312
static ULONG WINAPI IDirectSound_IUnknown_Release(LPUNKNOWN iface)
Definition: dsound.c:331

Definition at line 346 of file dsound.c.

Referenced by IDirectSound_IUnknown_Create().