ReactOS  0.4.13-dev-482-ge57f103
directsound.c File Reference
#include "precomp.h"
Include dependency graph for directsound.c:

Go to the source code of this file.

Classes

struct  CDirectSoundImpl
 

Typedefs

typedef struct CDirectSoundImplLPCDirectSoundImpl
 

Functions

HRESULT WINAPI IDirectSound8_fnQueryInterface (LPDIRECTSOUND8 iface, REFIID riid, LPVOID *ppobj)
 
ULONG WINAPI IDirectSound8_fnAddRef (LPDIRECTSOUND8 iface)
 
ULONG WINAPI IDirectSound8_fnRelease (LPDIRECTSOUND8 iface)
 
HRESULT WINAPI IDirectSound8_fnCreateSoundBuffer (LPDIRECTSOUND8 iface, LPCDSBUFFERDESC lpcDSBufferDesc, LPLPDIRECTSOUNDBUFFER lplpDirectSoundBuffer, IUnknown FAR *pUnkOuter)
 
HRESULT WINAPI IDirectSound8_fnGetCaps (LPDIRECTSOUND8 iface, LPDSCAPS lpDSCaps)
 
HRESULT WINAPI IDirectSound8_fnDuplicateSoundBuffer (LPDIRECTSOUND8 iface, LPDIRECTSOUNDBUFFER lpDsbOriginal, LPLPDIRECTSOUNDBUFFER lplpDsbDuplicate)
 
HRESULT WINAPI IDirectSound8_fnSetCooperativeLevel (LPDIRECTSOUND8 iface, HWND hwnd, DWORD dwLevel)
 
HRESULT WINAPI IDirectSound8_fnCompact (LPDIRECTSOUND8 iface)
 
HRESULT WINAPI IDirectSound8_fnGetSpeakerConfig (LPDIRECTSOUND8 iface, LPDWORD pdwSpeakerConfig)
 
HRESULT WINAPI IDirectSound8_fnSetSpeakerConfig (LPDIRECTSOUND8 iface, DWORD dwSpeakerConfig)
 
HRESULT WINAPI IDirectSound8_fnInitialize (LPDIRECTSOUND8 iface, LPCGUID pcGuidDevice)
 
HRESULT WINAPI IDirectSound8_fnVerifyCertification (LPDIRECTSOUND8 iface, LPDWORD pdwCertified)
 
HRESULT InternalDirectSoundCreate (LPCGUID lpcGUID, LPDIRECTSOUND8 *ppDS, IUnknown *pUnkOuter, BOOL bDirectSound8)
 
HRESULT CALLBACK NewDirectSound (IUnknown *pUnkOuter, REFIID riid, LPVOID *ppvObject)
 
HRESULT WINAPI DirectSoundCreate (LPCGUID lpcGUID, LPDIRECTSOUND *ppDS, IUnknown *pUnkOuter)
 
HRESULT WINAPI DirectSoundCreate8 (LPCGUID lpcGUID, LPDIRECTSOUND8 *ppDS, IUnknown *pUnkOuter)
 

Variables

static IDirectSound8Vtbl vt_DirectSound8
 

Typedef Documentation

◆ LPCDirectSoundImpl

Function Documentation

◆ DirectSoundCreate()

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

Definition at line 494 of file directsound.c.

498 {
499  return InternalDirectSoundCreate(lpcGUID, (LPDIRECTSOUND8*)ppDS, pUnkOuter, FALSE);
500 }
HRESULT InternalDirectSoundCreate(LPCGUID lpcGUID, LPDIRECTSOUND8 *ppDS, IUnknown *pUnkOuter, BOOL bDirectSound8)
Definition: directsound.c:400
struct IDirectSound8 * LPDIRECTSOUND8
Definition: dsound.h:73

◆ DirectSoundCreate8()

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

Definition at line 504 of file directsound.c.

