From 14f899317ac10dd15ccb0457abf655bc9d32efa4 Mon Sep 17 00:00:00 2001 From: Michael Stefaniuc Date: Fri, 12 May 2017 16:11:24 +0200 Subject: [PATCH] dmime: Initialize dmusic in InitAudio(). Signed-off-by: Michael Stefaniuc Signed-off-by: Alexandre Julliard --- dlls/dmime/performance.c | 9 ++++++++- dlls/dmime/tests/performance.c | 6 +++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/dlls/dmime/performance.c b/dlls/dmime/performance.c index d0df2d570a5..6e4dae6be7f 100644 --- a/dlls/dmime/performance.c +++ b/dlls/dmime/performance.c @@ -802,6 +802,7 @@ static HRESULT WINAPI IDirectMusicPerformance8Impl_CloseDown(IDirectMusicPerform This->dsound = NULL; } if (This->dmusic) { + IDirectMusic_SetDirectSound(This->dmusic, NULL, NULL); IDirectMusic8_Release(This->dmusic); This->dmusic = NULL; } @@ -895,6 +896,10 @@ static HRESULT WINAPI IDirectMusicPerformance8Impl_InitAudio(IDirectMusicPerform IDirectSound_AddRef(This->dsound); } + hr = IDirectMusic8_SetDirectSound(This->dmusic, This->dsound, NULL); + if (FAILED(hr)) + goto error; + if (!params) { This->params.dwSize = sizeof(DMUS_AUDIOPARAMS); This->params.fInitNow = FALSE; @@ -910,8 +915,10 @@ static HRESULT WINAPI IDirectMusicPerformance8Impl_InitAudio(IDirectMusicPerform if (default_path_type) { hr = IDirectMusicPerformance8_CreateStandardAudioPath(iface, default_path_type, num_channels, FALSE, &This->pDefaultPath); - if (FAILED(hr)) + if (FAILED(hr)) { + IDirectMusic8_SetDirectSound(This->dmusic, NULL, NULL); goto error; + } } if (dsound && !*dsound) { diff --git a/dlls/dmime/tests/performance.c b/dlls/dmime/tests/performance.c index 9187c818611..c4cbb32e185 100644 --- a/dlls/dmime/tests/performance.c +++ b/dlls/dmime/tests/performance.c @@ -129,7 +129,7 @@ static HRESULT test_InitAudio(void) hr = IDirectMusicPerformance8_InitAudio(performance, &dmusic, &dsound, NULL, 0, 64, 0, NULL); ok(hr == S_OK, "InitAudio failed: %08x\n", hr); ref = get_refcount(dsound); - todo_wine ok(ref == 3, "dsound ref count got %d expected 3\n", ref); + ok(ref == 3, "dsound ref count got %d expected 3\n", ref); ref = get_refcount(dmusic); ok(ref == 2, "dmusic ref count got %d expected 2\n", ref); destroy_performance(performance, NULL, NULL); @@ -171,7 +171,7 @@ static HRESULT test_InitAudio(void) hr = IDirectMusicPerformance8_InitAudio(performance, &dmusic, &dsound, NULL, 0, 64, 0, NULL); ok(hr == S_OK, "InitAudio failed: %08x\n", hr); ref = get_refcount(dsound); - ok(ref == 2, "dsound ref count got %d expected 2\n", ref); + todo_wine ok(ref == 2, "dsound ref count got %d expected 2\n", ref); ref = get_refcount(dmusic); ok(ref == 2, "dmusic ref count got %d expected 2\n", ref); destroy_performance(performance, dmusic, dsound); @@ -185,7 +185,7 @@ static HRESULT test_InitAudio(void) hr = IDirectMusicPerformance8_InitAudio(performance, &dmusic, NULL, NULL, 0, 64, 0, NULL); ok(hr == S_OK, "InitAudio failed: %08x\n", hr); ref = get_refcount(dsound); - ok(ref == 2, "dsound ref count got %d expected 2\n", ref); + todo_wine ok(ref == 2, "dsound ref count got %d expected 2\n", ref); ref = get_refcount(dmusic); ok(ref == 2, "dmusic ref count got %d expected 2\n", ref); destroy_performance(performance, dmusic, dsound);