windows.media.speech: Add ISpeechSynthesizer2 stub.

A recent update for Microsoft Flight Simulator requires this.

Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Andrew Eikum 2022-03-23 11:21:59 -05:00 committed by Alexandre Julliard
parent a83eea9b44
commit 4efd4338e4
3 changed files with 77 additions and 0 deletions

View File

@ -151,6 +151,7 @@ static struct voice_information_vector all_voices =
struct speech_synthesizer struct speech_synthesizer
{ {
ISpeechSynthesizer ISpeechSynthesizer_iface; ISpeechSynthesizer ISpeechSynthesizer_iface;
ISpeechSynthesizer2 ISpeechSynthesizer2_iface;
IClosable IClosable_iface; IClosable IClosable_iface;
LONG ref; LONG ref;
}; };
@ -181,6 +182,13 @@ static HRESULT STDMETHODCALLTYPE speech_synthesizer_QueryInterface(
return S_OK; return S_OK;
} }
if (IsEqualGUID(iid, &IID_ISpeechSynthesizer2))
{
IUnknown_AddRef(iface);
*out = &impl->ISpeechSynthesizer2_iface;
return S_OK;
}
if (IsEqualGUID(iid, &IID_IClosable)) if (IsEqualGUID(iid, &IID_IClosable))
{ {
IUnknown_AddRef(iface); IUnknown_AddRef(iface);
@ -289,6 +297,30 @@ static const struct ISpeechSynthesizerVtbl speech_synthesizer_vtbl =
speech_synthesizer_get_Voice, speech_synthesizer_get_Voice,
}; };
DEFINE_IINSPECTABLE(speech_synthesizer2, ISpeechSynthesizer2, struct speech_synthesizer, ISpeechSynthesizer_iface)
static HRESULT STDMETHODCALLTYPE speech_synthesizer2_get_Options(ISpeechSynthesizer2 *iface, ISpeechSynthesizerOptions **value)
{
FIXME("iface %p, value %p stub.\n", iface, value);
return E_NOTIMPL;
}
static const struct ISpeechSynthesizer2Vtbl speech_synthesizer2_vtbl =
{
/* IUnknown methods */
speech_synthesizer2_QueryInterface,
speech_synthesizer2_AddRef,
speech_synthesizer2_Release,
/* IInspectable methods */
speech_synthesizer2_GetIids,
speech_synthesizer2_GetRuntimeClassName,
speech_synthesizer2_GetTrustLevel,
/* ISpeechSynthesizer2 methods */
speech_synthesizer2_get_Options,
};
static HRESULT STDMETHODCALLTYPE closable_QueryInterface( static HRESULT STDMETHODCALLTYPE closable_QueryInterface(
IClosable *iface, REFIID iid, void **out) IClosable *iface, REFIID iid, void **out)
{ {
@ -467,6 +499,7 @@ static HRESULT STDMETHODCALLTYPE factory_ActivateInstance(
} }
obj->ISpeechSynthesizer_iface.lpVtbl = &speech_synthesizer_vtbl; obj->ISpeechSynthesizer_iface.lpVtbl = &speech_synthesizer_vtbl;
obj->ISpeechSynthesizer2_iface.lpVtbl = &speech_synthesizer2_vtbl;
obj->IClosable_iface.lpVtbl = &closable_vtbl; obj->IClosable_iface.lpVtbl = &closable_vtbl;
obj->ref = 1; obj->ref = 1;
*instance = (IInspectable *)&obj->ISpeechSynthesizer_iface; *instance = (IInspectable *)&obj->ISpeechSynthesizer_iface;

View File

@ -557,6 +557,7 @@ static void test_SpeechSynthesizer(void)
IInspectable *inspectable = NULL, *tmp_inspectable = NULL; IInspectable *inspectable = NULL, *tmp_inspectable = NULL;
IAgileObject *agile_object = NULL, *tmp_agile_object = NULL; IAgileObject *agile_object = NULL, *tmp_agile_object = NULL;
ISpeechSynthesizer *synthesizer; ISpeechSynthesizer *synthesizer;
ISpeechSynthesizer2 *synthesizer2;
IClosable *closable; IClosable *closable;
HMODULE hdll; HMODULE hdll;
HSTRING str, str2; HSTRING str, str2;
@ -673,6 +674,17 @@ static void test_SpeechSynthesizer(void)
hr = IInspectable_QueryInterface(inspectable, &IID_IClosable, (void **)&closable); hr = IInspectable_QueryInterface(inspectable, &IID_IClosable, (void **)&closable);
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
hr = IInspectable_QueryInterface(inspectable, &IID_ISpeechSynthesizer2, (void **)&synthesizer2);
ok(hr == S_OK ||
broken(hr == E_NOINTERFACE), /* requires newer Windows */
"Got unexpected hr %#lx.\n", hr);
if (hr == S_OK)
{
ref = ISpeechSynthesizer2_Release(synthesizer2);
ok(ref == 3, "Got unexpected ref %lu.\n", ref);
}
ref = IClosable_Release(closable); ref = IClosable_Release(closable);
ok(ref == 2, "Got unexpected ref %lu.\n", ref); ok(ref == 2, "Got unexpected ref %lu.\n", ref);

View File

@ -39,6 +39,7 @@ namespace Windows {
interface ISpeechSynthesisStream; interface ISpeechSynthesisStream;
runtimeclass SpeechSynthesizer; runtimeclass SpeechSynthesizer;
runtimeclass VoiceInformation; runtimeclass VoiceInformation;
runtimeclass SpeechSynthesizerOptions;
runtimeclass SpeechSynthesisStream; runtimeclass SpeechSynthesisStream;
} }
} }
@ -112,6 +113,16 @@ namespace Windows {
[propget] HRESULT Voice([out] [retval] VoiceInformation **value); [propget] HRESULT Voice([out] [retval] VoiceInformation **value);
} }
[
contract(Windows.Foundation.UniversalApiContract, 1.0),
exclusiveto(Windows.Media.SpeechSynthesis.SpeechSynthesizer),
uuid(a7c5ecb2-4339-4d6a-bbf8-c7a4f1544c2e)
]
interface ISpeechSynthesizer2 : IInspectable
{
[propget] HRESULT Options([out, retval] SpeechSynthesizerOptions **value);
}
[ [
contract(Windows.Foundation.UniversalApiContract, 1.0), contract(Windows.Foundation.UniversalApiContract, 1.0),
exclusiveto(Windows.Media.SpeechSynthesis.VoiceInformation), exclusiveto(Windows.Media.SpeechSynthesis.VoiceInformation),
@ -126,6 +137,19 @@ namespace Windows {
[propget] HRESULT Gender([out] [retval] VoiceGender* value); [propget] HRESULT Gender([out] [retval] VoiceGender* value);
} }
[
contract(Windows.Foundation.UniversalApiContract, 1.0),
exclusiveto(Windows.Media.SpeechSynthesis.SpeechSynthesizerOptions),
uuid(a0e23871-cc3d-43c9-91b1-ee185324d83d)
]
interface ISpeechSynthesizerOptions : IInspectable
{
[propget] HRESULT IncludeWordBoundaryMetadata([out, retval] boolean *value);
[propput] HRESULT IncludeWordBoundaryMetadata([in] boolean value);
[propget] HRESULT IncludeSentenceBoundaryMetadata([out, retval] boolean *value);
[propput] HRESULT IncludeSentenceBoundaryMetadata([in] boolean value);
}
[ [
contract(Windows.Foundation.UniversalApiContract, 1.0), contract(Windows.Foundation.UniversalApiContract, 1.0),
exclusiveto(Windows.Media.SpeechSynthesis.SpeechSynthesizer), exclusiveto(Windows.Media.SpeechSynthesis.SpeechSynthesizer),
@ -146,6 +170,14 @@ namespace Windows {
[default] interface Windows.Media.SpeechSynthesis.IVoiceInformation; [default] interface Windows.Media.SpeechSynthesis.IVoiceInformation;
} }
[
contract(Windows.Foundation.UniversalApiContract, 1.0),
marshaling_behavior(agile)
]
runtimeclass SpeechSynthesizerOptions
{
[default] interface Windows.Media.SpeechSynthesis.ISpeechSynthesizerOptions;
}
[contract(Windows.Foundation.UniversalApiContract, 1.0)] [contract(Windows.Foundation.UniversalApiContract, 1.0)]
[marshaling_behavior(agile)] [marshaling_behavior(agile)]