508 {
509  return InternalDirectSoundCreate(lpcGUID, ppDS, pUnkOuter, TRUE);
510 }
#define TRUE
Definition: types.h:120
HRESULT InternalDirectSoundCreate(LPCGUID lpcGUID, LPDIRECTSOUND8 *ppDS, IUnknown *pUnkOuter, BOOL bDirectSound8)
Definition: directsound.c:400

Referenced by DSEnumCallback(), DSoundRender_create(), getCurrentChannelConfig(), IDirectMusic8Impl_SetDirectSound(), and setCurrentChannelConfig().

◆ IDirectSound8_fnAddRef()

ULONG WINAPI IDirectSound8_fnAddRef ( LPDIRECTSOUND8  iface)

Definition at line 55 of file directsound.c.

57 {
58  ULONG ref;
60 
61  ref = InterlockedIncrement(&This->ref);
62 
63  return ref;
64 }
struct CDirectSoundImpl * LPCDirectSoundImpl
Definition: send.c:47
GLenum GLint ref
Definition: glext.h:6028
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
#define InterlockedIncrement
Definition: armddk.h:53
unsigned int ULONG
Definition: retypes.h:1

◆ IDirectSound8_fnCompact()

HRESULT WINAPI IDirectSound8_fnCompact ( LPDIRECTSOUND8  iface)

Definition at line 249 of file directsound.c.

251 {
253 
254  if (!This->bInitialized)
255  {
256  /* object not yet initialized */
257  return DSERR_UNINITIALIZED;
258  }
259 
260  if (This->dwLevel != DSSCL_PRIORITY)
261  {
262  /* needs priority level */
263  return DSERR_PRIOLEVELNEEDED;
264  }
265 
266  /* done */
267  return DS_OK;
268 }
struct CDirectSoundImpl * LPCDirectSoundImpl
#define DSERR_UNINITIALIZED
Definition: dsound.h:133
#define DSERR_PRIOLEVELNEEDED
Definition: dsound.h:124
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
#define DS_OK
Definition: dsound.h:116
#define DSSCL_PRIORITY
Definition: dsound.h:248

◆ IDirectSound8_fnCreateSoundBuffer()

HRESULT WINAPI IDirectSound8_fnCreateSoundBuffer ( LPDIRECTSOUND8  iface,
LPCDSBUFFERDESC  lpcDSBufferDesc,
LPLPDIRECTSOUNDBUFFER  lplpDirectSoundBuffer,
IUnknown FAR pUnkOuter 
)

Definition at line 86 of file directsound.c.

91 {
92  HRESULT hResult;
94 
95  if (!This->bInitialized)
96  {
97  /* object not yet initialized */
98  return DSERR_UNINITIALIZED;
99  }
100 
101  if (!lpcDSBufferDesc || !lplpDirectSoundBuffer || pUnkOuter != NULL)
102  {
103  DPRINT("Invalid parameter %p %p %p\n", lpcDSBufferDesc, lplpDirectSoundBuffer, pUnkOuter);
104  return DSERR_INVALIDPARAM;
105  }
106 
107  /* check buffer description */
108  if ((lpcDSBufferDesc->dwSize != sizeof(DSBUFFERDESC) && lpcDSBufferDesc->dwSize != sizeof(DSBUFFERDESC1)) || lpcDSBufferDesc->dwReserved != 0)
109  {
110  DPRINT("Invalid buffer description size %u expected %u dwReserved %u\n", lpcDSBufferDesc->dwSize, sizeof(DSBUFFERDESC1), lpcDSBufferDesc->dwReserved);
111  return DSERR_INVALIDPARAM;
112  }
113 
114  DPRINT("This %p dwFlags %x dwBufferBytes %u lpwfxFormat %p dwSize %u\n", This, lpcDSBufferDesc->dwFlags, lpcDSBufferDesc->dwBufferBytes, lpcDSBufferDesc->lpwfxFormat, lpcDSBufferDesc->dwSize);
115 
116  if (lpcDSBufferDesc->dwFlags & DSBCAPS_PRIMARYBUFFER)
117  {
118  if (lpcDSBufferDesc->lpwfxFormat != NULL)
119  {
120  /* format must be null for primary sound buffer */
121  return DSERR_INVALIDPARAM;
122  }
123 
124  if (lpcDSBufferDesc->dwBufferBytes != 0)
125  {
126  /* buffer size must be zero for primary sound buffer */
127  return DSERR_INVALIDPARAM;
128  }
129 
130  if (This->PrimaryBuffer)
131  {
132  /* primary buffer already exists */
133  IDirectSoundBuffer8_AddRef(This->PrimaryBuffer);
134  *lplpDirectSoundBuffer = (LPDIRECTSOUNDBUFFER)This->PrimaryBuffer;
135  return S_OK;
136  }
137 
138  hResult = NewPrimarySoundBuffer((LPLPDIRECTSOUNDBUFFER8)lplpDirectSoundBuffer, This->Filter, This->dwLevel, lpcDSBufferDesc->dwFlags);
139  if (SUCCEEDED(hResult))
140  {
141  /* store primary buffer */
142  This->PrimaryBuffer = (LPDIRECTSOUNDBUFFER8)*lplpDirectSoundBuffer;
143  }
144  return hResult;
145  }
146  else
147  {
148  if (lpcDSBufferDesc->lpwfxFormat == NULL)
149  {
150  /* format must not be null */
151  return DSERR_INVALIDPARAM;
152  }
153 
154  if (lpcDSBufferDesc->dwBufferBytes < DSBSIZE_MIN || lpcDSBufferDesc->dwBufferBytes > DSBSIZE_MAX)
155  {
156  /* buffer size must be within bounds for secondary sound buffer*/
157  return DSERR_INVALIDPARAM;
158  }
159 
160  if (!This->PrimaryBuffer)
161  {
162  hResult = NewPrimarySoundBuffer((LPLPDIRECTSOUNDBUFFER8)lplpDirectSoundBuffer, This->Filter, This->dwLevel, lpcDSBufferDesc->dwFlags);
163  if (SUCCEEDED(hResult))
164  {
165  /* store primary buffer */
166  This->PrimaryBuffer = (LPDIRECTSOUNDBUFFER8)*lplpDirectSoundBuffer;
167  }
168  else
169  {
170  DPRINT("Failed to create primary buffer with %x\n", hResult);
171  return hResult;
172  }
173 
174  }
175 
176  ASSERT(This->PrimaryBuffer);
177 
178  DPRINT("This %p wFormatTag %x nChannels %u nSamplesPerSec %u nAvgBytesPerSec %u NBlockAlign %u wBitsPerSample %u cbSize %u\n",
179  This, lpcDSBufferDesc->lpwfxFormat->wFormatTag, lpcDSBufferDesc->lpwfxFormat->nChannels, lpcDSBufferDesc->lpwfxFormat->nSamplesPerSec, lpcDSBufferDesc->lpwfxFormat->nAvgBytesPerSec, lpcDSBufferDesc->lpwfxFormat->nBlockAlign, lpcDSBufferDesc->lpwfxFormat->wBitsPerSample, lpcDSBufferDesc->lpwfxFormat->cbSize);
180 
181  hResult = NewSecondarySoundBuffer((LPLPDIRECTSOUNDBUFFER8)lplpDirectSoundBuffer, This->Filter, This->dwLevel, lpcDSBufferDesc, This->PrimaryBuffer);
182  return hResult;
183  }
184 }
struct IDirectSoundBuffer8 * LPDIRECTSOUNDBUFFER8
Definition: dsound.h:79
struct CDirectSoundImpl * LPCDirectSoundImpl
#define DSERR_UNINITIALIZED
Definition: dsound.h:133
DWORD nAvgBytesPerSec
Definition: mmreg.h:81
WORD nChannels
Definition: mmreg.h:79
#define IDirectSoundBuffer8_AddRef(p)
Definition: dsound.h:659
HRESULT NewSecondarySoundBuffer(LPDIRECTSOUNDBUFFER8 *OutBuffer, LPFILTERINFO Filter, DWORD dwLevel, LPCDSBUFFERDESC lpcDSBufferDesc, LPDIRECTSOUNDBUFFER8 PrimaryBuffer)
Definition: secondary.c:611
HRESULT NewPrimarySoundBuffer(LPDIRECTSOUNDBUFFER8 *OutBuffer, LPFILTERINFO Filter, DWORD dwLevel, DWORD dwFlags)
Definition: primary.c:768
struct IDirectSoundBuffer8 ** LPLPDIRECTSOUNDBUFFER8
Definition: dsound.h:79
#define DSERR_INVALIDPARAM
Definition: dsound.h:121
#define DSBSIZE_MAX
Definition: dsound.h:225
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
#define DSBSIZE_MIN
Definition: dsound.h:224
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
#define DSBCAPS_PRIMARYBUFFER
Definition: dsound.h:206
DWORD dwSize
Definition: dsound.h:288
LONG HRESULT
Definition: typedefs.h:77
LPWAVEFORMATEX lpwfxFormat
Definition: dsound.h:292
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
WORD wFormatTag
Definition: mmreg.h:78
struct IDirectSoundBuffer * LPDIRECTSOUNDBUFFER
Definition: dsound.h:76
#define S_OK
Definition: intsafe.h:59
WORD cbSize
Definition: mmreg.h:84
DWORD dwReserved
Definition: dsound.h:291
DWORD nSamplesPerSec
Definition: mmreg.h:80
WORD nBlockAlign
Definition: mmreg.h:82
WORD wBitsPerSample
Definition: mmreg.h:83
DWORD dwBufferBytes
Definition: dsound.h:290
DWORD dwFlags
Definition: dsound.h:289
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ IDirectSound8_fnDuplicateSoundBuffer()

HRESULT WINAPI IDirectSound8_fnDuplicateSoundBuffer ( LPDIRECTSOUND8  iface,
LPDIRECTSOUNDBUFFER  lpDsbOriginal,
LPLPDIRECTSOUNDBUFFER  lplpDsbDuplicate 
)

Definition at line 218 of file directsound.c.

222 {
224  return DSERR_OUTOFMEMORY;
225 }
#define DSERR_OUTOFMEMORY
Definition: dsound.h:125
#define UNIMPLEMENTED
Definition: debug.h:114

◆ IDirectSound8_fnGetCaps()

HRESULT WINAPI IDirectSound8_fnGetCaps ( LPDIRECTSOUND8  iface,
LPDSCAPS  lpDSCaps 
)

Definition at line 188 of file directsound.c.

191 {
193 
194  if (!This->bInitialized)
195  {
196  /* object not yet initialized */
197  return DSERR_UNINITIALIZED;
198  }
199 
200  if (!lpDSCaps)
201  {
202  /* object not yet initialized */
203  return DSERR_INVALIDPARAM;
204  }
205 
206  if (lpDSCaps->dwSize != sizeof(DSCAPS))
207  {
208  /* object not yet initialized */
209  return DSERR_INVALIDPARAM;
210  }
211 
213  return DSERR_GENERIC;
214 }
#define DSERR_GENERIC
Definition: dsound.h:123
DWORD dwSize
Definition: dsound.h:162
struct CDirectSoundImpl * LPCDirectSoundImpl
#define DSERR_UNINITIALIZED
Definition: dsound.h:133
#define DSERR_INVALIDPARAM
Definition: dsound.h:121
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
#define UNIMPLEMENTED
Definition: debug.h:114

