Commit 722262b0 authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

dmsynth: Forward IDirectMusicSynth_GetLatencyClock to the sink.

parent 2a1b03cc
......@@ -38,7 +38,6 @@ struct synth
DMUS_PORTPARAMS params;
BOOL active;
BOOL open;
IReferenceClock *latency_clock;
IDirectMusicSynthSink *sink;
};
......@@ -93,11 +92,7 @@ static ULONG WINAPI synth_Release(IDirectMusicSynth8 *iface)
TRACE("(%p): new ref = %lu\n", This, ref);
if (!ref) {
if (This->latency_clock)
IReferenceClock_Release(This->latency_clock);
free(This);
}
if (!ref) free(This);
return ref;
}
......@@ -414,14 +409,10 @@ static HRESULT WINAPI synth_GetLatencyClock(IDirectMusicSynth8 *iface,
if (!clock)
return E_POINTER;
if (!This->sink)
return DMUS_E_NOSYNTHSINK;
*clock = This->latency_clock;
IReferenceClock_AddRef(This->latency_clock);
return S_OK;
return IDirectMusicSynthSink_GetLatencyClock(This->sink, clock);
}
static HRESULT WINAPI synth_Activate(IDirectMusicSynth8 *iface, BOOL enable)
......@@ -457,28 +448,20 @@ static HRESULT WINAPI synth_SetSynthSink(IDirectMusicSynth8 *iface,
IDirectMusicSynthSink *sink)
{
struct synth *This = impl_from_IDirectMusicSynth8(iface);
HRESULT hr;
TRACE("(%p)->(%p)\n", iface, sink);
if (sink == This->sink)
return S_OK;
if (!sink || This->sink) {
/* Disconnect the sink */
if (This->latency_clock)
IReferenceClock_Release(This->latency_clock);
IDirectMusicSynthSink_Release(This->sink);
}
if (!sink || This->sink) IDirectMusicSynthSink_Release(This->sink);
This->sink = sink;
if (!sink)
return S_OK;
IDirectMusicSynthSink_AddRef(This->sink);
if (FAILED(hr = IDirectMusicSynthSink_Init(sink, (IDirectMusicSynth *)iface)))
return hr;
return IDirectMusicSynthSink_GetLatencyClock(sink, &This->latency_clock);
return IDirectMusicSynthSink_Init(sink, (IDirectMusicSynth *)iface);
}
static HRESULT WINAPI synth_Render(IDirectMusicSynth8 *iface, short *buffer,
......
......@@ -1014,7 +1014,7 @@ static void test_IDirectMusicSynth(void)
hr = IDirectMusicSynth_SetSynthSink(synth, sink);
ok(hr == S_OK, "got %#lx\n", hr);
ref = get_refcount(sink);
todo_wine ok(ref == 2, "got %lu\n", ref);
ok(ref == 2, "got %lu\n", ref);
hr = IDirectMusicSynth_Activate(synth, TRUE);
todo_wine ok(hr == DMUS_E_SYNTHNOTCONFIGURED, "got %#lx\n", hr);
......@@ -1062,7 +1062,7 @@ static void test_IDirectMusicSynth(void)
hr = IDirectMusicSynth_SetSynthSink(synth, sink);
ok(hr == S_OK, "got %#lx\n", hr);
ref = get_refcount(sink);
todo_wine ok(ref == 2, "got %lu\n", ref);
ok(ref == 2, "got %lu\n", ref);
hr = IDirectMusicSynth_Activate(synth, TRUE);
todo_wine ok(hr == S_OK, "got %#lx\n", hr);
......@@ -1145,7 +1145,7 @@ static void test_IDirectMusicSynth(void)
IDirectMusicSynth_Release(synth);
if (strcmp(winetest_platform, "wine")) IDirectMusicSynthSink_Release(sink);
IDirectMusicSynthSink_Release(sink);
IReferenceClock_Release(clock);
IDirectMusic_Release(music);
}
......
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