Michael Stefaniuc : dmusic: Add dsound handling to the synth port Activate () method.
Alexandre Julliard
julliard at winehq.org
Wed May 10 17:23:18 CDT 2017
Module: wine
Branch: master
Commit: 43b3f844baaf9e2ea82bc59066880e7aae70fc21
URL: http://source.winehq.org/git/wine.git/?a=commit;h=43b3f844baaf9e2ea82bc59066880e7aae70fc21
Author: Michael Stefaniuc <mstefani at winehq.org>
Date: Wed May 10 14:44:03 2017 +0200
dmusic: Add dsound handling to the synth port Activate() method.
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/dmusic/port.c | 24 +++++++++++++++++++++---
dlls/dmusic/tests/dmusic.c | 14 +++++++-------
2 files changed, 28 insertions(+), 10 deletions(-)
diff --git a/dlls/dmusic/port.c b/dlls/dmusic/port.c
index 1bff721..5f4d918 100644
--- a/dlls/dmusic/port.c
+++ b/dlls/dmusic/port.c
@@ -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,
diff --git a/dlls/dmusic/tests/dmusic.c b/dlls/dmusic/tests/dmusic.c
index a96b4f7..f65dc7e 100644
--- a/dlls/dmusic/tests/dmusic.c
+++ b/dlls/dmusic/tests/dmusic.c
@@ -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);
More information about the wine-cvs
mailing list