Commit 14f89931 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

dmime: Initialize dmusic in InitAudio().

parent 3505137d
......@@ -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) {
......
......@@ -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);
......
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