Commit abde7d0a authored by Robert Reif's avatar Robert Reif Committed by Alexandre Julliard

Reversed relationship between buffers and notifies.

Fixed notify reuse bug. Minor documentation and error message cleanup.
parent bcfff87b
...@@ -54,13 +54,21 @@ static HRESULT WINAPI IDirectSoundNotifyImpl_QueryInterface( ...@@ -54,13 +54,21 @@ static HRESULT WINAPI IDirectSoundNotifyImpl_QueryInterface(
LPDIRECTSOUNDNOTIFY iface,REFIID riid,LPVOID *ppobj LPDIRECTSOUNDNOTIFY iface,REFIID riid,LPVOID *ppobj
) { ) {
ICOM_THIS(IDirectSoundNotifyImpl,iface); ICOM_THIS(IDirectSoundNotifyImpl,iface);
TRACE("(%p,%s,%p)\n",This,debugstr_guid(riid),ppobj); TRACE("(%p,%s,%p)\n",This,debugstr_guid(riid),ppobj);
if (This->dsb)
return IDirectSoundBuffer8_QueryInterface((LPDIRECTSOUNDBUFFER8)This->dsb, riid, ppobj); if ( IsEqualGUID(riid, &IID_IUnknown) ||
else if (This->dscb) IsEqualGUID(riid, &IID_IDirectSoundNotify) ||
return IDirectSoundCaptureBuffer8_QueryInterface((LPDIRECTSOUNDCAPTUREBUFFER8)This->dscb, riid, ppobj); IsEqualGUID(riid, &IID_IDirectSoundNotify8) ) {
return DSERR_GENERIC; IDirectSoundNotify_AddRef(iface);
*ppobj = This;
return DS_OK;
}
FIXME( "Unknown IID %s\n", debugstr_guid( riid ) );
*ppobj = 0;
return E_NOINTERFACE;
} }
static ULONG WINAPI IDirectSoundNotifyImpl_AddRef(LPDIRECTSOUNDNOTIFY iface) { static ULONG WINAPI IDirectSoundNotifyImpl_AddRef(LPDIRECTSOUNDNOTIFY iface) {
...@@ -80,11 +88,12 @@ static ULONG WINAPI IDirectSoundNotifyImpl_Release(LPDIRECTSOUNDNOTIFY iface) { ...@@ -80,11 +88,12 @@ static ULONG WINAPI IDirectSoundNotifyImpl_Release(LPDIRECTSOUNDNOTIFY iface) {
TRACE("(%p) ref was %ld\n", This, This->ref); TRACE("(%p) ref was %ld\n", This, This->ref);
ref = InterlockedDecrement(&(This->ref)); ref = InterlockedDecrement(&(This->ref));
if (!ref) { /* FIXME: A notification should be a part of a buffer rather than pointed
if (This->dsb) * to from a buffer. Hence the -1 ref count */
IDirectSoundBuffer8_Release((LPDIRECTSOUNDBUFFER8)This->dsb); if (ref == -1) {
else if (This->dscb) if (This->notifies != NULL)
IDirectSoundCaptureBuffer8_Release((LPDIRECTSOUNDCAPTUREBUFFER8)This->dscb); HeapFree(GetProcessHeap(), 0, This->notifies);
HeapFree(GetProcessHeap(),0,This); HeapFree(GetProcessHeap(),0,This);
return 0; return 0;
} }
...@@ -95,33 +104,31 @@ static HRESULT WINAPI IDirectSoundNotifyImpl_SetNotificationPositions( ...@@ -95,33 +104,31 @@ static HRESULT WINAPI IDirectSoundNotifyImpl_SetNotificationPositions(
LPDIRECTSOUNDNOTIFY iface,DWORD howmuch,LPCDSBPOSITIONNOTIFY notify LPDIRECTSOUNDNOTIFY iface,DWORD howmuch,LPCDSBPOSITIONNOTIFY notify
) { ) {
ICOM_THIS(IDirectSoundNotifyImpl,iface); ICOM_THIS(IDirectSoundNotifyImpl,iface);
int i; TRACE("(%p,0x%08lx,%p)\n",This,howmuch,notify);
if (!notify) {
WARN("invalid parameter\n");
return DSERR_INVALIDPARAM;
}
if (TRACE_ON(dsound)) { if (TRACE_ON(dsound)) {
TRACE("(%p,0x%08lx,%p)\n",This,howmuch,notify); int i;
for (i=0;i<howmuch;i++) for (i=0;i<howmuch;i++)
TRACE("notify at %ld to 0x%08lx\n", TRACE("notify at %ld to 0x%08lx\n",
notify[i].dwOffset,(DWORD)notify[i].hEventNotify); notify[i].dwOffset,(DWORD)notify[i].hEventNotify);
} }
if (This->dsb) {
This->dsb->notifies = HeapReAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,This->dsb->notifies,(This->dsb->nrofnotifies+howmuch)*sizeof(DSBPOSITIONNOTIFY)); if (This->hwnotify) {
memcpy( This->dsb->notifies+This->dsb->nrofnotifies, return IDsDriverNotify_SetNotificationPositions(This->hwnotify, howmuch, notify);
notify, }
howmuch*sizeof(DSBPOSITIONNOTIFY) else {
); /* Make an internal copy of the caller-supplied array.
This->dsb->nrofnotifies+=howmuch; * Replace the existing copy if one is already present. */
} else if (This->dscb) { This->notifies = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
TRACE("notifies = %p, nrofnotifies = %d\n", This->dscb->notifies, This->dscb->nrofnotifies); This->notifies, howmuch * sizeof(DSBPOSITIONNOTIFY));
This->dscb->notifies = HeapReAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,This->dscb->notifies,(This->dscb->nrofnotifies+howmuch)*sizeof(DSBPOSITIONNOTIFY)); memcpy(This->notifies, notify, howmuch * sizeof(DSBPOSITIONNOTIFY));
memcpy( This->dscb->notifies+This->dscb->nrofnotifies, This->nrofnotifies = howmuch;
notify,
howmuch*sizeof(DSBPOSITIONNOTIFY)
);
This->dscb->nrofnotifies+=howmuch;
TRACE("notifies = %p, nrofnotifies = %d\n", This->dscb->notifies, This->dscb->nrofnotifies);
} }
else
return DSERR_INVALIDPARAM;
return S_OK; return S_OK;
} }
...@@ -816,17 +823,23 @@ static HRESULT WINAPI IDirectSoundBufferImpl_QueryInterface( ...@@ -816,17 +823,23 @@ static HRESULT WINAPI IDirectSoundBufferImpl_QueryInterface(
TRACE("(%p,%s,%p)\n",This,debugstr_guid(riid),ppobj); TRACE("(%p,%s,%p)\n",This,debugstr_guid(riid),ppobj);
if ( IsEqualGUID( &IID_IDirectSoundNotify, riid ) ) { if ( IsEqualGUID( &IID_IDirectSoundNotify, riid ) ||
IDirectSoundNotifyImpl *dsn; IsEqualGUID( &IID_IDirectSoundNotify8, riid ) ) {
if (!This->notify) {
dsn = (IDirectSoundNotifyImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(*dsn)); This->notify = (IDirectSoundNotifyImpl*)HeapAlloc(GetProcessHeap(),
dsn->ref = 1; HEAP_ZERO_MEMORY,sizeof(*This->notify));
dsn->dsb = This; if (This->notify) {
dsn->dscb = 0; This->notify->ref = 0; /* release when ref == -1 */
IDirectSoundBuffer8_AddRef(iface); This->notify->lpVtbl = &dsnvt;
dsn->lpVtbl = &dsnvt; }
*ppobj = (LPVOID)dsn; }
return S_OK; if (This->notify) {
IDirectSoundNotify_AddRef((LPDIRECTSOUNDNOTIFY)This->notify);
*ppobj = (LPVOID)This->notify;
return S_OK;
}
*ppobj = NULL;
return E_FAIL;
} }
if ( IsEqualGUID( &IID_IDirectSound3DBuffer, riid ) ) { if ( IsEqualGUID( &IID_IDirectSound3DBuffer, riid ) ) {
...@@ -837,6 +850,7 @@ static HRESULT WINAPI IDirectSoundBufferImpl_QueryInterface( ...@@ -837,6 +850,7 @@ static HRESULT WINAPI IDirectSoundBufferImpl_QueryInterface(
IDirectSound3DBuffer_AddRef((LPDIRECTSOUND3DBUFFER)*ppobj); IDirectSound3DBuffer_AddRef((LPDIRECTSOUND3DBUFFER)*ppobj);
return S_OK; return S_OK;
} }
*ppobj = NULL;
return E_FAIL; return E_FAIL;
} }
...@@ -854,6 +868,7 @@ static HRESULT WINAPI IDirectSoundBufferImpl_QueryInterface( ...@@ -854,6 +868,7 @@ static HRESULT WINAPI IDirectSoundBufferImpl_QueryInterface(
IKsPropertySet_AddRef((LPKSPROPERTYSET)*ppobj); IKsPropertySet_AddRef((LPKSPROPERTYSET)*ppobj);
return S_OK; return S_OK;
} }
*ppobj = NULL;
return E_FAIL; return E_FAIL;
} }
......
...@@ -82,12 +82,24 @@ IDirectSoundCaptureImpl* dsound_capture = NULL; ...@@ -82,12 +82,24 @@ IDirectSoundCaptureImpl* dsound_capture = NULL;
/*************************************************************************** /***************************************************************************
* DirectSoundCaptureCreate [DSOUND.6] * DirectSoundCaptureCreate [DSOUND.6]
* *
* Create and initialize a DirectSoundCapture interface * Create and initialize a DirectSoundCapture interface.
*
* PARAMS
* lpcGUID [I] Address of the GUID that identifies the sound capture device.
* lplpDSC [O] Address of a variable to receive the interface pointer.
* pUnkOuter [I] Must be NULL.
* *
* RETURNS * RETURNS
* Success: DS_OK * Success: DS_OK
* Failure: DSERR_NOAGGREGATION, DSERR_ALLOCATED, DSERR_INVALIDPARAM, * Failure: DSERR_NOAGGREGATION, DSERR_ALLOCATED, DSERR_INVALIDPARAM,
* DSERR_OUTOFMEMORY * DSERR_OUTOFMEMORY
*
* NOTES
* lpcGUID must be one of the values returned from DirectSoundCaptureEnumerate
* or NULL for the default device or DSDEVID_DefaultCapture or
* DSDEVID_DefaultVoiceCapture.
*
* DSERR_ALLOCATED is returned for sound devices that do not support full duplex.
*/ */
HRESULT WINAPI HRESULT WINAPI
DirectSoundCaptureCreate8( DirectSoundCaptureCreate8(
...@@ -99,7 +111,7 @@ DirectSoundCaptureCreate8( ...@@ -99,7 +111,7 @@ DirectSoundCaptureCreate8(
TRACE("(%s,%p,%p)\n", debugstr_guid(lpcGUID), lplpDSC, pUnkOuter); TRACE("(%s,%p,%p)\n", debugstr_guid(lpcGUID), lplpDSC, pUnkOuter);
if ( pUnkOuter ) { if ( pUnkOuter ) {
WARN("pUnkOuter != 0\n"); WARN("invalid parameter: pUnkOuter != NULL\n");
return DSERR_NOAGGREGATION; return DSERR_NOAGGREGATION;
} }
...@@ -141,7 +153,11 @@ DirectSoundCaptureCreate8( ...@@ -141,7 +153,11 @@ DirectSoundCaptureCreate8(
/*************************************************************************** /***************************************************************************
* DirectSoundCaptureEnumerateA [DSOUND.7] * DirectSoundCaptureEnumerateA [DSOUND.7]
* *
* Enumerate all DirectSound drivers installed in the system * Enumerate all DirectSound drivers installed in the system.
*
* PARAMS
* lpDSEnumCallback [I] Address of callback function.
* lpContext [I] Address of user defined context passed to callback function.
* *
* RETURNS * RETURNS
* Success: DS_OK * Success: DS_OK
...@@ -160,7 +176,7 @@ DirectSoundCaptureEnumerateA( ...@@ -160,7 +176,7 @@ DirectSoundCaptureEnumerateA(
TRACE("(%p,%p)\n", lpDSEnumCallback, lpContext ); TRACE("(%p,%p)\n", lpDSEnumCallback, lpContext );
if (lpDSEnumCallback == NULL) { if (lpDSEnumCallback == NULL) {
WARN("invalid parameter\n"); WARN("invalid parameter: lpDSEnumCallback == NULL\n");
return DSERR_INVALIDPARAM; return DSERR_INVALIDPARAM;
} }
...@@ -204,7 +220,11 @@ DirectSoundCaptureEnumerateA( ...@@ -204,7 +220,11 @@ DirectSoundCaptureEnumerateA(
/*************************************************************************** /***************************************************************************
* DirectSoundCaptureEnumerateW [DSOUND.8] * DirectSoundCaptureEnumerateW [DSOUND.8]
* *
* Enumerate all DirectSound drivers installed in the system * Enumerate all DirectSound drivers installed in the system.
*
* PARAMS
* lpDSEnumCallback [I] Address of callback function.
* lpContext [I] Address of user defined context passed to callback function.
* *
* RETURNS * RETURNS
* Success: DS_OK * Success: DS_OK
...@@ -225,7 +245,7 @@ DirectSoundCaptureEnumerateW( ...@@ -225,7 +245,7 @@ DirectSoundCaptureEnumerateW(
TRACE("(%p,%p)\n", lpDSEnumCallback, lpContext ); TRACE("(%p,%p)\n", lpDSEnumCallback, lpContext );
if (lpDSEnumCallback == NULL) { if (lpDSEnumCallback == NULL) {
WARN("invalid parameter\n"); WARN("invalid parameter: lpDSEnumCallback == NULL\n");
return DSERR_INVALIDPARAM; return DSERR_INVALIDPARAM;
} }
...@@ -283,7 +303,9 @@ DSOUND_capture_callback( ...@@ -283,7 +303,9 @@ DSOUND_capture_callback(
DWORD dw2 ) DWORD dw2 )
{ {
IDirectSoundCaptureImpl* This = (IDirectSoundCaptureImpl*)dwUser; IDirectSoundCaptureImpl* This = (IDirectSoundCaptureImpl*)dwUser;
TRACE("entering at %ld, msg=%08x\n", GetTickCount(), msg); TRACE("(%p,%08x(%s),%08lx,%08lx,%08lx) entering at %ld\n",hwi,msg,
msg == MM_WIM_OPEN ? "MM_WIM_OPEN" : msg == MM_WIM_CLOSE ? "MM_WIM_CLOSE" :
msg == MM_WIM_DATA ? "MM_WIM_DATA" : "UNKNOWN",dwUser,dw1,dw2,GetTickCount());
if (msg == MM_WIM_DATA) { if (msg == MM_WIM_DATA) {
EnterCriticalSection( &(This->lock) ); EnterCriticalSection( &(This->lock) );
...@@ -300,8 +322,8 @@ DSOUND_capture_callback( ...@@ -300,8 +322,8 @@ DSOUND_capture_callback(
} }
This->index = (This->index + 1) % This->nrofpwaves; This->index = (This->index + 1) % This->nrofpwaves;
waveInUnprepareHeader(hwi,&(This->pwave[This->index]),sizeof(WAVEHDR)); waveInUnprepareHeader(hwi,&(This->pwave[This->index]),sizeof(WAVEHDR));
if (This->capture_buffer->nrofnotifies) if (This->capture_buffer->notify && This->capture_buffer->notify->nrofnotifies)
SetEvent(This->capture_buffer->notifies[This->index].hEventNotify); SetEvent(This->capture_buffer->notify->notifies[This->index].hEventNotify);
if ( (This->index == 0) && !(This->capture_buffer->flags & DSCBSTART_LOOPING) ) { if ( (This->index == 0) && !(This->capture_buffer->flags & DSCBSTART_LOOPING) ) {
TRACE("end of buffer\n"); TRACE("end of buffer\n");
This->state = STATE_STOPPED; This->state = STATE_STOPPED;
...@@ -698,22 +720,40 @@ IDirectSoundCaptureBufferImpl_QueryInterface( ...@@ -698,22 +720,40 @@ IDirectSoundCaptureBufferImpl_QueryInterface(
ICOM_THIS(IDirectSoundCaptureBufferImpl,iface); ICOM_THIS(IDirectSoundCaptureBufferImpl,iface);
TRACE( "(%p,%s,%p)\n", This, debugstr_guid(riid), ppobj ); TRACE( "(%p,%s,%p)\n", This, debugstr_guid(riid), ppobj );
if (IsEqualGUID( &IID_IDirectSoundNotify, riid ) ) { if ( IsEqualGUID( &IID_IDirectSoundNotify, riid ) ||
IDirectSoundNotifyImpl *dsn; IsEqualGUID( &IID_IDirectSoundNotify8, riid ) ) {
if (!This->notify) {
dsn = (IDirectSoundNotifyImpl*)HeapAlloc(GetProcessHeap(),0, This->notify = (IDirectSoundNotifyImpl*)HeapAlloc(GetProcessHeap(),
sizeof(*dsn)); HEAP_ZERO_MEMORY, sizeof(*This->notify));
dsn->ref = 1; if (This->notify) {
dsn->dsb = 0; This->notify->ref = 0; /* release when ref = -1 */
dsn->dscb = This; This->notify->lpVtbl = &dsnvt;
/* FIXME: get this right someday */ }
IDirectSoundCaptureBuffer8_AddRef(iface); }
dsn->lpVtbl = &dsnvt; if (This->notify) {
*ppobj = (LPVOID)dsn; if (This->dsound->hwbuf) {
return DS_OK; HRESULT err;
err = IDsCaptureDriverBuffer_QueryInterface(This->dsound->hwbuf,
&IID_IDsDriverNotify, (LPVOID*)&(This->notify->hwnotify));
if (err != DS_OK) {
WARN("IDsCaptureDriverBuffer_QueryInterface failed\n");
*ppobj = 0;
return err;
}
}
IDirectSoundNotify_AddRef((LPDIRECTSOUNDNOTIFY)This->notify);
*ppobj = (LPVOID)This->notify;
return DS_OK;
}
*ppobj = 0;
return E_FAIL;
} }
if ( IsEqualGUID( &IID_IDirectSoundCaptureBuffer8, riid ) ) { if ( IsEqualGUID( &IID_IDirectSoundCaptureBuffer, riid ) ||
IsEqualGUID( &IID_IDirectSoundCaptureBuffer8, riid ) ) {
IDirectSoundCaptureBuffer8_AddRef(iface); IDirectSoundCaptureBuffer8_AddRef(iface);
*ppobj = This; *ppobj = This;
return NO_ERROR; return NO_ERROR;
...@@ -721,7 +761,9 @@ IDirectSoundCaptureBufferImpl_QueryInterface( ...@@ -721,7 +761,9 @@ IDirectSoundCaptureBufferImpl_QueryInterface(
FIXME("(%p,%s,%p) unsupported GUID\n", This, debugstr_guid(riid), ppobj); FIXME("(%p,%s,%p) unsupported GUID\n", This, debugstr_guid(riid), ppobj);
return E_FAIL; *ppobj = 0;
return E_NOINTERFACE;
} }
static ULONG WINAPI static ULONG WINAPI
...@@ -783,8 +825,8 @@ IDirectSoundCaptureBufferImpl_Release( LPDIRECTSOUNDCAPTUREBUFFER8 iface ) ...@@ -783,8 +825,8 @@ IDirectSoundCaptureBufferImpl_Release( LPDIRECTSOUNDCAPTUREBUFFER8 iface )
else else
ERR("does not reference dsound\n"); ERR("does not reference dsound\n");
if (This->notifies) if (This->notify)
HeapFree(GetProcessHeap(),0, This->notifies); IDirectSoundNotify_Release((LPDIRECTSOUNDNOTIFY)This->notify);
HeapFree( GetProcessHeap(), 0, This ); HeapFree( GetProcessHeap(), 0, This );
} }
...@@ -1042,10 +1084,10 @@ IDirectSoundCaptureBufferImpl_Start( ...@@ -1042,10 +1084,10 @@ IDirectSoundCaptureBufferImpl_Start(
IDirectSoundCaptureImpl* ipDSC = This->dsound; IDirectSoundCaptureImpl* ipDSC = This->dsound;
if (ipDSC->buffer) { if (ipDSC->buffer) {
if (This->nrofnotifies) { if (This->notify && This->notify->nrofnotifies) {
unsigned c; unsigned c;
ipDSC->nrofpwaves = This->nrofnotifies; ipDSC->nrofpwaves = This->notify->nrofnotifies;
/* prepare headers */ /* prepare headers */
ipDSC->pwave = HeapReAlloc(GetProcessHeap(),0,ipDSC->pwave, ipDSC->pwave = HeapReAlloc(GetProcessHeap(),0,ipDSC->pwave,
...@@ -1055,13 +1097,13 @@ IDirectSoundCaptureBufferImpl_Start( ...@@ -1055,13 +1097,13 @@ IDirectSoundCaptureBufferImpl_Start(
if (c == 0) { if (c == 0) {
ipDSC->pwave[0].lpData = ipDSC->buffer; ipDSC->pwave[0].lpData = ipDSC->buffer;
ipDSC->pwave[0].dwBufferLength = ipDSC->pwave[0].dwBufferLength =
This->notifies[0].dwOffset + 1; This->notify->notifies[0].dwOffset + 1;
} else { } else {
ipDSC->pwave[c].lpData = ipDSC->buffer + ipDSC->pwave[c].lpData = ipDSC->buffer +
This->notifies[c-1].dwOffset + 1; This->notify->notifies[c-1].dwOffset + 1;
ipDSC->pwave[c].dwBufferLength = ipDSC->pwave[c].dwBufferLength =
This->notifies[c].dwOffset - This->notify->notifies[c].dwOffset -
This->notifies[c-1].dwOffset; This->notify->notifies[c-1].dwOffset;
} }
ipDSC->pwave[c].dwUser = (DWORD)ipDSC; ipDSC->pwave[c].dwUser = (DWORD)ipDSC;
ipDSC->pwave[c].dwFlags = 0; ipDSC->pwave[c].dwFlags = 0;
...@@ -1256,9 +1298,21 @@ static ICOM_VTABLE(IDirectSoundCaptureBuffer8) dscbvt = ...@@ -1256,9 +1298,21 @@ static ICOM_VTABLE(IDirectSoundCaptureBuffer8) dscbvt =
}; };
/*************************************************************************** /***************************************************************************
* DirectSoundFullDuplexCreate8 [DSOUND.8] * DirectSoundFullDuplexCreate8 [DSOUND.10]
*
* Create and initialize a DirectSoundFullDuplex interface.
* *
* Create and initialize a DirectSoundFullDuplex interface * PARAMS
* pcGuidCaptureDevice [I] Address of sound capture device GUID.
* pcGuidRenderDevice [I] Address of sound render device GUID.
* pcDSCBufferDesc [I] Address of capture buffer description.
* pcDSBufferDesc [I] Address of render buffer description.
* hWnd [I] Handle to application window.
* dwLevel [I] Cooperative level.
* ppDSFD [O] Address where full duplex interface returned.
* ppDSCBuffer8 [0] Address where capture buffer interface returned.
* ppDSBuffer8 [0] Address where render buffer interface returned.
* pUnkOuter [I] Must be NULL.
* *
* RETURNS * RETURNS
* Success: DS_OK * Success: DS_OK
......
...@@ -231,13 +231,24 @@ void setup_dsound_options(void) ...@@ -231,13 +231,24 @@ void setup_dsound_options(void)
/*************************************************************************** /***************************************************************************
* GetDeviceId [DSOUND.2] * GetDeviceID [DSOUND.9]
* *
* Retrieves unique identifier of default device specified * Retrieves unique identifier of default device specified
* *
* PARAMS
* pGuidSrc [I] Address of device GUID.
* pGuidDest [O] Address to receive unique device GUID.
*
* RETURNS * RETURNS
* Success: DS_OK * Success: DS_OK
* Failure: DSERR_INVALIDPARAM * Failure: DSERR_INVALIDPARAM
*
* NOTES
* pGuidSrc is a valid device GUID or DSDEVID_DefaultPlayback,
* DSDEVID_DefaultCapture, DSDEVID_DefaultVoicePlayback, or
* DSDEVID_DefaultVoiceCapture.
* Returns pGuidSrc if pGuidSrc is a valid device or the device
* GUID for the specified constants.
*/ */
HRESULT WINAPI GetDeviceID(LPCGUID pGuidSrc, LPGUID pGuidDest) HRESULT WINAPI GetDeviceID(LPCGUID pGuidSrc, LPGUID pGuidDest)
{ {
...@@ -277,6 +288,10 @@ HRESULT WINAPI GetDeviceID(LPCGUID pGuidSrc, LPGUID pGuidDest) ...@@ -277,6 +288,10 @@ HRESULT WINAPI GetDeviceID(LPCGUID pGuidSrc, LPGUID pGuidDest)
* *
* Enumerate all DirectSound drivers installed in the system * Enumerate all DirectSound drivers installed in the system
* *
* PARAMS
* lpDSEnumCallback [I] Address of callback function.
* lpContext [I] Address of user defined context passed to callback function.
*
* RETURNS * RETURNS
* Success: DS_OK * Success: DS_OK
* Failure: DSERR_INVALIDPARAM * Failure: DSERR_INVALIDPARAM
...@@ -294,7 +309,7 @@ HRESULT WINAPI DirectSoundEnumerateA( ...@@ -294,7 +309,7 @@ HRESULT WINAPI DirectSoundEnumerateA(
lpDSEnumCallback, lpContext); lpDSEnumCallback, lpContext);
if (lpDSEnumCallback == NULL) { if (lpDSEnumCallback == NULL) {
WARN("invalid parameter\n"); WARN("invalid parameter: lpDSEnumCallback == NULL\n");
return DSERR_INVALIDPARAM; return DSERR_INVALIDPARAM;
} }
...@@ -339,6 +354,10 @@ HRESULT WINAPI DirectSoundEnumerateA( ...@@ -339,6 +354,10 @@ HRESULT WINAPI DirectSoundEnumerateA(
* *
* Enumerate all DirectSound drivers installed in the system * Enumerate all DirectSound drivers installed in the system
* *
* PARAMS
* lpDSEnumCallback [I] Address of callback function.
* lpContext [I] Address of user defined context passed to callback function.
*
* RETURNS * RETURNS
* Success: DS_OK * Success: DS_OK
* Failure: DSERR_INVALIDPARAM * Failure: DSERR_INVALIDPARAM
...@@ -358,7 +377,7 @@ HRESULT WINAPI DirectSoundEnumerateW( ...@@ -358,7 +377,7 @@ HRESULT WINAPI DirectSoundEnumerateW(
lpDSEnumCallback, lpContext); lpDSEnumCallback, lpContext);
if (lpDSEnumCallback == NULL) { if (lpDSEnumCallback == NULL) {
WARN("invalid parameter\n"); WARN("invalid parameter: lpDSEnumCallback == NULL\n");
return DSERR_INVALIDPARAM; return DSERR_INVALIDPARAM;
} }
...@@ -708,6 +727,18 @@ static ICOM_VTABLE(IDirectSound8) dsvt = ...@@ -708,6 +727,18 @@ static ICOM_VTABLE(IDirectSound8) dsvt =
/******************************************************************************* /*******************************************************************************
* DirectSoundCreate (DSOUND.1) * DirectSoundCreate (DSOUND.1)
*
* Creates and initializes a DirectSound interface.
*
* PARAMS
* lpcGUID [I] Address of the GUID that identifies the sound device.
* ppDS [O] Address of a variable to receive the interface pointer.
* pUnkOuter [I] Must be NULL.
*
* RETURNS
* Success: DS_OK
* Failure: DSERR_ALLOCATED, DSERR_INVALIDPARAM, DSERR_NOAGGREGATION,
* DSERR_NODRIVER, DSERR_OUTOFMEMORY
*/ */
HRESULT WINAPI DirectSoundCreate8(LPCGUID lpcGUID,LPDIRECTSOUND8 *ppDS,IUnknown *pUnkOuter ) HRESULT WINAPI DirectSoundCreate8(LPCGUID lpcGUID,LPDIRECTSOUND8 *ppDS,IUnknown *pUnkOuter )
{ {
...@@ -976,7 +1007,8 @@ DWORD WINAPI DSOUND_DllGetClassObject(REFCLSID rclsid,REFIID riid,LPVOID *ppv) ...@@ -976,7 +1007,8 @@ DWORD WINAPI DSOUND_DllGetClassObject(REFCLSID rclsid,REFIID riid,LPVOID *ppv)
/******************************************************************************* /*******************************************************************************
* DllCanUnloadNow [DSOUND.4] Determines whether the DLL is in use. * DllCanUnloadNow [DSOUND.4]
* Determines whether the DLL is in use.
* *
* RETURNS * RETURNS
* Success: S_OK * Success: S_OK
......
...@@ -117,8 +117,7 @@ struct IDirectSoundBufferImpl ...@@ -117,8 +117,7 @@ struct IDirectSoundBufferImpl
DWORD primary_mixpos, buf_mixpos; DWORD primary_mixpos, buf_mixpos;
BOOL need_remix; BOOL need_remix;
/* IDirectSoundNotifyImpl fields */ /* IDirectSoundNotifyImpl fields */
LPDSBPOSITIONNOTIFY notifies; IDirectSoundNotifyImpl *notify;
int nrofnotifies;
}; };
HRESULT WINAPI SecondaryBuffer_Create( HRESULT WINAPI SecondaryBuffer_Create(
...@@ -189,9 +188,9 @@ struct IDirectSoundCaptureBufferImpl ...@@ -189,9 +188,9 @@ struct IDirectSoundCaptureBufferImpl
IDirectSoundCaptureImpl* dsound; IDirectSoundCaptureImpl* dsound;
/* FIXME: don't need this */ /* FIXME: don't need this */
LPDSCBUFFERDESC pdscbd; LPDSCBUFFERDESC pdscbd;
LPDSBPOSITIONNOTIFY notifies;
int nrofnotifies;
DWORD flags; DWORD flags;
/* IDirectSoundNotifyImpl fields */
IDirectSoundNotifyImpl *notify;
}; };
/***************************************************************************** /*****************************************************************************
...@@ -216,8 +215,10 @@ struct IDirectSoundNotifyImpl ...@@ -216,8 +215,10 @@ struct IDirectSoundNotifyImpl
ICOM_VFIELD(IDirectSoundNotify); ICOM_VFIELD(IDirectSoundNotify);
DWORD ref; DWORD ref;
/* IDirectSoundNotifyImpl fields */ /* IDirectSoundNotifyImpl fields */
IDirectSoundBufferImpl* dsb; LPDSBPOSITIONNOTIFY notifies;
IDirectSoundCaptureBufferImpl* dscb; int nrofnotifies;
PIDSDRIVERNOTIFY hwnotify;
}; };
/***************************************************************************** /*****************************************************************************
......
...@@ -79,13 +79,13 @@ void DSOUND_CheckEvent(IDirectSoundBufferImpl *dsb, int len) ...@@ -79,13 +79,13 @@ void DSOUND_CheckEvent(IDirectSoundBufferImpl *dsb, int len)
DWORD offset; DWORD offset;
LPDSBPOSITIONNOTIFY event; LPDSBPOSITIONNOTIFY event;
if (dsb->nrofnotifies == 0) if (!dsb->notify || dsb->notify->nrofnotifies == 0)
return; return;
TRACE("(%p) buflen = %ld, playpos = %ld, len = %d\n", TRACE("(%p) buflen = %ld, playpos = %ld, len = %d\n",
dsb, dsb->buflen, dsb->playpos, len); dsb, dsb->buflen, dsb->playpos, len);
for (i = 0; i < dsb->nrofnotifies ; i++) { for (i = 0; i < dsb->notify->nrofnotifies ; i++) {
event = dsb->notifies + i; event = dsb->notify->notifies + i;
offset = event->dwOffset; offset = event->dwOffset;
TRACE("checking %d, position %ld, event = %p\n", TRACE("checking %d, position %ld, event = %p\n",
i, offset, event->hEventNotify); i, offset, event->hEventNotify);
......
...@@ -388,10 +388,12 @@ static HRESULT WINAPI DSPROPERTY_DescriptionW( ...@@ -388,10 +388,12 @@ static HRESULT WINAPI DSPROPERTY_DescriptionW(
} }
ppd->Type = DIRECTSOUNDDEVICE_TYPE_EMULATED; ppd->Type = DIRECTSOUNDDEVICE_TYPE_EMULATED;
if (pcbReturned) { if (pcbReturned) {
*pcbReturned = cbPropData; *pcbReturned = cbPropData;
TRACE("*pcbReturned=%ld\n", *pcbReturned); TRACE("*pcbReturned=%ld\n", *pcbReturned);
} }
return S_OK; return S_OK;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment