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;
};
/*****************************************************************************
2012/3/29 Andrew Eikum aeikum@codeweavers.com
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()?
There are few tests mark as todo in my first dmusic patch about interaction beween SetDirectSound and CreatePort. These tests were supposed to be fixed by this patch but it needed some stuff in CreatePort as well as GUID_NULL support. I removed this part because you send a patch for it. I will wait you patch gets in and resend the full version. More generally, wrt to SetDirectSound, I would like to focus first on dmusic only without dmime Init and InitAudio involved. I've another patch next involving dmime which fixes Init wrt to SetDirectSound. I also doing so InitAudio test but I don't know why I can event make the dmime tests running with all dlls as native.