Signed-off-by: Bernhard Kölbl besentv@gmail.com --- dlls/windows.media.speech/Makefile.in | 1 + .../speechrecognizerstatechangedrventargs.c | 156 ++++++++++++++++++ .../windows_media_speech_private.h | 2 + 3 files changed, 159 insertions(+) create mode 100644 dlls/windows.media.speech/speechrecognizerstatechangedrventargs.c
diff --git a/dlls/windows.media.speech/Makefile.in b/dlls/windows.media.speech/Makefile.in index 7a8a784d35f..4bfe68f06d9 100644 --- a/dlls/windows.media.speech/Makefile.in +++ b/dlls/windows.media.speech/Makefile.in @@ -7,6 +7,7 @@ C_SRCS = \ speechrecognitionlistconstraint.c \ speechrecognitionresult.c \ speechrecognizer.c \ + speechrecognizerstatechangedrventargs.c \ speechsynthesis.c
IDL_SRCS = classes.idl diff --git a/dlls/windows.media.speech/speechrecognizerstatechangedrventargs.c b/dlls/windows.media.speech/speechrecognizerstatechangedrventargs.c new file mode 100644 index 00000000000..66e8b562566 --- /dev/null +++ b/dlls/windows.media.speech/speechrecognizerstatechangedrventargs.c @@ -0,0 +1,156 @@ +/* WinRT Windows.Media.SpeechRecognition implementation + * + * Copyright 2022 Bernhard Kölbl + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "windows_media_speech_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(speech); + +/* + * + * SpeechRecognizerStateChangedEventArgs + * + */ + +struct speech_recognizer_state_changed_event_args +{ + ISpeechRecognizerStateChangedEventArgs ISpeechRecognizerStateChangedEventArgs_iface; + LONG ref; +}; + +/* + * + * ISpeechRecognizerStateChangedEventArgs + * + */ + +static inline struct speech_recognizer_state_changed_event_args + *impl_from_ISpeechRecognizerStateChangedEventArgs(ISpeechRecognizerStateChangedEventArgs *iface) +{ + return CONTAINING_RECORD(iface, struct speech_recognizer_state_changed_event_args, ISpeechRecognizerStateChangedEventArgs_iface); +} + +static HRESULT STDMETHODCALLTYPE speech_recognizer_state_changed_event_args_QueryInterface( + ISpeechRecognizerStateChangedEventArgs *iface, REFIID iid, void **out) +{ + TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out); + + if (IsEqualGUID(iid, &IID_IUnknown) || + IsEqualGUID(iid, &IID_IInspectable) || + IsEqualGUID(iid, &IID_ISpeechRecognizerStateChangedEventArgs)) + { + IUnknown_AddRef(iface); + *out = iface; + return S_OK; + } + + WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid)); + *out = NULL; + return E_NOINTERFACE; +} + +static ULONG STDMETHODCALLTYPE speech_recognizer_state_changed_event_args_AddRef(ISpeechRecognizerStateChangedEventArgs *iface) +{ + struct speech_recognizer_state_changed_event_args *impl = impl_from_ISpeechRecognizerStateChangedEventArgs(iface); + + ULONG ref = InterlockedIncrement(&impl->ref); + TRACE("iface %p, ref %u.\n", iface, ref); + + return ref; +} + +static ULONG STDMETHODCALLTYPE speech_recognizer_state_changed_event_args_Release(ISpeechRecognizerStateChangedEventArgs *iface) +{ + struct speech_recognizer_state_changed_event_args *impl = impl_from_ISpeechRecognizerStateChangedEventArgs(iface); + + ULONG ref = InterlockedDecrement(&impl->ref); + TRACE("iface %p, ref %u.\n", iface, ref); + + if(!ref) + heap_free(impl); + + return ref; +} + +static HRESULT STDMETHODCALLTYPE speech_recognizer_state_changed_event_args_GetIids( + ISpeechRecognizerStateChangedEventArgs *iface, ULONG *iid_count, IID **iids) +{ + FIXME("iface %p, iid_count %p, iids %p stub!\n", iface, iid_count, iids); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE speech_recognizer_state_changed_event_args_GetRuntimeClassName( + ISpeechRecognizerStateChangedEventArgs *iface, HSTRING *class_name) +{ + FIXME("iface %p, class_name %p stub!\n", iface, class_name); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE speech_recognizer_state_changed_event_args_GetTrustLevel( + ISpeechRecognizerStateChangedEventArgs *iface, TrustLevel *trust_level) +{ + FIXME("iface %p, trust_level %p stub!\n", iface, trust_level); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE speech_recognizer_state_changed_event_args_get_Status( + ISpeechRecognizerStateChangedEventArgs *iface, SpeechRecognizerState* value) +{ + FIXME("iface %p, value %p stub!\n", iface, value); + + return E_NOTIMPL; +} + +static const struct ISpeechRecognizerStateChangedEventArgsVtbl speech_recognizer_state_changed_event_args_vtbl = +{ + /* IUnknown methods */ + speech_recognizer_state_changed_event_args_QueryInterface, + speech_recognizer_state_changed_event_args_AddRef, + speech_recognizer_state_changed_event_args_Release, + /* IInspectable methods */ + speech_recognizer_state_changed_event_args_GetIids, + speech_recognizer_state_changed_event_args_GetRuntimeClassName, + speech_recognizer_state_changed_event_args_GetTrustLevel, + /* ISpeechRecognizerStateChangedEventArgs methods */ + speech_recognizer_state_changed_event_args_get_Status +}; + +HRESULT STDMETHODCALLTYPE speech_recognizer_state_changed_event_args_create_from_iid(REFIID iid, void **obj) +{ + struct speech_recognizer_state_changed_event_args *impl; + HRESULT hr; + + TRACE("iid %p, obj %p.\n", iid, obj); + + if (!(impl = calloc(1, sizeof(*impl)))) + { + *obj = NULL; + return E_OUTOFMEMORY; + } + + impl->ISpeechRecognizerStateChangedEventArgs_iface.lpVtbl = &speech_recognizer_state_changed_event_args_vtbl; + impl->ref = 1; + + hr = ISpeechRecognizerStateChangedEventArgs_QueryInterface(&impl->ISpeechRecognizerStateChangedEventArgs_iface, iid, obj); + ISpeechRecognizerStateChangedEventArgs_Release(&impl->ISpeechRecognizerStateChangedEventArgs_iface); + + return hr; +} \ No newline at end of file diff --git a/dlls/windows.media.speech/windows_media_speech_private.h b/dlls/windows.media.speech/windows_media_speech_private.h index 88eb9a01140..c8c66612c07 100644 --- a/dlls/windows.media.speech/windows_media_speech_private.h +++ b/dlls/windows.media.speech/windows_media_speech_private.h @@ -94,6 +94,8 @@ HRESULT STDMETHODCALLTYPE speech_recognition_result_create_from_iid(REFIID iid, HRESULT STDMETHODCALLTYPE speech_recognizer_create_default(IInspectable **inspectable) DECLSPEC_HIDDEN; HRESULT STDMETHODCALLTYPE speech_recognizer_create(ILanguage *language, ISpeechRecognizer **speechrecognizer) DECLSPEC_HIDDEN;
+HRESULT STDMETHODCALLTYPE speech_recognizer_state_changed_event_args_create_from_iid(REFIID iid, void **obj) DECLSPEC_HIDDEN; + /* * * Windows.Media.SpeechSynthesis