It would be nice to see some tests for this. For example, how does this IDirectSound reference relate to the one created by IDirectMusicPerformance::InitAudio()?
On Thu, Mar 29, 2012 at 08:53:10AM +0200, Christian Costa wrote:
dlls/dmusic/dmusic.c | 27 +++++++++++++++++++++------ dlls/dmusic/dmusic_private.h | 2 ++ 2 files changed, 23 insertions(+), 6 deletions(-)
diff --git a/dlls/dmusic/dmusic.c b/dlls/dmusic/dmusic.c index 8f2edea..60d6b8a 100644 --- a/dlls/dmusic/dmusic.c +++ b/dlls/dmusic/dmusic.c @@ -52,19 +52,22 @@ static ULONG WINAPI IDirectMusic8Impl_AddRef (LPDIRECTMUSIC8 iface) { return refCount; }
-static ULONG WINAPI IDirectMusic8Impl_Release (LPDIRECTMUSIC8 iface) { +static ULONG WINAPI IDirectMusic8Impl_Release(LPDIRECTMUSIC8 iface) +{ IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface; ULONG refCount = InterlockedDecrement(&This->ref);
TRACE("(%p)->(ref before=%u)\n", This, refCount + 1);
if (!refCount) {
if (This->dsound)
IDirectSound_Release(This->dsound);
HeapFree(GetProcessHeap(), 0, This->ppPorts); HeapFree(GetProcessHeap(), 0, This); }
DMUSIC_UnlockModule();
- return refCount;
}
@@ -257,10 +260,22 @@ static HRESULT WINAPI IDirectMusic8Impl_GetDefaultPort (LPDIRECTMUSIC8 iface, LP return S_OK; }
-static HRESULT WINAPI IDirectMusic8Impl_SetDirectSound (LPDIRECTMUSIC8 iface, LPDIRECTSOUND pDirectSound, HWND hWnd) {
- IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface;
- FIXME("(%p, %p, %p): stub\n", This, pDirectSound, hWnd);
- return S_OK;
+static HRESULT WINAPI IDirectMusic8Impl_SetDirectSound(LPDIRECTMUSIC8 iface, LPDIRECTSOUND dsound, HWND wnd) +{
- IDirectMusic8Impl *This = (IDirectMusic8Impl *)iface;
- FIXME("(%p, %p, %p): partial implementation\n", This, dsound, wnd);
- if (dsound)
- {
This->dsound = dsound;
IDirectSound_AddRef(dsound);
- }
- /* If no direct sound object is given, native does not create one yet */
- This->dsound_inited = TRUE;
- return S_OK;
}
static HRESULT WINAPI IDirectMusic8Impl_SetExternalMasterClock (LPDIRECTMUSIC8 iface, IReferenceClock* pClock) { diff --git a/dlls/dmusic/dmusic_private.h b/dlls/dmusic/dmusic_private.h index c05adf0..b0655d6 100644 --- a/dlls/dmusic/dmusic_private.h +++ b/dlls/dmusic/dmusic_private.h @@ -96,6 +96,8 @@ struct IDirectMusic8Impl { IReferenceClockImpl* pMasterClock; IDirectMusicPort** ppPorts; int nrofports;
- BOOL dsound_inited;
- IDirectSound* dsound;
};
/*****************************************************************************