◆ IDirectSound8_fnGetSpeakerConfig()

HRESULT WINAPI IDirectSound8_fnGetSpeakerConfig ( LPDIRECTSOUND8  iface,
LPDWORD  pdwSpeakerConfig 
)

Definition at line 272 of file directsound.c.

275 {
277 
278  if (!This->bInitialized)
279  {
280  /* object not yet initialized */
281  return DSERR_UNINITIALIZED;
282  }
283 
284 
286  return DSERR_INVALIDPARAM;
287 }
struct CDirectSoundImpl * LPCDirectSoundImpl
#define DSERR_UNINITIALIZED
Definition: dsound.h:133
#define DSERR_INVALIDPARAM
Definition: dsound.h:121
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
#define UNIMPLEMENTED
Definition: debug.h:114

◆ IDirectSound8_fnInitialize()

HRESULT WINAPI IDirectSound8_fnInitialize ( LPDIRECTSOUND8  iface,
LPCGUID  pcGuidDevice 
)

Definition at line 302 of file directsound.c.

305 {
306  GUID DeviceGuid;
307  LPOLESTR pGuidStr;
308  HRESULT hr;
310 
311  if (!RootInfo)
312  {
314  }
315 
316  /* sanity check */
317  ASSERT(RootInfo);
318 
319  if (This->bInitialized)
320  {
321  /* object has already been initialized */
323  }
324 
325  /* fixme mutual exclusion */
326 
327  if (pcGuidDevice == NULL || IsEqualGUID(pcGuidDevice, &GUID_NULL))
328  {
329  /* use default playback device id */
330  pcGuidDevice = &DSDEVID_DefaultPlayback;
331  }
332 
333  if (IsEqualIID(pcGuidDevice, &DSDEVID_DefaultCapture) || IsEqualIID(pcGuidDevice, &DSDEVID_DefaultVoiceCapture))
334  {
335  /* this has to be a winetest */
336  return DSERR_NODRIVER;
337  }
338 
339  /* now verify the guid */
340  if (GetDeviceID(pcGuidDevice, &DeviceGuid) != DS_OK)
341  {
342  if (SUCCEEDED(StringFromIID(pcGuidDevice, &pGuidStr)))
343  {
344  DPRINT("IDirectSound8_fnInitialize: Unknown GUID %ws\n", pGuidStr);
345  CoTaskMemFree(pGuidStr);
346  }
347  return DSERR_INVALIDPARAM;
348  }
349 
350  hr = FindDeviceByGuid(&DeviceGuid, &This->Filter);
351 
352  if (SUCCEEDED(hr))
353  {
354  This->bInitialized = TRUE;
355  return DS_OK;
356  }
357 
358  DPRINT("Failed to find device\n");
359  return DSERR_INVALIDPARAM;
360 }
HRESULT EnumAudioDeviceInterfaces(LPFILTERINFO *OutRootInfo)
Definition: devicelist.c:384
#define TRUE
Definition: types.h:120
HRESULT WINAPI GetDeviceID(LPCGUID pGuidSrc, LPGUID pGuidDest)
Definition: dsound.c:53
struct CDirectSoundImpl * LPCDirectSoundImpl
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:422
BOOL FindDeviceByGuid(LPCGUID pGuidSrc, LPFILTERINFO *Filter)
Definition: devicelist.c:470
HRESULT hr
Definition: shlfolder.c:183
#define DSERR_ALREADYINITIALIZED
Definition: dsound.h:129
static LPOLESTR
Definition: stg_prop.c:27
#define DSERR_INVALIDPARAM
Definition: dsound.h:121
smooth NULL
Definition: ftsmooth.c:416
#define DSERR_NODRIVER
Definition: dsound.h:128
void DPRINT(...)
Definition: polytest.cpp:61
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
_Check_return_ HRESULT WINAPI StringFromIID(_In_ REFIID rclsid, _Outptr_ LPOLESTR *lplpsz)
#define DS_OK
Definition: dsound.h:116
LONG HRESULT
Definition: typedefs.h:77
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define GUID_NULL
Definition: ks.h:106
LPFILTERINFO RootInfo
Definition: dsound.c:13
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:90
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ IDirectSound8_fnQueryInterface()

