Commit 43b3f844 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

dmusic: Add dsound handling to the synth port Activate() method.

parent f968edb9
......@@ -436,11 +436,29 @@ static HRESULT WINAPI SynthPortImpl_IDirectMusicPort_GetNumChannelGroups(LPDIREC
return S_OK;
}
static HRESULT WINAPI SynthPortImpl_IDirectMusicPort_Activate(LPDIRECTMUSICPORT iface, BOOL active)
static HRESULT WINAPI synth_dmport_Activate(IDirectMusicPort *iface, BOOL active)
{
SynthPortImpl *This = impl_from_SynthPortImpl_IDirectMusicPort(iface);
TRACE("(%p/%p)->(%d)\n", iface, This, active);
FIXME("(%p/%p)->(%d): semi-stub\n", iface, This, active);
if (This->active == active)
return S_FALSE;
if (active) {
/* Acquire the dsound */
if (!This->dsound) {
IDirectSound_AddRef(This->parent->dsound);
This->dsound = This->parent->dsound;
}
IDirectSound_AddRef(This->dsound);
} else {
/* Release the dsound */
IDirectSound_Release(This->dsound);
IDirectSound_Release(This->parent->dsound);
if (This->dsound == This->parent->dsound)
This->dsound = NULL;
}
This->active = active;
......@@ -567,7 +585,7 @@ static const IDirectMusicPortVtbl SynthPortImpl_DirectMusicPort_Vtbl = {
SynthPortImpl_IDirectMusicPort_DeviceIoControl,
SynthPortImpl_IDirectMusicPort_SetNumChannelGroups,
SynthPortImpl_IDirectMusicPort_GetNumChannelGroups,
SynthPortImpl_IDirectMusicPort_Activate,
synth_dmport_Activate,
SynthPortImpl_IDirectMusicPort_SetChannelPriority,
SynthPortImpl_IDirectMusicPort_GetChannelPriority,
synth_dmport_SetDirectSound,
......
......@@ -179,7 +179,7 @@ static void test_setdsound(void)
hr = IDirectMusicPort_Activate(port, TRUE);
ok(hr == S_OK, "Port Activate returned: %x\n", hr);
ref = get_refcount(dsound);
todo_wine ok(ref == 4, "dsound ref count got %d expected 4\n", ref);
ok(ref == 4, "dsound ref count got %d expected 4\n", ref);
/* Releasing dsound from dmusic */
hr = IDirectMusic_SetDirectSound(dmusic, NULL, NULL);
......@@ -231,13 +231,13 @@ static void test_setdsound(void)
hr = IDirectMusicPort_Activate(port, TRUE);
ok(hr == S_OK, "Activate returned: %x\n", hr);
ref = get_refcount(dsound);
todo_wine ok(ref == 4, "dsound ref count got %d expected 4\n", ref);
ok(ref == 4, "dsound ref count got %d expected 4\n", ref);
ref = get_refcount(dsound2);
ok(ref == 2, "dsound2 ref count got %d expected 2\n", ref);
hr = IDirectMusicPort_Activate(port, TRUE);
todo_wine ok(hr == S_FALSE, "Activate returned: %x\n", hr);
ok(hr == S_FALSE, "Activate returned: %x\n", hr);
ref = get_refcount(dsound);
todo_wine ok(ref == 4, "dsound ref count got %d expected 4\n", ref);
ok(ref == 4, "dsound ref count got %d expected 4\n", ref);
ref = get_refcount(dsound2);
ok(ref == 2, "dsound2 ref count got %d expected 2\n", ref);
......@@ -247,13 +247,13 @@ static void test_setdsound(void)
ref = get_refcount(dsound);
ok(ref == 3, "dsound ref count got %d expected 3\n", ref);
ref = get_refcount(dsound2);
todo_wine ok(ref == 1, "dsound2 ref count got %d expected 1\n", ref);
ok(ref == 1, "dsound2 ref count got %d expected 1\n", ref);
hr = IDirectMusicPort_Activate(port, FALSE);
todo_wine ok(hr == S_FALSE, "Port Activate returned: %x\n", hr);
ok(hr == S_FALSE, "Port Activate returned: %x\n", hr);
ref = get_refcount(dsound);
ok(ref == 3, "dsound ref count got %d expected 3\n", ref);
ref = get_refcount(dsound2);
todo_wine ok(ref == 1, "dsound2 ref count got %d expected 1\n", ref);
ok(ref == 1, "dsound2 ref count got %d expected 1\n", ref);
IDirectMusicPort_Release(port);
IDirectMusic_Release(dmusic);
......
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