Module: wine Branch: master Commit: 722262b023e1840abd91f0370930bfd6e7b2e025 URL: https://gitlab.winehq.org/wine/wine/-/commit/722262b023e1840abd91f0370930bfd...
Author: Rémi Bernon rbernon@codeweavers.com Date: Tue Aug 29 14:24:00 2023 +0200
dmsynth: Forward IDirectMusicSynth_GetLatencyClock to the sink.
---
dlls/dmsynth/synth.c | 25 ++++--------------------- dlls/dmsynth/tests/dmsynth.c | 6 +++--- 2 files changed, 7 insertions(+), 24 deletions(-)
diff --git a/dlls/dmsynth/synth.c b/dlls/dmsynth/synth.c index e07e47490bd..983e1502fe9 100644 --- a/dlls/dmsynth/synth.c +++ b/dlls/dmsynth/synth.c @@ -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, diff --git a/dlls/dmsynth/tests/dmsynth.c b/dlls/dmsynth/tests/dmsynth.c index 6f89b1580b5..423efb38e83 100644 --- a/dlls/dmsynth/tests/dmsynth.c +++ b/dlls/dmsynth/tests/dmsynth.c @@ -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); }