HRESULT WINAPI IDirectSound8_fnQueryInterface ( LPDIRECTSOUND8  iface,
REFIID  riid,
LPVOID ppobj 
)

Definition at line 28 of file directsound.c.

32 {
33  LPOLESTR pStr;
35 
36  if ((IsEqualIID(riid, &IID_IDirectSound) && This->bDirectSound8 == FALSE) ||
37  (IsEqualIID(riid, &IID_IDirectSound8) && This->bDirectSound8 != FALSE) ||
39  {
40  *ppobj = (LPVOID)&This->lpVtbl;
42  return S_OK;
43  }
44 
45  if (SUCCEEDED(StringFromIID(riid, &pStr)))
46  {
47  DPRINT("No Interface for class %s\n", pStr);
48  CoTaskMemFree(pStr);
49  }
50  return E_NOINTERFACE;
51 }
#define E_NOINTERFACE
Definition: winerror.h:2364
struct CDirectSoundImpl * LPCDirectSoundImpl
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:422
REFIID riid
Definition: precomp.h:44
static LPOLESTR
Definition: stg_prop.c:27
void DPRINT(...)
Definition: polytest.cpp:61
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
_Check_return_ HRESULT WINAPI StringFromIID(_In_ REFIID rclsid, _Outptr_ LPOLESTR *lplpsz)
const GUID IID_IUnknown
#define LPVOID
Definition: nt_native.h:45
#define S_OK
Definition: intsafe.h:59
#define InterlockedIncrement
Definition: armddk.h:53
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:90
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ IDirectSound8_fnRelease()

ULONG WINAPI IDirectSound8_fnRelease ( LPDIRECTSOUND8  iface)

Definition at line 68 of file directsound.c.

70 {
71  ULONG ref;
73 
74  ref = InterlockedDecrement(&(This->ref));
75 
76  if (!ref)
77  {
79  }
80 
81  return ref;
82 }
struct CDirectSoundImpl * LPCDirectSoundImpl
Definition: send.c:47
GLenum GLint ref
Definition: glext.h:6028
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
#define GetProcessHeap()
Definition: compat.h:395
#define InterlockedDecrement
Definition: armddk.h:52
unsigned int ULONG
Definition: retypes.h:1
#define HeapFree(x, y, z)
Definition: compat.h:394

◆ IDirectSound8_fnSetCooperativeLevel()

HRESULT WINAPI IDirectSound8_fnSetCooperativeLevel ( LPDIRECTSOUND8  iface,
HWND  hwnd,
DWORD  dwLevel 
)

Definition at line 229 of file directsound.c.

233 {
235 
236  if (!This->bInitialized)
237  {
238  /* object not yet initialized */
239  return DSERR_UNINITIALIZED;
240  }
241 
242  /* store cooperation level */
243  This->dwLevel = dwLevel;
244  return DS_OK;
245 }
struct CDirectSoundImpl * LPCDirectSoundImpl
#define DSERR_UNINITIALIZED
Definition: dsound.h:133
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
#define DS_OK
Definition: dsound.h:116

◆ IDirectSound8_fnSetSpeakerConfig()

HRESULT WINAPI IDirectSound8_fnSetSpeakerConfig ( LPDIRECTSOUND8  iface,
DWORD  dwSpeakerConfig 
)

Definition at line 291 of file directsound.c.

294 {
296  return DSERR_INVALIDPARAM;
297 }
#define DSERR_INVALIDPARAM
Definition: dsound.h:121
#define UNIMPLEMENTED
Definition: debug.h:114

◆ IDirectSound8_fnVerifyCertification()

HRESULT WINAPI IDirectSound8_fnVerifyCertification ( LPDIRECTSOUND8  iface,
LPDWORD  pdwCertified 
)

Definition at line 364 of file directsound.c.

367 {
369 
370  if (!This->bInitialized)
371  {
372  /* object not yet initialized */
373  return DSERR_UNINITIALIZED;
374  }
375 
377  return DS_CERTIFIED;
378 }
struct CDirectSoundImpl * LPCDirectSoundImpl
#define DSERR_UNINITIALIZED
Definition: dsound.h:133
#define DS_CERTIFIED
Definition: dsound.h:326
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
#define UNIMPLEMENTED
Definition: debug.h:114

◆ InternalDirectSoundCreate()

HRESULT InternalDirectSoundCreate ( LPCGUID  lpcGUID,
LPDIRECTSOUND8 ppDS,
IUnknown pUnkOuter,
BOOL  bDirectSound8 
)

Definition at line 400 of file directsound.c.

405 {
407  HRESULT hr;
408 
409  if (!ppDS || pUnkOuter != NULL)
410  {
411  /* invalid parameter passed */
412  return DSERR_INVALIDPARAM;
413  }
414 
415  /* allocate CDirectSoundImpl struct */
417  if (!This)
418  {
419  /* not enough memory */
420  return DSERR_OUTOFMEMORY;
421  }
422 
423  /* initialize IDirectSound object */
424  This->ref = 1;
425  This->bDirectSound8 = bDirectSound8;
426  This->lpVtbl = &vt_DirectSound8;
427 
428 
429  /* initialize direct sound interface */
430  hr = IDirectSound8_Initialize((LPDIRECTSOUND8)&This->lpVtbl, lpcGUID);
431 
432  /* check for success */
433  if (!SUCCEEDED(hr))
434  {
435  /* failed */
436  DPRINT("Failed to initialize DirectSound object with %x\n", hr);
438  return hr;
439  }
440 
441  /* store result */
442  *ppDS = (LPDIRECTSOUND8)&This->lpVtbl;
443  DPRINT("DirectSound object %p\n", *ppDS);
444  return DS_OK;
445 }
HRESULT hr
Definition: shlfolder.c:183
static IDirectSound8Vtbl vt_DirectSound8
Definition: directsound.c:380
#define IDirectSound8_Release(p)
Definition: dsound.h:507
#define DSERR_OUTOFMEMORY
Definition: dsound.h:125
#define DSERR_INVALIDPARAM
Definition: dsound.h:121
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
#define DS_OK
Definition: dsound.h:116
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG HRESULT
Definition: typedefs.h:77
struct IDirectSound8 * LPDIRECTSOUND8
Definition: dsound.h:73
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define SUCCEEDED(hr)
Definition: intsafe.h:57
#define IDirectSound8_Initialize(p, a)
Definition: dsound.h:516

Referenced by DirectSoundCreate(), and DirectSoundCreate8().

◆ NewDirectSound()

HRESULT CALLBACK NewDirectSound ( IUnknown pUnkOuter,
REFIID  riid,
LPVOID ppvObject 
)

Definition at line 449 of file directsound.c.

453 {
454  LPOLESTR pStr;
456 
457  /* check param */
458  if (!ppvObject)
459  {
460  /* invalid param */
461  return E_INVALIDARG;
462  }
463 
464  /* check requested interface */
465  if (!IsEqualIID(riid, &IID_IUnknown) && !IsEqualIID(riid, &IID_IDirectSound) && !IsEqualIID(riid, &IID_IDirectSound8))
466  {
467  *ppvObject = 0;
468  StringFromIID(riid, &pStr);
469  DPRINT("KsPropertySet does not support Interface %ws\n", pStr);
470  CoTaskMemFree(pStr);
471  return E_NOINTERFACE;
472  }
473 
474  /* allocate CDirectSoundCaptureImpl struct */
476  if (!This)
477  {
478  /* not enough memory */
479  return DSERR_OUTOFMEMORY;
480  }
481 
482  /* initialize object */
483  This->ref = 1;
484  This->lpVtbl = &vt_DirectSound8;
485  This->bInitialized = FALSE;
486  *ppvObject = (LPVOID)&This->lpVtbl;
487 
488  return S_OK;
489 }
#define E_NOINTERFACE
Definition: winerror.h:2364
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:422
REFIID riid
Definition: precomp.h:44
static IDirectSound8Vtbl vt_DirectSound8
Definition: directsound.c:380
static LPOLESTR
Definition: stg_prop.c:27
#define DSERR_OUTOFMEMORY
Definition: dsound.h:125
#define E_INVALIDARG
Definition: ddrawi.h:101
void DPRINT(...)
Definition: polytest.cpp:61
_Check_return_ HRESULT WINAPI StringFromIID(_In_ REFIID rclsid, _Outptr_ LPOLESTR *lplpsz)
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
const GUID IID_IUnknown
#define LPVOID
Definition: nt_native.h:45
REFIID LPVOID * ppvObject
Definition: precomp.h:44
#define S_OK
Definition: intsafe.h:59
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:90

Variable Documentation

◆ vt_DirectSound8

IDirectSound8Vtbl vt_DirectSound8
static
Initial value:
=
{
}
HRESULT WINAPI IDirectSound8_fnSetCooperativeLevel(LPDIRECTSOUND8 iface, HWND hwnd, DWORD dwLevel)
Definition: directsound.c:229
ULONG WINAPI IDirectSound8_fnAddRef(LPDIRECTSOUND8 iface)
Definition: directsound.c:55
HRESULT WINAPI IDirectSound8_fnGetSpeakerConfig(LPDIRECTSOUND8 iface, LPDWORD pdwSpeakerConfig)
Definition: directsound.c:272
HRESULT WINAPI IDirectSound8_fnCreateSoundBuffer(LPDIRECTSOUND8 iface, LPCDSBUFFERDESC lpcDSBufferDesc, LPLPDIRECTSOUNDBUFFER lplpDirectSoundBuffer, IUnknown FAR *pUnkOuter)
Definition: directsound.c:86
HRESULT WINAPI IDirectSound8_fnGetCaps(LPDIRECTSOUND8 iface, LPDSCAPS lpDSCaps)
Definition: directsound.c:188
HRESULT WINAPI IDirectSound8_fnDuplicateSoundBuffer(LPDIRECTSOUND8 iface, LPDIRECTSOUNDBUFFER lpDsbOriginal, LPLPDIRECTSOUNDBUFFER lplpDsbDuplicate)
Definition: directsound.c:218
HRESULT WINAPI IDirectSound8_fnSetSpeakerConfig(LPDIRECTSOUND8 iface, DWORD dwSpeakerConfig)
Definition: directsound.c:291
HRESULT WINAPI IDirectSound8_fnInitialize(LPDIRECTSOUND8 iface, LPCGUID pcGuidDevice)
Definition: directsound.c:302
HRESULT WINAPI IDirectSound8_fnVerifyCertification(LPDIRECTSOUND8 iface, LPDWORD pdwCertified)
Definition: directsound.c:364
HRESULT WINAPI IDirectSound8_fnCompact(LPDIRECTSOUND8 iface)
Definition: directsound.c:249
HRESULT WINAPI IDirectSound8_fnQueryInterface(LPDIRECTSOUND8 iface, REFIID riid, LPVOID *ppobj)
Definition: directsound.c:28
ULONG WINAPI IDirectSound8_fnRelease(LPDIRECTSOUND8 iface)
Definition: directsound.c:68

Definition at line 380 of file directsound.c.

Referenced by InternalDirectSoundCreate(), and NewDirectSound().