Module: wine Branch: master Commit: 54ed994ab1cf2b0dae0857c6f7bbf9c04021ddef URL: https://gitlab.winehq.org/wine/wine/-/commit/54ed994ab1cf2b0dae0857c6f7bbf9c...
Author: Rémi Bernon rbernon@codeweavers.com Date: Tue Sep 5 13:42:41 2023 +0200
dmsynth: Return DMUS_E_SYNTHNOTCONFIGURED when sink fails to activate.
---
dlls/dmsynth/synth.c | 15 +++++++++------ dlls/dmsynth/tests/dmsynth.c | 8 ++++---- 2 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/dlls/dmsynth/synth.c b/dlls/dmsynth/synth.c index 5c492c0e1cf..0916e64f4a6 100644 --- a/dlls/dmsynth/synth.c +++ b/dlls/dmsynth/synth.c @@ -425,13 +425,16 @@ static HRESULT WINAPI synth_Activate(IDirectMusicSynth8 *iface, BOOL enable) if (enable == This->active) return S_FALSE;
if (!This->sink) - return DMUS_E_NOSYNTHSINK; + { + This->active = FALSE; + return enable ? DMUS_E_NOSYNTHSINK : DMUS_E_SYNTHNOTCONFIGURED; + }
- 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; + if (FAILED(hr = IDirectMusicSynthSink_Activate(This->sink, enable)) + && hr != DMUS_E_SYNTHACTIVE) + { + This->active = FALSE; + return DMUS_E_SYNTHNOTCONFIGURED; }
This->active = enable; diff --git a/dlls/dmsynth/tests/dmsynth.c b/dlls/dmsynth/tests/dmsynth.c index 6d1124068b2..897af33bf80 100644 --- a/dlls/dmsynth/tests/dmsynth.c +++ b/dlls/dmsynth/tests/dmsynth.c @@ -1016,7 +1016,7 @@ static void test_IDirectMusicSynth(void) ref = get_refcount(sink); ok(ref == 2, "got %lu\n", ref); hr = IDirectMusicSynth_Activate(synth, TRUE); - todo_wine ok(hr == DMUS_E_SYNTHNOTCONFIGURED, "got %#lx\n", hr); + ok(hr == DMUS_E_SYNTHNOTCONFIGURED, "got %#lx\n", hr);
/* SetMasterClock does nothing */ hr = IDirectMusicSynth_SetMasterClock(synth, NULL); @@ -1047,9 +1047,9 @@ static void test_IDirectMusicSynth(void)
/* but Activate might fail then */ hr = IDirectMusicSynth_Activate(synth, FALSE); - todo_wine ok(hr == DMUS_E_SYNTHNOTCONFIGURED, "got %#lx\n", hr); + ok(hr == DMUS_E_SYNTHNOTCONFIGURED, "got %#lx\n", hr); hr = IDirectMusicSynth_Activate(synth, FALSE); - todo_wine ok(hr == S_FALSE, "got %#lx\n", hr); + ok(hr == S_FALSE, "got %#lx\n", hr);
/* Test generating some samples */ @@ -1064,7 +1064,7 @@ static void test_IDirectMusicSynth(void) ref = get_refcount(sink); ok(ref == 2, "got %lu\n", ref); hr = IDirectMusicSynth_Activate(synth, TRUE); - todo_wine ok(hr == S_OK, "got %#lx\n", hr); + ok(hr == S_OK, "got %#lx\n", hr);
GetTempPathW(MAX_PATH, temp_path); GetTempFileNameW(temp_path, L"synth", 0, temp_file);