[PATCH v4 7/9] windows.media.speech: Return IAsyncOperation from synthesizer_SynthesizeTextToStreamAsync.

Bernhard Kölbl wine at gitlab.winehq.org
Mon Jun 13 13:26:41 CDT 2022


From: Bernhard Kölbl <besentv at gmail.com>

Based on a patch by: Connor McAdams <cmcadams at codeweavers.com>

Signed-off-by: Bernhard Kölbl <besentv at gmail.com>
---
 dlls/windows.media.speech/synthesizer.c  |  8 +++++++-
 dlls/windows.media.speech/tests/speech.c | 11 +++++------
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/dlls/windows.media.speech/synthesizer.c b/dlls/windows.media.speech/synthesizer.c
index e8c9f0a280d..3a77fc62234 100644
--- a/dlls/windows.media.speech/synthesizer.c
+++ b/dlls/windows.media.speech/synthesizer.c
@@ -241,11 +241,17 @@ static HRESULT WINAPI synthesizer_GetTrustLevel( ISpeechSynthesizer *iface, Trus
     return E_NOTIMPL;
 }
 
+static HRESULT CALLBACK text_to_stream_operation( IInspectable *invoker, IInspectable **result )
+{
+    return S_OK;
+}
+
 static HRESULT WINAPI synthesizer_SynthesizeTextToStreamAsync( ISpeechSynthesizer *iface, HSTRING text,
                                                                IAsyncOperation_SpeechSynthesisStream **operation )
 {
     FIXME("iface %p, text %p, operation %p stub.\n", iface, text, operation);
-    return E_NOTIMPL;
+    return async_operation_inspectable_create(&IID_IAsyncOperation_SpeechSynthesisStream, NULL,
+                                              text_to_stream_operation, (IAsyncOperation_IInspectable **)operation);
 }
 
 static HRESULT WINAPI synthesizer_SynthesizeSsmlToStreamAsync( ISpeechSynthesizer *iface, HSTRING ssml,
diff --git a/dlls/windows.media.speech/tests/speech.c b/dlls/windows.media.speech/tests/speech.c
index c8bf1646080..392a38c27e2 100644
--- a/dlls/windows.media.speech/tests/speech.c
+++ b/dlls/windows.media.speech/tests/speech.c
@@ -933,13 +933,11 @@ static void test_SpeechSynthesizer(void)
     ok(hr == S_OK, "WindowsCreateString failed, hr %#lx\n", hr);
 
     hr = ISpeechSynthesizer_SynthesizeTextToStreamAsync(synthesizer, NULL, &operation_ss_stream);
-    todo_wine ok(hr == S_OK, "ISpeechSynthesizer_SynthesizeTextToStreamAsync failed, hr %#lx\n", hr);
-    if(FAILED(hr)) goto skip_ss_stream;
-
+    ok(hr == S_OK, "ISpeechSynthesizer_SynthesizeTextToStreamAsync failed, hr %#lx\n", hr);
     IAsyncOperation_SpeechSynthesisStream_Release(operation_ss_stream);
 
     hr = ISpeechSynthesizer_SynthesizeTextToStreamAsync(synthesizer, str, &operation_ss_stream);
-    todo_wine ok(hr == S_OK, "ISpeechSynthesizer_SynthesizeTextToStreamAsync failed, hr %#lx\n", hr);
+    ok(hr == S_OK, "ISpeechSynthesizer_SynthesizeTextToStreamAsync failed, hr %#lx\n", hr);
 
     await_async_inspectable((IAsyncOperation_IInspectable *)operation_ss_stream,
                              &async_inspectable_handler,
@@ -974,6 +972,8 @@ static void test_SpeechSynthesizer(void)
 
     hr = ISpeechSynthesizer_SynthesizeSsmlToStreamAsync(synthesizer, str2, &operation_ss_stream);
     todo_wine ok(hr == S_OK, "ISpeechSynthesizer_SynthesizeSsmlToStreamAsync failed, hr %#lx\n", hr);
+    if(FAILED(hr)) goto skip_ss_stream;
+
     await_async_inspectable((IAsyncOperation_IInspectable *)operation_ss_stream,
                              &async_inspectable_handler,
                              &IID_IAsyncOperationCompletedHandler_SpeechSynthesisStream);
@@ -1009,9 +1009,8 @@ static void test_SpeechSynthesizer(void)
     todo_wine ok(!!operation_ss_stream || broken(operation_ss_stream == NULL), "operation_ss_stream had value %p.\n", operation_ss_stream);
     if (hr == S_OK) IAsyncOperation_SpeechSynthesisStream_Release(operation_ss_stream);
 
-    WindowsDeleteString(str2);
-
 skip_ss_stream:
+    WindowsDeleteString(str2);
     WindowsDeleteString(str);
 
     hr = IInspectable_QueryInterface(inspectable, &IID_IClosable, (void **)&closable);
-- 
GitLab


https://gitlab.winehq.org/wine/wine/-/merge_requests/217



More information about the wine-devel mailing list