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 ...@@ -802,6 +802,7 @@ static HRESULT WINAPI IDirectMusicPerformance8Impl_CloseDown(IDirectMusicPerform
This->dsound = NULL; This->dsound = NULL;
} }
if (This->dmusic) { if (This->dmusic) {
IDirectMusic_SetDirectSound(This->dmusic, NULL, NULL);
IDirectMusic8_Release(This->dmusic); IDirectMusic8_Release(This->dmusic);
This->dmusic = NULL; This->dmusic = NULL;
} }
...@@ -895,6 +896,10 @@ static HRESULT WINAPI IDirectMusicPerformance8Impl_InitAudio(IDirectMusicPerform ...@@ -895,6 +896,10 @@ static HRESULT WINAPI IDirectMusicPerformance8Impl_InitAudio(IDirectMusicPerform
IDirectSound_AddRef(This->dsound); IDirectSound_AddRef(This->dsound);
} }
hr = IDirectMusic8_SetDirectSound(This->dmusic, This->dsound, NULL);
if (FAILED(hr))
goto error;
if (!params) { if (!params) {
This->params.dwSize = sizeof(DMUS_AUDIOPARAMS); This->params.dwSize = sizeof(DMUS_AUDIOPARAMS);
This->params.fInitNow = FALSE; This->params.fInitNow = FALSE;
...@@ -910,8 +915,10 @@ static HRESULT WINAPI IDirectMusicPerformance8Impl_InitAudio(IDirectMusicPerform ...@@ -910,8 +915,10 @@ static HRESULT WINAPI IDirectMusicPerformance8Impl_InitAudio(IDirectMusicPerform
if (default_path_type) { if (default_path_type) {
hr = IDirectMusicPerformance8_CreateStandardAudioPath(iface, default_path_type, hr = IDirectMusicPerformance8_CreateStandardAudioPath(iface, default_path_type,
num_channels, FALSE, &This->pDefaultPath); num_channels, FALSE, &This->pDefaultPath);
if (FAILED(hr)) if (FAILED(hr)) {
IDirectMusic8_SetDirectSound(This->dmusic, NULL, NULL);
goto error; goto error;
}
} }
if (dsound && !*dsound) { if (dsound && !*dsound) {
......
...@@ -129,7 +129,7 @@ static HRESULT test_InitAudio(void) ...@@ -129,7 +129,7 @@ static HRESULT test_InitAudio(void)
hr = IDirectMusicPerformance8_InitAudio(performance, &dmusic, &dsound, NULL, 0, 64, 0, NULL); hr = IDirectMusicPerformance8_InitAudio(performance, &dmusic, &dsound, NULL, 0, 64, 0, NULL);
ok(hr == S_OK, "InitAudio failed: %08x\n", hr); ok(hr == S_OK, "InitAudio failed: %08x\n", hr);
ref = get_refcount(dsound); 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); ref = get_refcount(dmusic);
ok(ref == 2, "dmusic ref count got %d expected 2\n", ref); ok(ref == 2, "dmusic ref count got %d expected 2\n", ref);
destroy_performance(performance, NULL, NULL); destroy_performance(performance, NULL, NULL);
...@@ -171,7 +171,7 @@ static HRESULT test_InitAudio(void) ...@@ -171,7 +171,7 @@ static HRESULT test_InitAudio(void)
hr = IDirectMusicPerformance8_InitAudio(performance, &dmusic, &dsound, NULL, 0, 64, 0, NULL); hr = IDirectMusicPerformance8_InitAudio(performance, &dmusic, &dsound, NULL, 0, 64, 0, NULL);
ok(hr == S_OK, "InitAudio failed: %08x\n", hr); ok(hr == S_OK, "InitAudio failed: %08x\n", hr);
ref = get_refcount(dsound); 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); ref = get_refcount(dmusic);
ok(ref == 2, "dmusic ref count got %d expected 2\n", ref); ok(ref == 2, "dmusic ref count got %d expected 2\n", ref);
destroy_performance(performance, dmusic, dsound); destroy_performance(performance, dmusic, dsound);
...@@ -185,7 +185,7 @@ static HRESULT test_InitAudio(void) ...@@ -185,7 +185,7 @@ static HRESULT test_InitAudio(void)
hr = IDirectMusicPerformance8_InitAudio(performance, &dmusic, NULL, NULL, 0, 64, 0, NULL); hr = IDirectMusicPerformance8_InitAudio(performance, &dmusic, NULL, NULL, 0, 64, 0, NULL);
ok(hr == S_OK, "InitAudio failed: %08x\n", hr); ok(hr == S_OK, "InitAudio failed: %08x\n", hr);
ref = get_refcount(dsound); 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); ref = get_refcount(dmusic);
ok(ref == 2, "dmusic ref count got %d expected 2\n", ref); ok(ref == 2, "dmusic ref count got %d expected 2\n", ref);
destroy_performance(performance, dmusic, dsound); 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