dmsynth: Activate the sink from the synth Activate() method.

Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Michael Stefaniuc 2022-01-19 18:48:48 +01:00 committed by Alexandre Julliard
parent 3292bc2965
commit 5d687a23e4
3 changed files with 21 additions and 3 deletions

View File

@ -63,7 +63,7 @@ struct IDirectMusicSynth8Impl {
/* IDirectMusicSynth8 fields */
DMUS_PORTCAPS pCaps;
BOOL fActive;
BOOL active;
IReferenceClock* pLatencyClock;
IDirectMusicSynthSink *sink;
};

View File

@ -332,10 +332,28 @@ static HRESULT WINAPI IDirectMusicSynth8Impl_GetLatencyClock(IDirectMusicSynth8
static HRESULT WINAPI IDirectMusicSynth8Impl_Activate(IDirectMusicSynth8 *iface, BOOL enable)
{
IDirectMusicSynth8Impl *This = impl_from_IDirectMusicSynth8(iface);
HRESULT hr;
TRACE("(%p)->(%d)\n", This, enable);
This->fActive = enable;
if (!This->sink)
return DMUS_E_NOSYNTHSINK;
if (enable == This->active) {
if (enable)
return DMUS_E_SYNTHACTIVE;
else
return S_FALSE;
}
if ((hr = IDirectMusicSynthSink_Activate(This->sink, enable)) != S_OK) {
if (hr == DMUS_E_SYNTHACTIVE || hr == S_FALSE)
WARN("Synth and sink active state out of sync. Fixing.\n");
else
return hr;
}
This->active = enable;
return S_OK;
}

View File

@ -114,7 +114,7 @@ static void test_dmsynth(void)
/* Synth isn't fully initialized yet */
hr = IDirectMusicSynth_Activate(dmsynth, TRUE);
todo_wine ok(hr == DMUS_E_NOSYNTHSINK, "IDirectMusicSynth_Activate returned: %x\n", hr);
ok(hr == DMUS_E_NOSYNTHSINK, "IDirectMusicSynth_Activate returned: %x\n", hr);
/* Synth has no default clock */
hr = IDirectMusicSynth_GetLatencyClock(dmsynth, &clock_synth);