Hello everyone,
this patchset is my first work towars getting speechrecognition to hopefully work soon(tm). It mostly consists of stubs for the least amount of interfaces and classes which are required to get basic recognition working. I also made some "heavier" changes on how the activation factory works based on what seemed logical for it to actually be doing on real WinRT dlls. For activatable classes I refrained from creating a create function, which accepts an IID, because DllGetClassObject isn't implemented as of now and the activation factory seems to always query for the classes default interface implementing IInspectable. Not sure if the general solution I made for this is the best, so this is something to really take a greater look at.
Bernhard
Bernhard Kölbl (11): include/windows.foundation.collections.idl: Add IVector<T> interface. include/windows.foundation.idl: Add IAsyncAction interface. include/windows.globalization.idl: Add ILanguage interface and Language class stubs. include: Add windows.storage.idl. include: Add windows.media.speechrecognition.idl. windows.media.speech: Move speechsynthesis into a seperate file. windows.media.speech: Add SpeechRecognizer stub. windows.media.speech: Add SpeechRecognitionListConstraint stub. windows.media.speech: Add SpeechRecognitionResult stub. windows.media.speech: Add SpeechRecognitionCompilationResult stub. windows.media.speech: Add SpeechRecognizerStateChangedEventArgs stub.
dlls/windows.media.speech/Makefile.in | 8 +- dlls/windows.media.speech/classes.idl | 1 + dlls/windows.media.speech/main.c | 672 ++++++---------- .../speechrecognitioncompilationresult.c | 151 ++++ .../speechrecognitionlistconstraint.c | 329 ++++++++ .../speechrecognitionresult.c | 325 ++++++++ dlls/windows.media.speech/speechrecognizer.c | 497 ++++++++++++ .../speechrecognizerstatechangedrventargs.c | 156 ++++ dlls/windows.media.speech/speechsynthesis.c | 505 ++++++++++++ dlls/windows.media.speech/tests/speech.c | 111 +++ .../windows_media_speech_private.h | 109 +++ include/Makefile.in | 2 + include/windows.foundation.collections.idl | 20 + include/windows.foundation.idl | 23 + include/windows.globalization.idl | 38 + include/windows.media.speechrecognition.idl | 722 ++++++++++++++++++ include/windows.storage.idl | 61 ++ 17 files changed, 3307 insertions(+), 423 deletions(-) create mode 100644 dlls/windows.media.speech/speechrecognitioncompilationresult.c create mode 100644 dlls/windows.media.speech/speechrecognitionlistconstraint.c create mode 100644 dlls/windows.media.speech/speechrecognitionresult.c create mode 100644 dlls/windows.media.speech/speechrecognizer.c create mode 100644 dlls/windows.media.speech/speechrecognizerstatechangedrventargs.c create mode 100644 dlls/windows.media.speech/speechsynthesis.c create mode 100644 dlls/windows.media.speech/windows_media_speech_private.h create mode 100644 include/windows.media.speechrecognition.idl create mode 100644 include/windows.storage.idl
Signed-off-by: Bernhard Kölbl besentv@gmail.com --- include/windows.foundation.collections.idl | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
diff --git a/include/windows.foundation.collections.idl b/include/windows.foundation.collections.idl index 876e15336a2..d671b09e5d2 100644 --- a/include/windows.foundation.collections.idl +++ b/include/windows.foundation.collections.idl @@ -118,6 +118,26 @@ cpp_quote("#endif") HRESULT IndexOf([in, optional] T element, [out] UINT32 *index, [out, retval] BOOLEAN *value); HRESULT GetMany([in] UINT32 start_index, [in] UINT32 items_size, [out] T *items, [out, retval] UINT32 *value); } + + [ + contract(Windows.Foundation.FoundationContract, 1.0), + uuid(913337e9-11a1-4345-a3a2-4e7f956e222d) + ] + interface IVector<T> : IInspectable + { + HRESULT GetAt([in] UINT32 index, [out, retval] T *value); + [propget] HRESULT Size([out, retval] UINT32 *value); + HRESULT GetView([out, retval] IVectorView<T> **value); + HRESULT IndexOf([in, optional] T element, [out] UINT32 *index, [out, retval] BOOLEAN *value); + HRESULT SetAt([in] UINT32 index, [in] T value); + HRESULT InsertAt([in] UINT32 index, T value); + HRESULT RemoveAt([in] UINT32 index); + HRESULT Append([in, optional] T value); + HRESULT RemoveAtEnd(); + HRESULT Clear(); + HRESULT GetMany([in] UINT32 start_index, [in] UINT32 items_size, [out] T *items, [out, retval] UINT32 *value); + HRESULT ReplaceAll([in] T *items); + } } #endif }
Hi Bernhard,
On 1/19/22 14:28, Bernhard Kölbl wrote:
Signed-off-by: Bernhard Kölbl besentv@gmail.com
include/windows.foundation.collections.idl | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
diff --git a/include/windows.foundation.collections.idl b/include/windows.foundation.collections.idl index 876e15336a2..d671b09e5d2 100644 --- a/include/windows.foundation.collections.idl +++ b/include/windows.foundation.collections.idl @@ -118,6 +118,26 @@ cpp_quote("#endif") HRESULT IndexOf([in, optional] T element, [out] UINT32 *index, [out, retval] BOOLEAN *value); HRESULT GetMany([in] UINT32 start_index, [in] UINT32 items_size, [out] T *items, [out, retval] UINT32 *value); }
[
contract(Windows.Foundation.FoundationContract, 1.0),
uuid(913337e9-11a1-4345-a3a2-4e7f956e222d)
]
interface IVector<T> : IInspectable
{
HRESULT GetAt([in] UINT32 index, [out, retval] T *value);
[propget] HRESULT Size([out, retval] UINT32 *value);
HRESULT GetView([out, retval] IVectorView<T> **value);
HRESULT IndexOf([in, optional] T element, [out] UINT32 *index, [out, retval] BOOLEAN *value);
HRESULT SetAt([in] UINT32 index, [in] T value);
HRESULT InsertAt([in] UINT32 index, T value);
HRESULT RemoveAt([in] UINT32 index);
HRESULT Append([in, optional] T value);
HRESULT RemoveAtEnd();
HRESULT Clear();
HRESULT GetMany([in] UINT32 start_index, [in] UINT32 items_size, [out] T *items, [out, retval] UINT32 *value);
HRESULT ReplaceAll([in] T *items);
You're missing the count first argument here.
Signed-off-by: Bernhard Kölbl besentv@gmail.com --- include/windows.foundation.idl | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
diff --git a/include/windows.foundation.idl b/include/windows.foundation.idl index 292522f2c49..0fa86ec315c 100644 --- a/include/windows.foundation.idl +++ b/include/windows.foundation.idl @@ -27,6 +27,12 @@ import "windowscontracts.idl"; /* import "ivectorchangedeventargs.idl"; */ import "windows.foundation.collections.idl";
+namespace Windows { + namespace Foundation { + interface IAsyncAction; + } +} + namespace Windows { namespace Foundation { typedef enum PropertyType PropertyType; @@ -36,6 +42,12 @@ namespace Windows { typedef struct DateTime DateTime; typedef struct TimeSpan TimeSpan;
+ [ + contract(Windows.Foundation.FoundationContract, 1.0), + uuid(a4ed5c81-76c9-40bd-8be6-b1d90fb20ae7) + ] + delegate HRESULT AsyncActionCompletedHandler([in] Windows.Foundation.IAsyncAction *action, [in] AsyncStatus status); + [contract(Windows.Foundation.FoundationContract, 1.0)] enum PropertyType { Empty = 0, @@ -128,6 +140,17 @@ namespace Windows { { HRESULT Close(); } + + [ + contract(Windows.Foundation.FoundationContract, 1.0), + uuid(5a648006-843a-4da9-865b-9d26e5dfad7b) + ] + interface IAsyncAction : IInspectable + { + [propput] HRESULT Completed([in] Windows.Foundation.AsyncActionCompletedHandler *handler); + [propget] HRESULT Completed([out, retval] Windows.Foundation.AsyncActionCompletedHandler **handler); + HRESULT GetResults(); + } } }
Hi Bernhard,
On 1/19/22 14:28, Bernhard Kölbl wrote:
[
contract(Windows.Foundation.FoundationContract, 1.0),
uuid(5a648006-843a-4da9-865b-9d26e5dfad7b)
]
interface IAsyncAction : IInspectable
{
[propput] HRESULT Completed([in] Windows.Foundation.AsyncActionCompletedHandler *handler);
[propget] HRESULT Completed([out, retval] Windows.Foundation.AsyncActionCompletedHandler **handler);
HRESULT GetResults();
}
This should have "requires IAsyncInfo"
Signed-off-by: Bernhard Kölbl besentv@gmail.com --- include/windows.globalization.idl | 38 +++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+)
diff --git a/include/windows.globalization.idl b/include/windows.globalization.idl index c08f7bd27d9..c6b7b96f894 100644 --- a/include/windows.globalization.idl +++ b/include/windows.globalization.idl @@ -29,6 +29,9 @@ import "windows.foundation.idl"; namespace Windows { namespace Globalization { typedef enum DayOfWeek DayOfWeek; + interface ILanguage; + interface ILanguageExtensionSubtags; + runtimeclass Language; } }
@@ -45,5 +48,40 @@ namespace Windows { Friday = 5, Saturday = 6 }; + + [ + contract(Windows.Foundation.FoundationContract, 1.0), + exclusiveto(Windows.Globalization.Language), + uuid(ea79a752-f7c2-4265-b1bd-c4dec4e4f080) + ] + interface ILanguage : IInspectable + { + /* Stub! */ + } + + [ + contract(Windows.Foundation.FoundationContract, 1.0), + exclusiveto(Windows.Globalization.Language), + uuid(7d7daf45-368d-4364-852b-dec927037b85) + ] + interface ILanguageExtensionSubtags : IInspectable + { + /* Stub! */ + } + + [ + activatable(Windows.Foundation.UniversalApiContract, 1.0), + contract(Windows.Foundation.FoundationContract, 1.0), + marshaling_behavior(agile), + /* Fixme: ILanguageStatics, ILanguageStatics2 not defined yet: + static(Windows.Globalization.ILanguageStatics, Windows.Foundation.UniversalApiContract, 1.0), + static(Windows.Globalization.ILanguageStatics2, Windows.Foundation.UniversalApiContract, 1.0), */ + threading(both) + ] + runtimeclass Language + { + [contract(Windows.Foundation.UniversalApiContract, 1.0), default] interface Windows.Globalization.ILanguage; + [contract(Windows.Foundation.UniversalApiContract, 1.0)] interface Windows.Globalization.ILanguageExtensionSubtags; + } } }
Hi Bernhard,
On 1/19/22 14:28, Bernhard Kölbl wrote:
Signed-off-by: Bernhard Kölbl besentv@gmail.com
include/windows.globalization.idl | 38 +++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+)
diff --git a/include/windows.globalization.idl b/include/windows.globalization.idl index c08f7bd27d9..c6b7b96f894 100644 --- a/include/windows.globalization.idl +++ b/include/windows.globalization.idl @@ -29,6 +29,9 @@ import "windows.foundation.idl"; namespace Windows { namespace Globalization { typedef enum DayOfWeek DayOfWeek;
interface ILanguage;
interface ILanguageExtensionSubtags;
}runtimeclass Language; }
@@ -45,5 +48,40 @@ namespace Windows { Friday = 5, Saturday = 6 };
[
contract(Windows.Foundation.FoundationContract, 1.0),
exclusiveto(Windows.Globalization.Language),
uuid(ea79a752-f7c2-4265-b1bd-c4dec4e4f080)
]
interface ILanguage : IInspectable
{
/* Stub! */
}
[
contract(Windows.Foundation.FoundationContract, 1.0),
exclusiveto(Windows.Globalization.Language),
uuid(7d7daf45-368d-4364-852b-dec927037b85)
]
interface ILanguageExtensionSubtags : IInspectable
{
/* Stub! */
}
Any reason to keep these empty? As far as I can see they are simple enough to not pull anything for their full declaration. It'd be better than just a comment that we may easily forget about.
[
activatable(Windows.Foundation.UniversalApiContract, 1.0),
This activatable attribute should actually have three arguments, and the first one be an interface. This is also apparently not supported by widl at the moment, so it would be nice to make it support it first, before adding this class (sorry).
contract(Windows.Foundation.FoundationContract, 1.0),
marshaling_behavior(agile),
/* Fixme: ILanguageStatics, ILanguageStatics2 not defined yet:
static(Windows.Globalization.ILanguageStatics, Windows.Foundation.UniversalApiContract, 1.0),
static(Windows.Globalization.ILanguageStatics2, Windows.Foundation.UniversalApiContract, 1.0), */
For such cases, and for the activatable attribute above, it's also only required to have a declaration of the interface, not an actual definition, so it would be better to just forward declare the ILanguageStatics at the top of the file, and uncomment this.
Also in my version of the SDK I can see that there's ILanguageStatics3 too, starting with contract version 10.0.
threading(both)
]
runtimeclass Language
{
[contract(Windows.Foundation.UniversalApiContract, 1.0), default] interface Windows.Globalization.ILanguage;
[contract(Windows.Foundation.UniversalApiContract, 1.0)] interface Windows.Globalization.ILanguageExtensionSubtags;
}} }
Same here, you only need the interfaces to be forward declared, it would be nice to have them all already I think, as it's not much effort.
Cheers,
And add stubs for StorageFile and IStorageFile.
Signed-off-by: Bernhard Kölbl besentv@gmail.com --- include/Makefile.in | 1 + include/windows.storage.idl | 61 +++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 include/windows.storage.idl
diff --git a/include/Makefile.in b/include/Makefile.in index e5ae8429ed0..9c1ecb516ba 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -782,6 +782,7 @@ SOURCES = \ windows.media.devices.idl \ windows.media.idl \ windows.media.speechsynthesis.idl \ + windows.storage.idl \ windows.storage.streams.idl \ windows.system.idl \ windows.system.userprofile.idl \ diff --git a/include/windows.storage.idl b/include/windows.storage.idl new file mode 100644 index 00000000000..5684f576f63 --- /dev/null +++ b/include/windows.storage.idl @@ -0,0 +1,61 @@ +/* + * 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 + */ + +#ifdef __WIDL__ +#pragma winrt ns_prefix +#endif + +import "inspectable.idl"; +import "eventtoken.idl"; +import "windows.storage.streams.idl"; +import "windows.foundation.idl"; + +namespace Windows +{ + namespace Storage + { + interface IStorageFile; + runtimeclass StorageFile; + } +} + +namespace Windows +{ + namespace Storage + { + [ + contract(Windows.Foundation.FoundationContract, 1.0), + uuid(fa3f6186-4214-428c-a64c-14c9ac7315ea) + ] + interface IStorageFile : IInspectable + { + /* Fixme: Methods and requires missing. Stub! */ + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + /* Fixme: Static Interface not defined yet: + static(Windows.Storage.IStorageFileStatics, Windows.Foundation.UniversalApiContract, 1.0) */ + ] + runtimeclass StorageFile + { + [default] interface Windows.Storage.IStorageFile; + /* Fixme: Intefaces missing. Stub! */ + } + } +}
Hi Bernhard,
On 1/19/22 14:28, Bernhard Kölbl wrote:
+namespace Windows +{
- namespace Storage
- {
[
contract(Windows.Foundation.FoundationContract, 1.0),
uuid(fa3f6186-4214-428c-a64c-14c9ac7315ea)
]
interface IStorageFile : IInspectable
{
/* Fixme: Methods and requires missing. Stub! */
}
Same as before, I think you can get away and a full declaration for this interface without having to declare too many things (although a bit more than with the previous patches).
I think this class also has some "overload" attributes, which may be good to have widl able to parse, even though they could just do nothing for now.
[
contract(Windows.Foundation.UniversalApiContract, 1.0),
/* Fixme: Static Interface not defined yet:
static(Windows.Storage.IStorageFileStatics, Windows.Foundation.UniversalApiContract, 1.0) */
]
runtimeclass StorageFile
{
[default] interface Windows.Storage.IStorageFile;
/* Fixme: Intefaces missing. Stub! */
}
- }
+}
Here too, a full declaration would be better imho, even if it's just a matter of adding the interfaces (looks like it doesn't even need a forward declaration for non-default class interfaces), especially for non-versioned interfaces (those without the contract attribute), which may be required by some requires statements elsewhere.
Cheers,
Signed-off-by: Bernhard Kölbl besentv@gmail.com --- include/Makefile.in | 1 + include/windows.media.speechrecognition.idl | 722 ++++++++++++++++++++ 2 files changed, 723 insertions(+) create mode 100644 include/windows.media.speechrecognition.idl
diff --git a/include/Makefile.in b/include/Makefile.in index 9c1ecb516ba..351e0eceef4 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -781,6 +781,7 @@ SOURCES = \ windows.h \ windows.media.devices.idl \ windows.media.idl \ + windows.media.speechrecognition.idl \ windows.media.speechsynthesis.idl \ windows.storage.idl \ windows.storage.streams.idl \ diff --git a/include/windows.media.speechrecognition.idl b/include/windows.media.speechrecognition.idl new file mode 100644 index 00000000000..5b116cadd24 --- /dev/null +++ b/include/windows.media.speechrecognition.idl @@ -0,0 +1,722 @@ +/* + * 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 + */ + +#ifdef __WIDL__ +#pragma winrt ns_prefix +#endif + +import "inspectable.idl"; +import "windows.globalization.idl"; +import "windows.foundation.idl"; +import "windows.media.idl"; +import "windows.storage.idl"; + +namespace Windows { + namespace Media { + namespace SpeechRecognition { + typedef enum SpeechContinuousRecognitionMode SpeechContinuousRecognitionMode; + typedef enum SpeechRecognitionAudioProblem SpeechRecognitionAudioProblem; + typedef enum SpeechRecognitionConfidence SpeechRecognitionConfidence; + typedef enum SpeechRecognitionConstraintProbability SpeechRecognitionConstraintProbability; + typedef enum SpeechRecognitionConstraintType SpeechRecognitionConstraintType; + typedef enum SpeechRecognitionResultStatus SpeechRecognitionResultStatus; + typedef enum SpeechRecognitionScenario SpeechRecognitionScenario; + typedef enum SpeechRecognizerState SpeechRecognizerState; + interface ISpeechContinuousRecognitionCompletedEventArgs; + interface ISpeechContinuousRecognitionResultGeneratedEventArgs; + interface ISpeechContinuousRecognitionSession; + interface ISpeechRecognitionCompilationResult; + interface ISpeechRecognitionConstraint; + interface ISpeechRecognitionGrammarFileConstraint; + interface ISpeechRecognitionGrammarFileConstraintFactory; + interface ISpeechRecognitionHypothesis; + interface ISpeechRecognitionHypothesisGeneratedEventArgs; + interface ISpeechRecognitionListConstraint; + interface ISpeechRecognitionListConstraintFactory; + interface ISpeechRecognitionQualityDegradingEventArgs; + interface ISpeechRecognitionResult; + interface ISpeechRecognitionResult2; + interface ISpeechRecognitionSemanticInterpretation; + interface ISpeechRecognitionTopicConstraint; + interface ISpeechRecognitionTopicConstraintFactory; + interface ISpeechRecognitionVoiceCommandDefinitionConstraint; + interface ISpeechRecognizer; + interface ISpeechRecognizer2; + interface ISpeechRecognizerFactory; + interface ISpeechRecognizerStateChangedEventArgs; + interface ISpeechRecognizerStatics; + interface ISpeechRecognizerStatics2; + interface ISpeechRecognizerTimeouts; + interface ISpeechRecognizerUIOptions; + runtimeclass SpeechRecognizerUIOptions; + runtimeclass SpeechContinuousRecognitionCompletedEventArgs; + runtimeclass SpeechContinuousRecognitionResultGeneratedEventArgs; + runtimeclass SpeechContinuousRecognitionSession; + runtimeclass SpeechRecognitionCompilationResult; + runtimeclass SpeechRecognitionGrammarFileConstraint; + runtimeclass SpeechRecognitionHypothesis; + runtimeclass SpeechRecognitionHypothesisGeneratedEventArgs; + runtimeclass SpeechRecognitionListConstraint; + runtimeclass SpeechRecognitionQualityDegradingEventArgs; + runtimeclass SpeechRecognitionResult; + runtimeclass SpeechRecognitionSemanticInterpretation; + runtimeclass SpeechRecognitionTopicConstraint; + runtimeclass SpeechRecognitionVoiceCommandDefinitionConstraint; + runtimeclass SpeechRecognizer; + runtimeclass SpeechRecognizerStateChangedEventArgs; + runtimeclass SpeechRecognizerTimeouts; + } + } + namespace Storage + { + interface IStorageFile; + runtimeclass StorageFile; + } +} + +namespace Windows { + namespace Media { + namespace SpeechRecognition { + declare { + interface Windows.Foundation.TypedEventHandler<Windows.Media.SpeechRecognition.SpeechContinuousRecognitionSession*, Windows.Media.SpeechRecognition.SpeechContinuousRecognitionCompletedEventArgs*>; + interface Windows.Foundation.TypedEventHandler<Windows.Media.SpeechRecognition.SpeechContinuousRecognitionSession*, Windows.Media.SpeechRecognition.SpeechContinuousRecognitionResultGeneratedEventArgs*>; + interface Windows.Foundation.Collections.IVector<HSTRING>; + interface Windows.Foundation.Collections.IIterable<HSTRING>; + interface Windows.Foundation.Collections.IIterator<HSTRING>; + interface Windows.Foundation.Collections.IIterable<HSTRING>; + interface Windows.Foundation.Collections.IVectorView<Windows.Media.SpeechRecognition.SpeechRecognitionResult*>; + interface Windows.Foundation.Collections.IVectorView<Windows.Media.SpeechRecognition.ISpeechRecognitionConstraint*>; + /* FIXME - This is broken in Widl.: + interface Windows.Foundation.Collections.IVectorView<HSTRING>; + interface Windows.Foundation.Collections.IMapView<HSTRING, Windows.Foundation.Collections.IVectorView<HSTRING>*>; + */ + interface Windows.Foundation.Collections.IVector<Windows.Media.SpeechRecognition.ISpeechRecognitionConstraint*>; + interface Windows.Foundation.IAsyncOperation<Windows.Media.SpeechRecognition.SpeechRecognitionCompilationResult*>; + interface Windows.Foundation.AsyncOperationCompletedHandler<Windows.Media.SpeechRecognition.SpeechRecognitionCompilationResult*>; + interface Windows.Foundation.IAsyncOperation<Windows.Media.SpeechRecognition.SpeechRecognitionResult*>; + interface Windows.Foundation.AsyncOperationCompletedHandler<Windows.Media.SpeechRecognition.SpeechRecognitionResult*>; + interface Windows.Foundation.IAsyncOperation<Windows.Media.SpeechRecognition.SpeechRecognitionResult*>; + interface Windows.Foundation.TypedEventHandler<Windows.Media.SpeechRecognition.ISpeechRecognizer*, Windows.Media.SpeechRecognition.ISpeechRecognitionQualityDegradingEventArgs*>; + interface Windows.Foundation.TypedEventHandler<Windows.Media.SpeechRecognition.ISpeechRecognizer*, Windows.Media.SpeechRecognition.ISpeechRecognizerStateChangedEventArgs*>; + interface Windows.Foundation.TypedEventHandler<Windows.Media.SpeechRecognition.ISpeechRecognizer2*, Windows.Media.SpeechRecognition.ISpeechRecognitionHypothesisGeneratedEventArgs*>; + interface Windows.Foundation.Collections.IVectorView<Windows.Globalization.Language*>; + interface Windows.Foundation.Collections.IVectorView<Windows.Globalization.Language*>; + interface Windows.Foundation.IAsyncOperation<boolean>; + } + } + } +} + +namespace Windows { + namespace Media { + namespace SpeechRecognition { + + [contract(Windows.Foundation.UniversalApiContract, 1.0)] + enum SpeechContinuousRecognitionMode + { + Default = 0, + PauseOnRecognition = 1 + }; + + [contract(Windows.Foundation.UniversalApiContract, 1.0)] + enum SpeechRecognitionAudioProblem + { + None = 0, + TooNoisy = 1, + NoSignal = 2, + TooLoud = 3, + TooQuiet = 4, + TooFast = 5, + TooSlow = 6, + }; + + [contract(Windows.Foundation.UniversalApiContract, 1.0)] + enum SpeechRecognitionConfidence + { + High = 0, + Medium = 1, + Low = 2, + Rejected = 3, + }; + + [contract(Windows.Foundation.UniversalApiContract, 1.0)] + enum SpeechRecognitionConstraintProbability + { + Default = 0, + Min = 1, + Max = 2, + }; + + [contract(Windows.Foundation.UniversalApiContract, 1.0)] + enum SpeechRecognitionConstraintType + { + Topic = 0, + List = 1, + Grammar = 2, + VoiceCommandDefinition = 3, + }; + + [contract(Windows.Foundation.UniversalApiContract, 1.0)] + enum SpeechRecognitionResultStatus + { + Success = 0, + TopicLanguageNotSupported = 1, + GrammarLanguageMismatch = 2, + GrammarCompilationFailure = 3, + AudioQualityFailure = 4, + UserCanceled = 5, + Unknown = 6, + TimeoutExceeded = 7, + PauseLimitExceeded = 8, + NetworkFailure = 9, + MicrophoneUnavailable = 10, + }; + + [contract(Windows.Foundation.UniversalApiContract, 1.0)] + enum SpeechRecognitionScenario + { + WebSearch = 0, + Dictation = 1, + FormFilling = 2, + }; + + [contract(Windows.Foundation.UniversalApiContract, 1.0)] + enum SpeechRecognizerState + { + Idle = 0, + Capturing = 1, + Processing = 2, + SoundStarted = 3, + SoundEnded = 4, + SpeechDetected = 5, + Paused = 6, + }; + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + exclusiveto(Windows.Media.SpeechRecognition.SpeechContinuousRecognitionCompletedEventArgs), + uuid(e3d069bb-e30c-5e18-424b-7fbe81f8fbd0) + ] + interface ISpeechContinuousRecognitionCompletedEventArgs : IInspectable + { + [propget] HRESULT Status([out, retval] Windows.Media.SpeechRecognition.SpeechRecognitionResultStatus* value); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + exclusiveto(Windows.Media.SpeechRecognition.SpeechContinuousRecognitionResultGeneratedEventArgs), + uuid(19091e1e-6e7e-5a46-40fb-76594f786504) + ] + interface ISpeechContinuousRecognitionResultGeneratedEventArgs : IInspectable + { + [propget] HRESULT Result([out, retval] Windows.Media.SpeechRecognition.SpeechRecognitionResult** value); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + exclusiveto(Windows.Media.SpeechRecognition.SpeechContinuousRecognitionSession), + uuid(6a213c04-6614-49f8-99a2-b5e9b3a085c8) + ] + interface ISpeechContinuousRecognitionSession : IInspectable + { + [propget] HRESULT AutoStopSilenceTimeout([out, retval] Windows.Foundation.TimeSpan *value); + [propput] HRESULT AutoStopSilenceTimeout([in] Windows.Foundation.TimeSpan value); + /*[overload("StartAsync")]*/ HRESULT StartAsync([out, retval] Windows.Foundation.IAsyncAction **action); + /*[overload("StartAsync")]*/ HRESULT StartWithModeAsync([in] Windows.Media.SpeechRecognition.SpeechContinuousRecognitionMode mode, [out, retval] Windows.Foundation.IAsyncAction **action); + HRESULT StopAsync([out, retval] Windows.Foundation.IAsyncAction **action); + HRESULT CancelAsync([out, retval] Windows.Foundation.IAsyncAction **action); + HRESULT PauseAsync([out, retval] Windows.Foundation.IAsyncAction **action); + HRESULT Resume(); + [eventadd] HRESULT Completed( + [in] Windows.Foundation.TypedEventHandler<Windows.Media.SpeechRecognition.SpeechContinuousRecognitionSession*, Windows.Media.SpeechRecognition.SpeechContinuousRecognitionCompletedEventArgs*> *value, + [out, retval] EventRegistrationToken *token); + [eventremove] HRESULT Completed([in] EventRegistrationToken token); + [eventadd] HRESULT ResultGenerated( + [in] Windows.Foundation.TypedEventHandler<Windows.Media.SpeechRecognition.SpeechContinuousRecognitionSession*, Windows.Media.SpeechRecognition.SpeechContinuousRecognitionResultGeneratedEventArgs*> *value, + [out, retval] EventRegistrationToken *token); + [eventremove] HRESULT ResultGenerated([in] EventRegistrationToken token); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + exclusiveto(Windows.Media.SpeechRecognition.SpeechRecognitionCompilationResult), + uuid(407e6c5d-6ac7-4da4-9cc1-2fce32cf7489) + ] + interface ISpeechRecognitionCompilationResult : IInspectable + { + [propget] HRESULT Status([out, retval] Windows.Media.SpeechRecognition.SpeechRecognitionResultStatus* value); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + exclusiveto(Windows.Media.SpeechRecognition.SpeechRecognitionCompilationResult), + uuid(79ac1628-4d68-43c4-8911-40dc4101b55b) + ] + interface ISpeechRecognitionConstraint : IInspectable + { + [propget] HRESULT IsEnabled([out, retval] boolean *value); + [propput] HRESULT IsEnabled([in] boolean value); + [propget] HRESULT Tag([out, retval] HSTRING *value); + [propput] HRESULT Tag([in] HSTRING value); + [propget] HRESULT Type([out, retval] Windows.Media.SpeechRecognition.SpeechRecognitionConstraintType *value); + [propget] HRESULT Probability([out, retval] Windows.Media.SpeechRecognition.SpeechRecognitionConstraintProbability *value); + [propput] HRESULT Probability([in] Windows.Media.SpeechRecognition.SpeechRecognitionConstraintProbability value); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + exclusiveto(Windows.Media.SpeechRecognition.SpeechRecognitionGrammarFileConstraint), + uuid(b5031a8f-85ca-4fa4-b11a-474fc41b3835) + ] + interface ISpeechRecognitionGrammarFileConstraint : IInspectable + requires + Windows.Media.SpeechRecognition.ISpeechRecognitionConstraint + { + [propget] HRESULT GrammarFile([out, retval] Windows.Storage.StorageFile **value); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + exclusiveto(Windows.Media.SpeechRecognition.SpeechRecognitionGrammarFileConstraint), + uuid(3da770eb-c479-4c27-9f19-89974ef392d1) + ] + interface ISpeechRecognitionGrammarFileConstraintFactory : IInspectable + { + HRESULT Create([in] Windows.Storage.StorageFile *file, [out, retval] Windows.Media.SpeechRecognition.SpeechRecognitionGrammarFileConstraint **constraint); + HRESULT CreateWithTag([in] Windows.Storage.StorageFile *file, [in] HSTRING tag, [out, retval] Windows.Media.SpeechRecognition.SpeechRecognitionGrammarFileConstraint **constraint); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + exclusiveto(Windows.Media.SpeechRecognition.SpeechRecognitionGrammarFileConstraint), + uuid(3da770eb-c479-4c27-9f19-89974ef392d1) + ] + interface ISpeechRecognitionHypothesis : IInspectable + { + [propget] HRESULT Text([out, retval] HSTRING *value); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + exclusiveto(Windows.Media.SpeechRecognition.SpeechRecognitionHypothesisGeneratedEventArgs), + uuid(55161a7a-8023-5866-411d-1213bb271476) + ] + interface ISpeechRecognitionHypothesisGeneratedEventArgs : IInspectable + { + [propget] HRESULT Hypothesis([out, retval] Windows.Media.SpeechRecognition.SpeechRecognitionHypothesis **value); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + exclusiveto(Windows.Media.SpeechRecognition.SpeechRecognitionListConstraint), + uuid(09c487e9-e4ad-4526-81f2-4946fb481d98) + ] + interface ISpeechRecognitionListConstraint : IInspectable + { + [propget] HRESULT Commands([out, retval] Windows.Foundation.Collections.IVector<HSTRING> **value); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + exclusiveto(Windows.Media.SpeechRecognition.SpeechRecognitionListConstraint), + uuid(40f3cdc7-562a-426a-9f3b-3b4e282be1d5) + ] + interface ISpeechRecognitionListConstraintFactory : IInspectable + { + HRESULT Create( + [in] + Windows.Foundation.Collections.IIterable<HSTRING> *commands, + [out, retval] Windows.Media.SpeechRecognition.ISpeechRecognitionListConstraint **listconstraint); + + HRESULT CreateWithTag( + [in] Windows.Foundation.Collections.IIterable<HSTRING> *commands, + [in] HSTRING tag, + [out, retval] Windows.Media.SpeechRecognition.ISpeechRecognitionListConstraint **listconstraint); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + exclusiveto(Windows.Media.SpeechRecognition.SpeechRecognitionQualityDegradingEventArgs), + uuid(4fe24105-8c3a-4c7e-8d0a-5bd4f5b14ad8) + ] + interface ISpeechRecognitionQualityDegradingEventArgs : IInspectable + { + [propget] HRESULT Problem([out, retval] Windows.Media.SpeechRecognition.SpeechRecognitionAudioProblem *value); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + exclusiveto(Windows.Media.SpeechRecognition.SpeechRecognitionResult), + uuid(4e303157-034e-4652-857e-d0454cc4beec) + ] + interface ISpeechRecognitionResult : IInspectable + { + [propget] HRESULT Status([out, retval] Windows.Media.SpeechRecognition.SpeechRecognitionResultStatus *value); + [propget] HRESULT Text([out, retval] HSTRING* value); + [propget] HRESULT Confidence([out, retval] Windows.Media.SpeechRecognition.SpeechRecognitionConfidence *value); + [propget] HRESULT SemanticInterpretation([out, retval] Windows.Media.SpeechRecognition.SpeechRecognitionSemanticInterpretation **value); + HRESULT GetAlternatives([in] UINT32 max_amount, [out, retval] Windows.Foundation.Collections.IVectorView<Windows.Media.SpeechRecognition.SpeechRecognitionResult*> **results); + [propget] HRESULT Constraint([out, retval] Windows.Media.SpeechRecognition.ISpeechRecognitionConstraint **value); + [propget] HRESULT RulePath([out, retval] Windows.Foundation.Collections.IVectorView<HSTRING> **value); + [propget] HRESULT RawConfidence([out, retval] DOUBLE *value); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + exclusiveto(Windows.Media.SpeechRecognition.SpeechRecognitionResult), + uuid(af7ed1ba-451b-4166-a0c1-1ffe84032d03) + ] + interface ISpeechRecognitionResult2 : IInspectable + { + [propget] HRESULT PhraseStartTime([out, retval] Windows.Foundation.DateTime *value); + [propget] HRESULT PhraseDuration([out, retval] Windows.Foundation.TimeSpan *value); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + exclusiveto(Windows.Media.SpeechRecognition.SpeechRecognitionSemanticInterpretation), + uuid(aae1da9b-7e32-4c1f-89fe-0c65f486f52e) + ] + interface ISpeechRecognitionSemanticInterpretation : IInspectable + { + /* FIXME - This line can't be compiled because of Widl issues: + [propget] HRESULT Properties([out, retval] Windows.Foundation.Collections.IMapView<HSTRING, Windows.Foundation.Collections.IVectorView<HSTRING>*> **value); + */ + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + exclusiveto(Windows.Media.SpeechRecognition.SpeechRecognitionTopicConstraint), + uuid(bf6fdf19-825d-4e69-a681-36e48cf1c93e) + ] + interface ISpeechRecognitionTopicConstraint : IInspectable + requires + Windows.Media.SpeechRecognition.ISpeechRecognitionConstraint + { + [propget] HRESULT Scenario([out, retval] Windows.Media.SpeechRecognition.SpeechRecognitionScenario *value); + [propget] HRESULT TopicHint([out, retval] HSTRING *value); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + exclusiveto(Windows.Media.SpeechRecognition.SpeechRecognitionTopicConstraint), + uuid(6e6863df-ec05-47d7-a5df-56a3431e58d2) + ] + interface ISpeechRecognitionTopicConstraintFactory : IInspectable + { + HRESULT Create([in] Windows.Media.SpeechRecognition.SpeechRecognitionScenario scenario, [in] HSTRING topicHint, [out, retval] Windows.Media.SpeechRecognition.SpeechRecognitionTopicConstraint **constraint); + HRESULT CreateWithTag([in] Windows.Media.SpeechRecognition.SpeechRecognitionScenario scenario, [in] HSTRING topicHint, [in] HSTRING tag, [out, retval] Windows.Media.SpeechRecognition.SpeechRecognitionTopicConstraint **constraint); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + exclusiveto(Windows.Media.SpeechRecognition.SpeechRecognitionVoiceCommandDefinitionConstraint), + uuid(f2791c2b-1ef4-4ae7-9d77-b6ff10b8a3c2) + ] + interface ISpeechRecognitionVoiceCommandDefinitionConstraint : IInspectable + requires + Windows.Media.SpeechRecognition.ISpeechRecognitionConstraint + { + /* FIXME - Does this interface really have no methods? */ + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + exclusiveto(Windows.Media.SpeechRecognition.SpeechContinuousRecognitionCompletedEventArgs), + uuid(0bc3c9cb-c26a-40f2-aeb5-8096b2e48073) + ] + interface ISpeechRecognizer : IInspectable + requires + Windows.Foundation.IClosable + { + [propget] HRESULT CurrentLanguage([out, retval] Windows.Globalization.Language **value); + [propget] HRESULT Constraints([out, retval] Windows.Foundation.Collections.IVector<Windows.Media.SpeechRecognition.ISpeechRecognitionConstraint*> **value); + [propget] HRESULT Timeouts([out, retval] Windows.Media.SpeechRecognition.ISpeechRecognizerTimeouts **value); + [propget] HRESULT UIOptions([out, retval] Windows.Media.SpeechRecognition.ISpeechRecognizerUIOptions **value); + HRESULT CompileConstraintsAsync([out, retval] Windows.Foundation.IAsyncOperation<Windows.Media.SpeechRecognition.SpeechRecognitionCompilationResult*> **operation); + HRESULT RecognizeAsync([out, retval] Windows.Foundation.IAsyncOperation<Windows.Media.SpeechRecognition.SpeechRecognitionResult*> **operation); + HRESULT RecognizeWithUIAsync([out, retval] Windows.Foundation.IAsyncOperation<Windows.Media.SpeechRecognition.SpeechRecognitionResult*> **operation); + [eventadd] HRESULT RecognitionQualityDegrading( + [in] Windows.Foundation.TypedEventHandler<Windows.Media.SpeechRecognition.ISpeechRecognizer*, Windows.Media.SpeechRecognition.ISpeechRecognitionQualityDegradingEventArgs*> *handler, + [out, retval] EventRegistrationToken* token); + [eventremove] HRESULT RecognitionQualityDegrading( + [in] EventRegistrationToken token); + [eventadd] HRESULT StateChanged( + [in] + Windows.Foundation.TypedEventHandler<Windows.Media.SpeechRecognition.ISpeechRecognizer*, Windows.Media.SpeechRecognition.ISpeechRecognizerStateChangedEventArgs*> *handler, + [out, retval] EventRegistrationToken *token); + [eventremove] HRESULT StateChanged( + [in] EventRegistrationToken token); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + exclusiveto(Windows.Media.SpeechRecognition.SpeechContinuousRecognitionCompletedEventArgs), + uuid(63c9baf1-91e3-4ea4-86a1-7c3867d084a6) + ] + interface ISpeechRecognizer2 : IInspectable + { + [propget] HRESULT ContinuousRecognitionSession([out, retval] Windows.Media.SpeechRecognition.ISpeechContinuousRecognitionSession **value); + [propget] HRESULT State([out, retval] Windows.Media.SpeechRecognition.SpeechRecognizerState *state); + HRESULT StopRecognitionAsync([out, retval] Windows.Foundation.IAsyncAction **action); + [eventadd] HRESULT HypothesisGenerated( + [in] Windows.Foundation.TypedEventHandler<Windows.Media.SpeechRecognition.ISpeechRecognizer2*, Windows.Media.SpeechRecognition.ISpeechRecognitionHypothesisGeneratedEventArgs*> *handler, + [out, retval] EventRegistrationToken *token); + [eventremove] HRESULT HypothesisGenerated( + [in] EventRegistrationToken token); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + exclusiveto(Windows.Media.SpeechRecognition.SpeechRecognizer), + uuid(60c488dd-7fb8-4033-ac70-d046f64818e1) + ] + interface ISpeechRecognizerFactory : IInspectable + { + HRESULT Create( + [in] Windows.Globalization.Language *language, + [out, retval] Windows.Media.SpeechRecognition.ISpeechRecognizer **speechrecognizer); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + exclusiveto(Windows.Media.SpeechRecognition.SpeechRecognizerStateChangedEventArgs), + uuid(563d4f09-ba03-4bad-ad81-ddc6c4dab0c3) + ] + interface ISpeechRecognizerStateChangedEventArgs : IInspectable + { + [propget] HRESULT State([out, retval] Windows.Media.SpeechRecognition.SpeechRecognizerState *value); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + exclusiveto(Windows.Media.SpeechRecognition.SpeechRecognizer), + uuid(87a35eac-a7dc-4b0b-bcc9-24f47c0b7ebf) + ] + interface ISpeechRecognizerStatics : IInspectable + { + [propget] HRESULT SystemSpeechLanguage([out, retval] Windows.Globalization.Language **language); + [propget] HRESULT SupportedTopicLanguages([out, retval] Windows.Foundation.Collections.IVectorView<Windows.Globalization.Language*> **languages); + [propget] HRESULT SupportedGrammarLanguages([out, retval] Windows.Foundation.Collections.IVectorView<Windows.Globalization.Language*> **languages); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + exclusiveto(Windows.Media.SpeechRecognition.SpeechRecognizer), + uuid(1d1b0d95-7565-4ef9-a2f3-ba15162a96cf) + ] + interface ISpeechRecognizerStatics2 : IInspectable + { + HRESULT TrySetSystemSpeechLanguageAsync([in] Windows.Globalization.Language *language, [out, retval] Windows.Foundation.IAsyncOperation<boolean> **operation); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + exclusiveto(Windows.Media.SpeechRecognition.SpeechRecognizerTimeouts), + uuid(2ef76fca-6a3c-4dca-a153-df1bc88a79af) + ] + interface ISpeechRecognizerTimeouts : IInspectable + { + [propget] HRESULT InitialSilenceTimeout([out, retval] Windows.Foundation.TimeSpan *value); + [propput] HRESULT InitialSilenceTimeout([in] Windows.Foundation.TimeSpan value); + [propget] HRESULT EndSilenceTimeout([out, retval] Windows.Foundation.TimeSpan *value); + [propput] HRESULT EndSilenceTimeout([in] Windows.Foundation.TimeSpan value); + [propget] HRESULT BabbleTimeout([out, retval] Windows.Foundation.TimeSpan *value); + [propput] HRESULT BabbleTimeout([in] Windows.Foundation.TimeSpan value); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + exclusiveto(Windows.Media.SpeechRecognition.SpeechRecognizerUIOptions), + uuid(7888d641-b92b-44ba-a25f-d1864630641f) + ] + interface ISpeechRecognizerUIOptions : IInspectable + { + [propget] HRESULT ExampleText([out, retval] HSTRING *value); + [propput] HRESULT ExampleText([in] HSTRING value); + [propget] HRESULT AudiblePrompt([out, retval] HSTRING *value); + [propput] HRESULT AudiblePrompt([in] HSTRING value); + [propget] HRESULT IsReadBackEnabled([out, retval] boolean *value); + [propput] HRESULT IsReadBackEnabled([in] boolean value); + [propget] HRESULT ShowConfirmation([out, retval] boolean *value); + [propput] HRESULT ShowConfirmation([in] boolean value); + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + marshaling_behavior(agile), + threading(both) + ] + runtimeclass SpeechContinuousRecognitionCompletedEventArgs + { + [default] interface Windows.Media.SpeechRecognition.ISpeechContinuousRecognitionCompletedEventArgs; + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + marshaling_behavior(agile), + threading(both) + ] + runtimeclass SpeechContinuousRecognitionResultGeneratedEventArgs + { + [default] interface Windows.Media.SpeechRecognition.ISpeechContinuousRecognitionResultGeneratedEventArgs; + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + marshaling_behavior(agile), + threading(both) + ] + runtimeclass SpeechContinuousRecognitionSession + { + [default] interface Windows.Media.SpeechRecognition.ISpeechContinuousRecognitionSession; + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + marshaling_behavior(agile) + ] + runtimeclass SpeechRecognitionCompilationResult + { + [default] interface Windows.Media.SpeechRecognition.ISpeechRecognitionCompilationResult; + } + + [ + activatable(Windows.Foundation.UniversalApiContract, 1.0), + contract(Windows.Foundation.UniversalApiContract, 1.0), + marshaling_behavior(agile) + ] + runtimeclass SpeechRecognitionGrammarFileConstraint + { + [default] interface Windows.Media.SpeechRecognition.ISpeechRecognitionGrammarFileConstraint; + interface Windows.Media.SpeechRecognition.ISpeechRecognitionConstraint; + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + marshaling_behavior(agile), + threading(both) + ] + runtimeclass SpeechRecognitionHypothesis + { + [default] interface Windows.Media.SpeechRecognition.ISpeechRecognitionHypothesis; + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + marshaling_behavior(agile), + threading(both) + ] + runtimeclass SpeechRecognitionHypothesisGeneratedEventArgs + { + [default] interface Windows.Media.SpeechRecognition.ISpeechRecognitionHypothesisGeneratedEventArgs; + } + + [ + activatable(Windows.Foundation.UniversalApiContract, 1.0), + contract(Windows.Foundation.UniversalApiContract, 1.0), + marshaling_behavior(agile) + ] + runtimeclass SpeechRecognitionListConstraint + { + [default] interface Windows.Media.SpeechRecognition.ISpeechRecognitionListConstraint; + interface Windows.Media.SpeechRecognition.ISpeechRecognitionConstraint; + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + marshaling_behavior(agile) + ] + runtimeclass SpeechRecognitionQualityDegradingEventArgs + { + [default] interface Windows.Media.SpeechRecognition.ISpeechRecognitionQualityDegradingEventArgs; + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + marshaling_behavior(agile) + ] + runtimeclass SpeechRecognitionResult + { + [default] interface Windows.Media.SpeechRecognition.ISpeechRecognitionResult; + [contract(Windows.Foundation.UniversalApiContract, 1.0)] interface Windows.Media.SpeechRecognition.ISpeechRecognitionResult2; + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + marshaling_behavior(agile) + ] + runtimeclass SpeechRecognitionSemanticInterpretation + { + [default] interface Windows.Media.SpeechRecognition.ISpeechRecognitionSemanticInterpretation; + } + + [ + activatable(Windows.Foundation.UniversalApiContract, 1.0), + contract(Windows.Foundation.UniversalApiContract, 1.0), + marshaling_behavior(agile), + ] + runtimeclass SpeechRecognitionTopicConstraint + { + [default] interface Windows.Media.SpeechRecognition.ISpeechRecognitionTopicConstraint; + interface Windows.Media.SpeechRecognition.ISpeechRecognitionConstraint; + } + + [ + activatable(Windows.Foundation.UniversalApiContract, 1.0), + contract(Windows.Foundation.UniversalApiContract, 1.0), + marshaling_behavior(agile), + static(Windows.Media.SpeechRecognition.ISpeechRecognizerStatics, Windows.Foundation.UniversalApiContract, 1.0), + static(Windows.Media.SpeechRecognition.ISpeechRecognizerStatics2, Windows.Foundation.UniversalApiContract, 5.0) + ] + runtimeclass SpeechRecognizer + { + [default] interface Windows.Media.SpeechRecognition.ISpeechRecognizer; + interface Windows.Foundation.IClosable; + [contract(Windows.Foundation.UniversalApiContract, 1.0)] interface Windows.Media.SpeechRecognition.ISpeechRecognizer2; + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + marshaling_behavior(agile) + ] + runtimeclass SpeechRecognizerStateChangedEventArgs + { + [default] interface Windows.Media.SpeechRecognition.ISpeechRecognizerStateChangedEventArgs; + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + marshaling_behavior(agile) + ] + runtimeclass SpeechRecognizerTimeouts + { + [default] interface Windows.Media.SpeechRecognition.ISpeechRecognizerTimeouts; + } + + [ + contract(Windows.Foundation.UniversalApiContract, 1.0), + marshaling_behavior(agile) + ] + runtimeclass SpeechRecognizerUIOptions + { + [default] interface Windows.Media.SpeechRecognition.ISpeechRecognizerUIOptions; + } + } + } +}
Hi Bernhard,
On 1/19/22 14:28, Bernhard Kölbl wrote:
+namespace Windows {
- namespace Media {
namespace SpeechRecognition {
declare {
interface Windows.Foundation.TypedEventHandler<Windows.Media.SpeechRecognition.SpeechContinuousRecognitionSession*, Windows.Media.SpeechRecognition.SpeechContinuousRecognitionCompletedEventArgs*>;
interface Windows.Foundation.TypedEventHandler<Windows.Media.SpeechRecognition.SpeechContinuousRecognitionSession*, Windows.Media.SpeechRecognition.SpeechContinuousRecognitionResultGeneratedEventArgs*>;
interface Windows.Foundation.Collections.IVector<HSTRING>;
interface Windows.Foundation.Collections.IIterable<HSTRING>;
interface Windows.Foundation.Collections.IIterator<HSTRING>;
interface Windows.Foundation.Collections.IIterable<HSTRING>;
interface Windows.Foundation.Collections.IVectorView<Windows.Media.SpeechRecognition.SpeechRecognitionResult*>;
interface Windows.Foundation.Collections.IVectorView<Windows.Media.SpeechRecognition.ISpeechRecognitionConstraint*>;
/* FIXME - This is broken in Widl.:
interface Windows.Foundation.Collections.IVectorView<HSTRING>;
interface Windows.Foundation.Collections.IMapView<HSTRING, Windows.Foundation.Collections.IVectorView<HSTRING>*>;
*/
Would be better to fix widl first then, I think.
Also note that for basic types we have the declare blocks in windows.foundation.idl in order to avoid having to declare them in every other idl. I'm not completely sure to remember how it's done in the windows sdk headers, looks like they have generated interfaces in every header.
Note that I haven't looked at the rest in detail, it's quite long and would be nice to split first. If some parts can be implemented progressively (even if it's just stubs) it's also probably better to interleave the IDL additions with some tests and implementation.
Do this to seperate the activation factory from the COM object implementations.
Signed-off-by: Bernhard Kölbl besentv@gmail.com --- dlls/windows.media.speech/Makefile.in | 3 +- dlls/windows.media.speech/main.c | 565 ++---------------- dlls/windows.media.speech/speechsynthesis.c | 505 ++++++++++++++++ .../windows_media_speech_private.h | 84 +++ 4 files changed, 657 insertions(+), 500 deletions(-) create mode 100644 dlls/windows.media.speech/speechsynthesis.c create mode 100644 dlls/windows.media.speech/windows_media_speech_private.h
diff --git a/dlls/windows.media.speech/Makefile.in b/dlls/windows.media.speech/Makefile.in index 9fbff8e132f..57f2500d651 100644 --- a/dlls/windows.media.speech/Makefile.in +++ b/dlls/windows.media.speech/Makefile.in @@ -2,6 +2,7 @@ MODULE = windows.media.speech.dll IMPORTS = combase uuid
C_SRCS = \ - main.c + main.c \ + speechsynthesis.c
IDL_SRCS = classes.idl diff --git a/dlls/windows.media.speech/main.c b/dlls/windows.media.speech/main.c index b607f9a8203..1e2947fd026 100644 --- a/dlls/windows.media.speech/main.c +++ b/dlls/windows.media.speech/main.c @@ -17,401 +17,27 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
-#include <stdarg.h> +#define WINDOWS_MEDIA_SPEECH_INIT_GUID
-#define COBJMACROS -#include "windef.h" -#include "winbase.h" -#include "winstring.h" -#include "wine/debug.h" -#include "objbase.h" - -#include "initguid.h" -#include "activation.h" - -#define WIDL_using_Windows_Foundation -#define WIDL_using_Windows_Foundation_Collections -#include "windows.foundation.h" -#define WIDL_using_Windows_Media_SpeechSynthesis -#include "windows.media.speechsynthesis.h" +#include "windows_media_speech_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(speech);
-static const char *debugstr_hstring(HSTRING hstr) -{ - const WCHAR *str; - UINT32 len; - if (hstr && !((ULONG_PTR)hstr >> 16)) return "(invalid)"; - str = WindowsGetStringRawBuffer(hstr, &len); - return wine_dbgstr_wn(str, len); -} - -struct voice_information_vector -{ - IVectorView_VoiceInformation IVectorView_VoiceInformation_iface; - LONG ref; -}; - -static inline struct voice_information_vector *impl_from_IVectorView_VoiceInformation(IVectorView_VoiceInformation *iface) -{ - return CONTAINING_RECORD(iface, struct voice_information_vector, IVectorView_VoiceInformation_iface); -} - -static HRESULT STDMETHODCALLTYPE vector_view_voice_information_QueryInterface( - IVectorView_VoiceInformation *iface, REFIID iid, void **out) -{ - TRACE("iface %p, iid %s, out %p stub!\n", iface, debugstr_guid(iid), out); - - if (IsEqualGUID(iid, &IID_IUnknown) || - IsEqualGUID(iid, &IID_IInspectable) || - IsEqualGUID(iid, &IID_IVectorView_VoiceInformation)) - { - 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 vector_view_voice_information_AddRef( - IVectorView_VoiceInformation *iface) -{ - struct voice_information_vector *impl = impl_from_IVectorView_VoiceInformation(iface); - ULONG ref = InterlockedIncrement(&impl->ref); - TRACE("iface %p, ref %u.\n", iface, ref); - return ref; -} - -static ULONG STDMETHODCALLTYPE vector_view_voice_information_Release( - IVectorView_VoiceInformation *iface) -{ - struct voice_information_vector *impl = impl_from_IVectorView_VoiceInformation(iface); - ULONG ref = InterlockedDecrement(&impl->ref); - TRACE("iface %p, ref %u.\n", iface, ref); - return ref; -} - -static HRESULT STDMETHODCALLTYPE vector_view_voice_information_GetIids( - IVectorView_VoiceInformation *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 vector_view_voice_information_GetRuntimeClassName( - IVectorView_VoiceInformation *iface, HSTRING *class_name) -{ - FIXME("iface %p, class_name %p stub!\n", iface, class_name); - return E_NOTIMPL; -} - -static HRESULT STDMETHODCALLTYPE vector_view_voice_information_GetTrustLevel( - IVectorView_VoiceInformation *iface, TrustLevel *trust_level) -{ - FIXME("iface %p, trust_level %p stub!\n", iface, trust_level); - return E_NOTIMPL; -} - -static HRESULT STDMETHODCALLTYPE vector_view_voice_information_GetAt( - IVectorView_VoiceInformation *iface, UINT32 index, IVoiceInformation **value) -{ - FIXME("iface %p, index %#x, value %p stub!\n", iface, index, value); - *value = NULL; - return E_BOUNDS; -} - -static HRESULT STDMETHODCALLTYPE vector_view_voice_information_get_Size( - IVectorView_VoiceInformation *iface, UINT32 *value) -{ - FIXME("iface %p, value %p stub!\n", iface, value); - *value = 0; - return S_OK; -} - -static HRESULT STDMETHODCALLTYPE vector_view_voice_information_IndexOf( - IVectorView_VoiceInformation *iface, IVoiceInformation *element, UINT32 *index, BOOLEAN *found) -{ - FIXME("iface %p, element %p, index %p, found %p stub!\n", iface, element, index, found); - *index = 0; - *found = FALSE; - return S_OK; -} - -static HRESULT STDMETHODCALLTYPE vector_view_voice_information_GetMany( - IVectorView_VoiceInformation *iface, UINT32 start_index, - UINT32 items_size, IVoiceInformation **items, UINT *value) -{ - FIXME("iface %p, start_index %#x, items %p, value %p stub!\n", iface, start_index, items, value); - *value = 0; - return S_OK; -} - -static const struct IVectorView_VoiceInformationVtbl vector_view_voice_information_vtbl = -{ - vector_view_voice_information_QueryInterface, - vector_view_voice_information_AddRef, - vector_view_voice_information_Release, - /* IInspectable methods */ - vector_view_voice_information_GetIids, - vector_view_voice_information_GetRuntimeClassName, - vector_view_voice_information_GetTrustLevel, - /* IVectorView<VoiceInformation> methods */ - vector_view_voice_information_GetAt, - vector_view_voice_information_get_Size, - vector_view_voice_information_IndexOf, - vector_view_voice_information_GetMany, -}; - -static struct voice_information_vector all_voices = -{ - {&vector_view_voice_information_vtbl}, - 0 -}; - -struct speech_synthesizer -{ - ISpeechSynthesizer ISpeechSynthesizer_iface; - IClosable IClosable_iface; - LONG ref; -}; - -static inline struct speech_synthesizer *impl_from_ISpeechSynthesizer(ISpeechSynthesizer *iface) -{ - return CONTAINING_RECORD(iface, struct speech_synthesizer, ISpeechSynthesizer_iface); -} - -static inline struct speech_synthesizer *impl_from_IClosable(IClosable *iface) -{ - return CONTAINING_RECORD(iface, struct speech_synthesizer, IClosable_iface); -} - -static HRESULT STDMETHODCALLTYPE speech_synthesizer_QueryInterface( - ISpeechSynthesizer *iface, REFIID iid, void **out) -{ - struct speech_synthesizer *impl = impl_from_ISpeechSynthesizer(iface); - - TRACE("iface %p, iid %s, out %p stub!\n", iface, debugstr_guid(iid), out); - - if (IsEqualGUID(iid, &IID_IUnknown) || - IsEqualGUID(iid, &IID_IInspectable) || - IsEqualGUID(iid, &IID_ISpeechSynthesizer)) - { - IUnknown_AddRef(iface); - *out = iface; - return S_OK; - } - - if (IsEqualGUID(iid, &IID_IClosable)) - { - IUnknown_AddRef(iface); - *out = &impl->IClosable_iface; - return S_OK; - } - - FIXME("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid)); - *out = NULL; - return E_NOINTERFACE; -} - -static ULONG STDMETHODCALLTYPE speech_synthesizer_AddRef( - ISpeechSynthesizer *iface) -{ - struct speech_synthesizer *impl = impl_from_ISpeechSynthesizer(iface); - ULONG ref = InterlockedIncrement(&impl->ref); - - TRACE("iface %p, ref %u.\n", iface, ref); - - return ref; -} - -static ULONG STDMETHODCALLTYPE speech_synthesizer_Release( - ISpeechSynthesizer *iface) -{ - struct speech_synthesizer *impl = impl_from_ISpeechSynthesizer(iface); - ULONG ref = InterlockedDecrement(&impl->ref); - - TRACE("iface %p, ref %u.\n", iface, ref); - - if (!ref) - free(impl); - - return ref; -} - -static HRESULT STDMETHODCALLTYPE speech_synthesizer_GetIids( - ISpeechSynthesizer *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_synthesizer_GetRuntimeClassName( - ISpeechSynthesizer *iface, HSTRING *class_name) -{ - FIXME("iface %p, class_name %p stub.\n", iface, class_name); - - return E_NOTIMPL; -} - -static HRESULT STDMETHODCALLTYPE speech_synthesizer_GetTrustLevel( - ISpeechSynthesizer *iface, TrustLevel *trust_level) -{ - FIXME("iface %p, trust_level %p stub.\n", iface, trust_level); - - return E_NOTIMPL; -} - -static HRESULT STDMETHODCALLTYPE speech_synthesizer_SynthesizeTextToStreamAsync(ISpeechSynthesizer *iface, - HSTRING text, IAsyncOperation_SpeechSynthesisStream **operation) -{ - FIXME("iface %p, text %p, operation %p stub.\n", iface, text, operation); - - return E_NOTIMPL; -} - -static HRESULT STDMETHODCALLTYPE speech_synthesizer_SynthesizeSsmlToStreamAsync(ISpeechSynthesizer *iface, - HSTRING ssml, IAsyncOperation_SpeechSynthesisStream **operation) -{ - FIXME("iface %p, text %p, operation %p stub.\n", iface, ssml, operation); - - return E_NOTIMPL; -} - -static HRESULT STDMETHODCALLTYPE speech_synthesizer_put_Voice(ISpeechSynthesizer *iface, IVoiceInformation *value) -{ - FIXME("iface %p, value %p stub.\n", iface, value); - - return E_NOTIMPL; -} - -static HRESULT STDMETHODCALLTYPE speech_synthesizer_get_Voice(ISpeechSynthesizer *iface, IVoiceInformation **value) -{ - FIXME("iface %p, value %p stub.\n", iface, value); - - return E_NOTIMPL; -} - -static const struct ISpeechSynthesizerVtbl speech_synthesizer_vtbl = -{ - /* IUnknown methods */ - speech_synthesizer_QueryInterface, - speech_synthesizer_AddRef, - speech_synthesizer_Release, - /* IInspectable methods */ - speech_synthesizer_GetIids, - speech_synthesizer_GetRuntimeClassName, - speech_synthesizer_GetTrustLevel, - /* ISpeechSynthesizer methods */ - speech_synthesizer_SynthesizeTextToStreamAsync, - speech_synthesizer_SynthesizeSsmlToStreamAsync, - speech_synthesizer_put_Voice, - speech_synthesizer_get_Voice, -}; - -static HRESULT STDMETHODCALLTYPE closable_QueryInterface( - IClosable *iface, REFIID iid, void **out) -{ - struct speech_synthesizer *impl = impl_from_IClosable(iface); - - return speech_synthesizer_QueryInterface(&impl->ISpeechSynthesizer_iface, iid, out); -} - -static ULONG STDMETHODCALLTYPE closable_AddRef( - IClosable *iface) -{ - struct speech_synthesizer *impl = impl_from_IClosable(iface); - ULONG ref = InterlockedIncrement(&impl->ref); - - TRACE("iface %p, ref %u.\n", iface, ref); - - return ref; -} - -static ULONG STDMETHODCALLTYPE closable_Release( - IClosable *iface) -{ - struct speech_synthesizer *impl = impl_from_IClosable(iface); - ULONG ref = InterlockedDecrement(&impl->ref); - - TRACE("iface %p, ref %u.\n", iface, ref); - - if (!ref) - free(impl); - - return ref; -} - -static HRESULT STDMETHODCALLTYPE closable_GetIids( - IClosable *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 closable_GetRuntimeClassName( - IClosable *iface, HSTRING *class_name) -{ - FIXME("iface %p, class_name %p stub.\n", iface, class_name); - - return E_NOTIMPL; -} - -static HRESULT STDMETHODCALLTYPE closable_GetTrustLevel( - IClosable *iface, TrustLevel *trust_level) -{ - FIXME("iface %p, trust_level %p stub.\n", iface, trust_level); - - return E_NOTIMPL; -} - -static HRESULT STDMETHODCALLTYPE closable_Close( - IClosable *iface) -{ - FIXME("iface %p stub.\n", iface); - - return E_NOTIMPL; -} - -static const struct IClosableVtbl closable_vtbl = -{ - /* IUnknown methods */ - closable_QueryInterface, - closable_AddRef, - closable_Release, - /* IInspectable methods */ - closable_GetIids, - closable_GetRuntimeClassName, - closable_GetTrustLevel, - /* IClosable methods */ - closable_Close, -}; - -struct windows_media_speech -{ - IActivationFactory IActivationFactory_iface; - IInstalledVoicesStatic IInstalledVoicesStatic_iface; - LONG ref; -}; - -static inline struct windows_media_speech *impl_from_IActivationFactory(IActivationFactory *iface) -{ - return CONTAINING_RECORD(iface, struct windows_media_speech, IActivationFactory_iface); -} +/* + * + * IActivationFactory + * + */
-static inline struct windows_media_speech *impl_from_IInstalledVoicesStatic(IInstalledVoicesStatic *iface) +static inline struct activation_factory *impl_from_IActivationFactory(IActivationFactory *iface) { - return CONTAINING_RECORD(iface, struct windows_media_speech, IInstalledVoicesStatic_iface); + return CONTAINING_RECORD(iface, struct activation_factory, IActivationFactory_iface); }
-static HRESULT STDMETHODCALLTYPE windows_media_speech_QueryInterface( - IActivationFactory *iface, REFIID iid, void **out) +static HRESULT STDMETHODCALLTYPE activation_factory_QueryInterface( + IActivationFactory *iface, REFIID iid, void **out) { - struct windows_media_speech *impl = impl_from_IActivationFactory(iface); + struct activation_factory *impl = impl_from_IActivationFactory(iface);
TRACE("iface %p, iid %s, out %p stub!\n", iface, debugstr_guid(iid), out);
@@ -437,156 +63,96 @@ static HRESULT STDMETHODCALLTYPE windows_media_speech_QueryInterface( return E_NOINTERFACE; }
-static ULONG STDMETHODCALLTYPE windows_media_speech_AddRef( - IActivationFactory *iface) +static ULONG STDMETHODCALLTYPE activation_factory_AddRef( + IActivationFactory *iface) { - struct windows_media_speech *impl = impl_from_IActivationFactory(iface); + struct activation_factory *impl = impl_from_IActivationFactory(iface); ULONG ref = InterlockedIncrement(&impl->ref); TRACE("iface %p, ref %u.\n", iface, ref); return ref; }
-static ULONG STDMETHODCALLTYPE windows_media_speech_Release( - IActivationFactory *iface) +static ULONG STDMETHODCALLTYPE activation_factory_Release( + IActivationFactory *iface) { - struct windows_media_speech *impl = impl_from_IActivationFactory(iface); + struct activation_factory *impl = impl_from_IActivationFactory(iface); ULONG ref = InterlockedDecrement(&impl->ref); TRACE("iface %p, ref %u.\n", iface, ref); return ref; }
-static HRESULT STDMETHODCALLTYPE windows_media_speech_GetIids( - IActivationFactory *iface, ULONG *iid_count, IID **iids) +static HRESULT STDMETHODCALLTYPE activation_factory_GetIids( + IActivationFactory *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 windows_media_speech_GetRuntimeClassName( - IActivationFactory *iface, HSTRING *class_name) +static HRESULT STDMETHODCALLTYPE activation_factory_GetRuntimeClassName( + IActivationFactory *iface, HSTRING *class_name) { FIXME("iface %p, class_name %p stub!\n", iface, class_name); return E_NOTIMPL; }
-static HRESULT STDMETHODCALLTYPE windows_media_speech_GetTrustLevel( - IActivationFactory *iface, TrustLevel *trust_level) +static HRESULT STDMETHODCALLTYPE activation_factory_GetTrustLevel( + IActivationFactory *iface, TrustLevel *trust_level) { FIXME("iface %p, trust_level %p stub!\n", iface, trust_level); return E_NOTIMPL; }
-static HRESULT STDMETHODCALLTYPE windows_media_speech_ActivateInstance( - IActivationFactory *iface, IInspectable **instance) +static HRESULT STDMETHODCALLTYPE activation_factory_ActivateInstance( + IActivationFactory *iface, IInspectable **instance) { - struct speech_synthesizer *obj; + struct activation_factory *impl = impl_from_IActivationFactory(iface);
- TRACE("iface %p, instance %p.\n", iface, instance); + TRACE("iface %p, instance %p\n", iface, instance);
- if (!(obj = calloc(1, sizeof(*obj)))) + if (!instance) + return E_INVALIDARG; + + if (impl) { - *instance = NULL; - return E_OUTOFMEMORY; + return impl->create_instance(instance); }
- obj->ISpeechSynthesizer_iface.lpVtbl = &speech_synthesizer_vtbl; - obj->IClosable_iface.lpVtbl = &closable_vtbl; - obj->ref = 1; - *instance = (IInspectable *)&obj->ISpeechSynthesizer_iface; - return S_OK; + return E_NOINTERFACE; }
static const struct IActivationFactoryVtbl activation_factory_vtbl = { - windows_media_speech_QueryInterface, - windows_media_speech_AddRef, - windows_media_speech_Release, - /* IInspectable methods */ - windows_media_speech_GetIids, - windows_media_speech_GetRuntimeClassName, - windows_media_speech_GetTrustLevel, - /* IActivationFactory methods */ - windows_media_speech_ActivateInstance, + /* IUnknown methods */ + activation_factory_QueryInterface, + activation_factory_AddRef, + activation_factory_Release, + /* IInspectable methods */ + activation_factory_GetIids, + activation_factory_GetRuntimeClassName, + activation_factory_GetTrustLevel, + /* IActivationFactory methods */ + activation_factory_ActivateInstance, };
-static HRESULT STDMETHODCALLTYPE installed_voices_static_QueryInterface( - IInstalledVoicesStatic *iface, REFIID iid, void **out) -{ - struct windows_media_speech *impl = impl_from_IInstalledVoicesStatic(iface); - return windows_media_speech_QueryInterface(&impl->IActivationFactory_iface, iid, out); -} - -static ULONG STDMETHODCALLTYPE installed_voices_static_AddRef( - IInstalledVoicesStatic *iface) -{ - struct windows_media_speech *impl = impl_from_IInstalledVoicesStatic(iface); - return windows_media_speech_AddRef(&impl->IActivationFactory_iface); -} - -static ULONG STDMETHODCALLTYPE installed_voices_static_Release( - IInstalledVoicesStatic *iface) -{ - struct windows_media_speech *impl = impl_from_IInstalledVoicesStatic(iface); - return windows_media_speech_Release(&impl->IActivationFactory_iface); -} - -static HRESULT STDMETHODCALLTYPE installed_voices_static_GetIids( - IInstalledVoicesStatic *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 installed_voices_static_GetRuntimeClassName( - IInstalledVoicesStatic *iface, HSTRING *class_name) -{ - FIXME("iface %p, class_name %p stub!\n", iface, class_name); - return E_NOTIMPL; -} - -static HRESULT STDMETHODCALLTYPE installed_voices_static_GetTrustLevel( - IInstalledVoicesStatic *iface, TrustLevel *trust_level) -{ - FIXME("iface %p, trust_level %p stub!\n", iface, trust_level); - return E_NOTIMPL; -} - -static HRESULT STDMETHODCALLTYPE installed_voices_static_get_AllVoices( - IInstalledVoicesStatic *iface, IVectorView_VoiceInformation **value) -{ - TRACE("iface %p, value %p.\n", iface, value); - *value = &all_voices.IVectorView_VoiceInformation_iface; - IVectorView_VoiceInformation_AddRef(*value); - return S_OK; -} - -static HRESULT STDMETHODCALLTYPE installed_voices_static_get_DefaultVoice( - IInstalledVoicesStatic *iface, IVoiceInformation **value) -{ - FIXME("iface %p, value %p stub!\n", iface, value); - return E_NOTIMPL; -} +/* + * + * ActivationFactory instances + * + */
-static const struct IInstalledVoicesStaticVtbl installed_voices_static_vtbl = +static struct activation_factory speechsynthesis_speechsynthesizer_af = { - installed_voices_static_QueryInterface, - installed_voices_static_AddRef, - installed_voices_static_Release, - /* IInspectable methods */ - installed_voices_static_GetIids, - installed_voices_static_GetRuntimeClassName, - installed_voices_static_GetTrustLevel, - /* IInstalledVoicesStatic methods */ - installed_voices_static_get_AllVoices, - installed_voices_static_get_DefaultVoice, + .IActivationFactory_iface = {&activation_factory_vtbl}, + .IInstalledVoicesStatic_iface = {&installed_voices_static_vtbl}, + .create_instance = speech_synthesizer_create_default, + .ref = 1 };
-static struct windows_media_speech windows_media_speech = -{ - {&activation_factory_vtbl}, - {&installed_voices_static_vtbl}, - 1 -}; +/* + * + * Exports + * + */
HRESULT WINAPI DllGetClassObject(REFCLSID clsid, REFIID riid, void **out) { @@ -598,13 +164,14 @@ HRESULT WINAPI DllGetActivationFactory(HSTRING classid, IActivationFactory **fac { TRACE("classid %s, factory %p.\n", debugstr_hstring(classid), factory);
- if (wcscmp(WindowsGetStringRawBuffer(classid, NULL), L"Windows.Media.SpeechSynthesis.SpeechSynthesizer")) + if (IsEqualClassID(WindowsGetStringRawBuffer(classid, NULL), + L"Windows.Media.SpeechSynthesis.SpeechSynthesizer")) { - ERR("Unknown classid %s.\n", debugstr_hstring(classid)); - return CLASS_E_CLASSNOTAVAILABLE; + *factory = &speechsynthesis_speechsynthesizer_af.IActivationFactory_iface; + IUnknown_AddRef(*factory); + return S_OK; }
- *factory = &windows_media_speech.IActivationFactory_iface; - IUnknown_AddRef(*factory); - return S_OK; + ERR("Unknown classid %s.\n", debugstr_hstring(classid)); + return CLASS_E_CLASSNOTAVAILABLE; } diff --git a/dlls/windows.media.speech/speechsynthesis.c b/dlls/windows.media.speech/speechsynthesis.c new file mode 100644 index 00000000000..e24b42c8914 --- /dev/null +++ b/dlls/windows.media.speech/speechsynthesis.c @@ -0,0 +1,505 @@ +/* WinRT Windows.Media.Speech implementation + * + * Copyright 2021 Rémi Bernon for CodeWeavers + * + * 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); + +/* + * + * IVectorView_VoiceInformation + * + */ + +struct voice_information_vector +{ + IVectorView_VoiceInformation IVectorView_VoiceInformation_iface; + LONG ref; +}; + +static inline struct voice_information_vector *impl_from_IVectorView_VoiceInformation(IVectorView_VoiceInformation *iface) +{ + return CONTAINING_RECORD(iface, struct voice_information_vector, IVectorView_VoiceInformation_iface); +} + +static HRESULT STDMETHODCALLTYPE vector_view_voice_information_QueryInterface( + IVectorView_VoiceInformation *iface, REFIID iid, void **out) +{ + TRACE("iface %p, iid %s, out %p stub!\n", iface, debugstr_guid(iid), out); + + if (IsEqualGUID(iid, &IID_IUnknown) || + IsEqualGUID(iid, &IID_IInspectable) || + IsEqualGUID(iid, &IID_IVectorView_VoiceInformation)) + { + 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 vector_view_voice_information_AddRef( + IVectorView_VoiceInformation *iface) +{ + struct voice_information_vector *impl = impl_from_IVectorView_VoiceInformation(iface); + ULONG ref = InterlockedIncrement(&impl->ref); + TRACE("iface %p, ref %u.\n", iface, ref); + return ref; +} + +static ULONG STDMETHODCALLTYPE vector_view_voice_information_Release( + IVectorView_VoiceInformation *iface) +{ + struct voice_information_vector *impl = impl_from_IVectorView_VoiceInformation(iface); + ULONG ref = InterlockedDecrement(&impl->ref); + TRACE("iface %p, ref %u.\n", iface, ref); + return ref; +} + +static HRESULT STDMETHODCALLTYPE vector_view_voice_information_GetIids( + IVectorView_VoiceInformation *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 vector_view_voice_information_GetRuntimeClassName( + IVectorView_VoiceInformation *iface, HSTRING *class_name) +{ + FIXME("iface %p, class_name %p stub!\n", iface, class_name); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE vector_view_voice_information_GetTrustLevel( + IVectorView_VoiceInformation *iface, TrustLevel *trust_level) +{ + FIXME("iface %p, trust_level %p stub!\n", iface, trust_level); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE vector_view_voice_information_GetAt( + IVectorView_VoiceInformation *iface, UINT32 index, IVoiceInformation **value) +{ + FIXME("iface %p, index %#x, value %p stub!\n", iface, index, value); + *value = NULL; + return E_BOUNDS; +} + +static HRESULT STDMETHODCALLTYPE vector_view_voice_information_get_Size( + IVectorView_VoiceInformation *iface, UINT32 *value) +{ + FIXME("iface %p, value %p stub!\n", iface, value); + *value = 0; + return S_OK; +} + +static HRESULT STDMETHODCALLTYPE vector_view_voice_information_IndexOf( + IVectorView_VoiceInformation *iface, IVoiceInformation *element, UINT32 *index, BOOLEAN *found) +{ + FIXME("iface %p, element %p, index %p, found %p stub!\n", iface, element, index, found); + *index = 0; + *found = FALSE; + return S_OK; +} + +static HRESULT STDMETHODCALLTYPE vector_view_voice_information_GetMany( + IVectorView_VoiceInformation *iface, UINT32 start_index, + UINT32 items_size, IVoiceInformation **items, UINT *value) +{ + FIXME("iface %p, start_index %#x, items %p, value %p stub!\n", iface, start_index, items, value); + *value = 0; + return S_OK; +} + +static const struct IVectorView_VoiceInformationVtbl vector_view_voice_information_vtbl = +{ + vector_view_voice_information_QueryInterface, + vector_view_voice_information_AddRef, + vector_view_voice_information_Release, + /* IInspectable methods */ + vector_view_voice_information_GetIids, + vector_view_voice_information_GetRuntimeClassName, + vector_view_voice_information_GetTrustLevel, + /* IVectorView<VoiceInformation> methods */ + vector_view_voice_information_GetAt, + vector_view_voice_information_get_Size, + vector_view_voice_information_IndexOf, + vector_view_voice_information_GetMany, +}; + +static struct voice_information_vector all_voices = +{ + {&vector_view_voice_information_vtbl}, + 0 +}; + +/* + * + * IInstalledVoicesStatic + * + */ + +static inline struct activation_factory *impl_from_IInstalledVoicesStatic(IInstalledVoicesStatic *iface) +{ + return CONTAINING_RECORD(iface, struct activation_factory, IInstalledVoicesStatic_iface); +} + +static HRESULT STDMETHODCALLTYPE installed_voices_static_QueryInterface( + IInstalledVoicesStatic *iface, REFIID iid, void **out) +{ + struct activation_factory *impl = impl_from_IInstalledVoicesStatic(iface); + + TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out); + + return IActivationFactory_QueryInterface(&impl->IActivationFactory_iface, iid, out); +} + +static ULONG STDMETHODCALLTYPE installed_voices_static_AddRef( + IInstalledVoicesStatic *iface) +{ + struct activation_factory *impl = impl_from_IInstalledVoicesStatic(iface); + + TRACE("iface %p.\n", iface); + + return IActivationFactory_AddRef(&impl->IActivationFactory_iface); +} + +static ULONG STDMETHODCALLTYPE installed_voices_static_Release( + IInstalledVoicesStatic *iface) +{ + struct activation_factory *impl = impl_from_IInstalledVoicesStatic(iface); + + TRACE("iface %p.\n", iface); + + return IActivationFactory_Release(&impl->IActivationFactory_iface); +} + +static HRESULT STDMETHODCALLTYPE installed_voices_static_GetIids( + IInstalledVoicesStatic *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 installed_voices_static_GetRuntimeClassName( + IInstalledVoicesStatic *iface, HSTRING *class_name) +{ + FIXME("iface %p, class_name %p stub!\n", iface, class_name); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE installed_voices_static_GetTrustLevel( + IInstalledVoicesStatic *iface, TrustLevel *trust_level) +{ + FIXME("iface %p, trust_level %p stub!\n", iface, trust_level); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE installed_voices_static_get_AllVoices( + IInstalledVoicesStatic *iface, IVectorView_VoiceInformation **value) +{ + TRACE("iface %p, value %p.\n", iface, value); + *value = &all_voices.IVectorView_VoiceInformation_iface; + IVectorView_VoiceInformation_AddRef(*value); + return S_OK; +} + +static HRESULT STDMETHODCALLTYPE installed_voices_static_get_DefaultVoice( + IInstalledVoicesStatic *iface, IVoiceInformation **value) +{ + FIXME("iface %p, value %p stub!\n", iface, value); + + return E_NOTIMPL; +} + +const struct IInstalledVoicesStaticVtbl installed_voices_static_vtbl = +{ + installed_voices_static_QueryInterface, + installed_voices_static_AddRef, + installed_voices_static_Release, + /* IInspectable methods */ + installed_voices_static_GetIids, + installed_voices_static_GetRuntimeClassName, + installed_voices_static_GetTrustLevel, + /* IInstalledVoicesStatic methods */ + installed_voices_static_get_AllVoices, + installed_voices_static_get_DefaultVoice, +}; + +/* + * + * SpeechSynthesizer + * + */ + +struct speech_synthesizer +{ + ISpeechSynthesizer ISpeechSynthesizer_iface; + IClosable IClosable_iface; + LONG ref; +}; + +/* + * + * ISpeechSynthesizer + * + */ + +static inline struct speech_synthesizer *impl_from_ISpeechSynthesizer(ISpeechSynthesizer *iface) +{ + return CONTAINING_RECORD(iface, struct speech_synthesizer, ISpeechSynthesizer_iface); +} + +static HRESULT STDMETHODCALLTYPE speech_synthesizer_QueryInterface( + ISpeechSynthesizer *iface, REFIID iid, void **out) +{ + struct speech_synthesizer *impl = impl_from_ISpeechSynthesizer(iface); + + TRACE("iface %p, iid %s, out %p stub!\n", iface, debugstr_guid(iid), out); + + if (IsEqualGUID(iid, &IID_IUnknown) || + IsEqualGUID(iid, &IID_IInspectable) || + IsEqualGUID(iid, &IID_ISpeechSynthesizer)) + { + IUnknown_AddRef(iface); + *out = iface; + return S_OK; + } + + if (IsEqualGUID(iid, &IID_IClosable)) + { + IUnknown_AddRef(iface); + *out = &impl->IClosable_iface; + return S_OK; + } + + FIXME("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid)); + *out = NULL; + return E_NOINTERFACE; +} + +static ULONG STDMETHODCALLTYPE speech_synthesizer_AddRef( + ISpeechSynthesizer *iface) +{ + struct speech_synthesizer *impl = impl_from_ISpeechSynthesizer(iface); + ULONG ref = InterlockedIncrement(&impl->ref); + + TRACE("iface %p, ref %u.\n", iface, ref); + + return ref; +} + +static ULONG STDMETHODCALLTYPE speech_synthesizer_Release( + ISpeechSynthesizer *iface) +{ + struct speech_synthesizer *impl = impl_from_ISpeechSynthesizer(iface); + ULONG ref = InterlockedDecrement(&impl->ref); + + TRACE("iface %p, ref %u.\n", iface, ref); + + if (!ref) + free(impl); + + return ref; +} + +static HRESULT STDMETHODCALLTYPE speech_synthesizer_GetIids( + ISpeechSynthesizer *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_synthesizer_GetRuntimeClassName( + ISpeechSynthesizer *iface, HSTRING *class_name) +{ + FIXME("iface %p, class_name %p stub.\n", iface, class_name); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE speech_synthesizer_GetTrustLevel( + ISpeechSynthesizer *iface, TrustLevel *trust_level) +{ + FIXME("iface %p, trust_level %p stub.\n", iface, trust_level); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE speech_synthesizer_SynthesizeTextToStreamAsync(ISpeechSynthesizer *iface, + HSTRING text, IAsyncOperation_SpeechSynthesisStream **operation) +{ + FIXME("iface %p, text %p, operation %p stub.\n", iface, text, operation); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE speech_synthesizer_SynthesizeSsmlToStreamAsync(ISpeechSynthesizer *iface, + HSTRING ssml, IAsyncOperation_SpeechSynthesisStream **operation) +{ + FIXME("iface %p, text %p, operation %p stub.\n", iface, ssml, operation); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE speech_synthesizer_put_Voice(ISpeechSynthesizer *iface, IVoiceInformation *value) +{ + FIXME("iface %p, value %p stub.\n", iface, value); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE speech_synthesizer_get_Voice(ISpeechSynthesizer *iface, IVoiceInformation **value) +{ + FIXME("iface %p, value %p stub.\n", iface, value); + + return E_NOTIMPL; +} + +static const struct ISpeechSynthesizerVtbl speech_synthesizer_vtbl = +{ + /* IUnknown methods */ + speech_synthesizer_QueryInterface, + speech_synthesizer_AddRef, + speech_synthesizer_Release, + /* IInspectable methods */ + speech_synthesizer_GetIids, + speech_synthesizer_GetRuntimeClassName, + speech_synthesizer_GetTrustLevel, + /* ISpeechSynthesizer methods */ + speech_synthesizer_SynthesizeTextToStreamAsync, + speech_synthesizer_SynthesizeSsmlToStreamAsync, + speech_synthesizer_put_Voice, + speech_synthesizer_get_Voice, +}; + +/* + * + * IClosable + * + */ + +static inline struct speech_synthesizer *impl_from_IClosable(IClosable *iface) +{ + return CONTAINING_RECORD(iface, struct speech_synthesizer, IClosable_iface); +} + +static HRESULT STDMETHODCALLTYPE closable_QueryInterface( + IClosable *iface, REFIID iid, void **out) +{ + struct speech_synthesizer *impl = impl_from_IClosable(iface); + + return ISpeechSynthesizer_QueryInterface(&impl->ISpeechSynthesizer_iface, iid, out); +} + +static ULONG STDMETHODCALLTYPE closable_AddRef( + IClosable *iface) +{ + struct speech_synthesizer *impl = impl_from_IClosable(iface); + + TRACE("iface %p.\n", iface); + + return ISpeechSynthesizer_AddRef(&impl->ISpeechSynthesizer_iface); +} + +static ULONG STDMETHODCALLTYPE closable_Release( + IClosable *iface) +{ + struct speech_synthesizer *impl = impl_from_IClosable(iface); + + TRACE("iface %p.\n", iface); + + return ISpeechSynthesizer_Release(&impl->ISpeechSynthesizer_iface); +} + +static HRESULT STDMETHODCALLTYPE closable_GetIids( + IClosable *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 closable_GetRuntimeClassName( + IClosable *iface, HSTRING *class_name) +{ + FIXME("iface %p, class_name %p stub.\n", iface, class_name); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE closable_GetTrustLevel( + IClosable *iface, TrustLevel *trust_level) +{ + FIXME("iface %p, trust_level %p stub.\n", iface, trust_level); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE closable_Close( + IClosable *iface) +{ + FIXME("iface %p stub.\n", iface); + + return E_NOTIMPL; +} + +static const struct IClosableVtbl closable_vtbl = +{ + /* IUnknown methods */ + closable_QueryInterface, + closable_AddRef, + closable_Release, + /* IInspectable methods */ + closable_GetIids, + closable_GetRuntimeClassName, + closable_GetTrustLevel, + /* IClosable methods */ + closable_Close, +}; + +HRESULT STDMETHODCALLTYPE speech_synthesizer_create_default(IInspectable **instance) +{ + struct speech_synthesizer *impl; + HRESULT hr; + + TRACE("instance %p.\n", instance); + + if (!(impl = calloc(1, sizeof(*impl)))) + { + *instance = NULL; + return E_OUTOFMEMORY; + } + + impl->ISpeechSynthesizer_iface.lpVtbl = &speech_synthesizer_vtbl; + impl->IClosable_iface.lpVtbl = &closable_vtbl; + impl->ref = 1; + + hr = ISpeechSynthesizer_QueryInterface(&impl->ISpeechSynthesizer_iface, &IID_ISpeechSynthesizer, (void**)instance); + ISpeechSynthesizer_Release(&impl->ISpeechSynthesizer_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 new file mode 100644 index 00000000000..471eb4ef281 --- /dev/null +++ b/dlls/windows.media.speech/windows_media_speech_private.h @@ -0,0 +1,84 @@ +/* WinRT Windows.Media.Speech private header + * + * 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 + */ + +#ifndef __WINE_WINDOWS_MEDIA_SPEECH_PRIVATE_H +#define __WINE_WINDOWS_MEDIA_SPEECH_PRIVATE_H + +#include "wine/debug.h" +#include "wine/heap.h" + +#include <stdarg.h> + +#define COBJMACROS +#include "windef.h" +#include "winbase.h" +#include "winstring.h" +#include "objbase.h" + +#ifdef WINDOWS_MEDIA_SPEECH_INIT_GUID +#include "initguid.h" +#endif + +#include "activation.h" + +#define WIDL_using_Windows_Foundation +#define WIDL_using_Windows_Foundation_Collections +#include "windows.foundation.h" +#define WIDL_using_Windows_Media_SpeechSynthesis +#include "windows.media.speechsynthesis.h" + +#define IsEqualClassID(classid1, classid2) (!wcscmp(classid1, classid2)) + +static inline const char *debugstr_hstring(HSTRING hstr) +{ + const WCHAR *str; + UINT32 len; + if (hstr && !((ULONG_PTR)hstr >> 16)) return "(invalid)"; + str = WindowsGetStringRawBuffer(hstr, &len); + return wine_dbgstr_wn(str, len); +} + +/* + * + * ActivationFactory + * + */ + +struct activation_factory +{ + /* Factories */ + IActivationFactory IActivationFactory_iface; + /* Static interfaces */ + IInstalledVoicesStatic IInstalledVoicesStatic_iface; + /* Variables */ + HRESULT (*create_instance)(IInspectable **instance); + LONG ref; +}; + +/* + * + * Windows.Media.SpeechSynthesis + * + */ + +extern const struct IInstalledVoicesStaticVtbl installed_voices_static_vtbl; + +HRESULT STDMETHODCALLTYPE speech_synthesizer_create_default(IInspectable **instance) DECLSPEC_HIDDEN; + +#endif
On 1/19/22 14:28, Bernhard Kölbl wrote:
+struct activation_factory +{
- /* Factories */
- IActivationFactory IActivationFactory_iface;
- /* Static interfaces */
- IInstalledVoicesStatic IInstalledVoicesStatic_iface;
- /* Variables */
- HRESULT (*create_instance)(IInspectable **instance);
- LONG ref;
+};
Not really going into the details but this looks weird and wrong, I expect each class to have their own unique activation factory, and each of the factory to implement all the "static" interfaces that are declared for their class, but not for a factory to have the "static" interfaces that are declared on a different class.
Like for instance, the SpeechRecognizer activation factory should only implement the IActivationFactory, ISpeechRecognizerStatics and ISpeechRecognizerStatics2 interfaces, not IInstalledVoicesStatic or IInstalledVoicesStatic2. And the SpeechSynthesizer activation factory should only implement the IActivationFactory, IInstalledVoicesStatic and IInstalledVoicesStatic2 interfaces.
So the factories may still be declared statically, and in separate files, but probably shouldn't share the same structure. Could be all dispatched with some get_<class>_factory functions implemented in separate files and returning the IActivationFactory iface pointer.
Of course, tests could and should tell if this is really how it all works.
Signed-off-by: Bernhard Kölbl besentv@gmail.com --- dlls/windows.media.speech/Makefile.in | 1 + dlls/windows.media.speech/classes.idl | 1 + dlls/windows.media.speech/main.c | 124 +++++ dlls/windows.media.speech/speechrecognizer.c | 497 ++++++++++++++++++ dlls/windows.media.speech/tests/speech.c | 60 +++ .../windows_media_speech_private.h | 14 + 6 files changed, 697 insertions(+) create mode 100644 dlls/windows.media.speech/speechrecognizer.c
diff --git a/dlls/windows.media.speech/Makefile.in b/dlls/windows.media.speech/Makefile.in index 57f2500d651..c1c70538f3e 100644 --- a/dlls/windows.media.speech/Makefile.in +++ b/dlls/windows.media.speech/Makefile.in @@ -3,6 +3,7 @@ IMPORTS = combase uuid
C_SRCS = \ main.c \ + speechrecognizer.c \ speechsynthesis.c
IDL_SRCS = classes.idl diff --git a/dlls/windows.media.speech/classes.idl b/dlls/windows.media.speech/classes.idl index 6c141bf4768..4dd43cf6eed 100644 --- a/dlls/windows.media.speech/classes.idl +++ b/dlls/windows.media.speech/classes.idl @@ -16,4 +16,5 @@
#pragma makedep register
+#include "windows.media.speechrecognition.idl" #include "windows.media.speechsynthesis.idl" diff --git a/dlls/windows.media.speech/main.c b/dlls/windows.media.speech/main.c index 1e2947fd026..9ca4c82588a 100644 --- a/dlls/windows.media.speech/main.c +++ b/dlls/windows.media.speech/main.c @@ -58,6 +58,13 @@ static HRESULT STDMETHODCALLTYPE activation_factory_QueryInterface( return S_OK; }
+ if (IsEqualGUID(iid, &IID_ISpeechRecognizerFactory)) + { + IUnknown_AddRef(iface); + *out = &impl->ISpeechRecognizerFactory_iface; + return S_OK; + } + FIXME("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid)); *out = NULL; return E_NOINTERFACE; @@ -134,12 +141,122 @@ static const struct IActivationFactoryVtbl activation_factory_vtbl = activation_factory_ActivateInstance, };
+/* + * + * ISpeechRecognizerFactory + * + */ + +static inline struct activation_factory *impl_from_ISpeechRecognizerFactory(ISpeechRecognizerFactory *iface) +{ + return CONTAINING_RECORD(iface, struct activation_factory, ISpeechRecognizerFactory_iface); +} + +static HRESULT STDMETHODCALLTYPE speech_recognizer_factory_QueryInterface( + ISpeechRecognizerFactory *iface, REFIID iid, void **out) +{ + struct activation_factory *impl = impl_from_ISpeechRecognizerFactory(iface); + + TRACE("iface %p, iid %s, out %p stub!\n", iface, debugstr_guid(iid), out); + + /* IUnknown_QueryInterface already defined by IActivationFactory_iface. Redirect there. */ + return IActivationFactory_QueryInterface(&impl->IActivationFactory_iface, iid, out); +} + +static ULONG STDMETHODCALLTYPE speech_recognizer_factory_AddRef( + ISpeechRecognizerFactory *iface) +{ + struct activation_factory *impl = impl_from_ISpeechRecognizerFactory(iface); + + TRACE("iface %p\n", iface); + + /* IUnknown_AddRef already defined by IActivationFactory_iface. Redirect there. */ + return IActivationFactory_AddRef(&impl->IActivationFactory_iface); +} + +static ULONG STDMETHODCALLTYPE speech_recognizer_factory_Release( + ISpeechRecognizerFactory *iface) +{ + struct activation_factory *impl = impl_from_ISpeechRecognizerFactory(iface); + + TRACE("iface %p\n", iface); + + /* IUnknown_Release already defined by IActivationFactory_iface. Redirect there. */ + return IActivationFactory_Release(&impl->IActivationFactory_iface); +} + +static HRESULT STDMETHODCALLTYPE speech_recognizer_factory_GetIids( + ISpeechRecognizerFactory *iface, ULONG *iid_count, IID **iids) +{ + struct activation_factory *impl = impl_from_ISpeechRecognizerFactory(iface); + + TRACE("iface %p, iid_count %p, iids %p stub!\n", iface, iid_count, iids); + + /* IInspectable_GetIids already defined by ISpeechRecognizer_iface. Redirect there. */ + return IActivationFactory_GetIids(&impl->IActivationFactory_iface, iid_count, iids); +} + +static HRESULT STDMETHODCALLTYPE speech_recognizer_factory_GetRuntimeClassName( + ISpeechRecognizerFactory *iface, HSTRING *class_name) +{ + struct activation_factory *impl = impl_from_ISpeechRecognizerFactory(iface); + + TRACE("iface %p, class_name %p stub!\n", iface, class_name); + + /* IInspectable_GetRuntimeClassName already defined by IActivationFactory_iface. Redirect there. */ + return IActivationFactory_GetRuntimeClassName(&impl->IActivationFactory_iface, class_name); +} + +static HRESULT STDMETHODCALLTYPE speech_recognizer_factory_GetTrustLevel( + ISpeechRecognizerFactory *iface, TrustLevel *trust_level) +{ + struct activation_factory *impl = impl_from_ISpeechRecognizerFactory(iface); + + TRACE("iface %p, trust_level %p stub!\n", iface, trust_level); + + /* IInspectable_GetTrustLevel already defined by IActivationFactory_iface. Redirect there. */ + return IActivationFactory_GetTrustLevel(&impl->IActivationFactory_iface, trust_level); +} + +static HRESULT STDMETHODCALLTYPE speech_recognizer_factory_Create( + ISpeechRecognizerFactory *iface, + ILanguage *language, + ISpeechRecognizer **speechrecognizer) +{ + TRACE("iface %p, language %p, speechrecognizer %p stub!\n", iface, language, speechrecognizer); + + return speech_recognizer_create(language, speechrecognizer); +} + +static const struct ISpeechRecognizerFactoryVtbl speech_recognizer_factory_vtbl = +{ + /* IUnknown methods */ + speech_recognizer_factory_QueryInterface, + speech_recognizer_factory_AddRef, + speech_recognizer_factory_Release, + /* IInspectable methods */ + speech_recognizer_factory_GetIids, + speech_recognizer_factory_GetRuntimeClassName, + speech_recognizer_factory_GetTrustLevel, + /* ISpeechRecognizerFactory methods */ + speech_recognizer_factory_Create +}; + /* * * ActivationFactory instances * */
+static struct activation_factory speechrecognition_speechrecognizer_af = +{ + .IActivationFactory_iface = {&activation_factory_vtbl}, + .ISpeechRecognizerFactory_iface = {&speech_recognizer_factory_vtbl}, + .IInstalledVoicesStatic_iface = {&installed_voices_static_vtbl}, + .create_instance = speech_recognizer_create_default, + .ref = 1 +}; + static struct activation_factory speechsynthesis_speechsynthesizer_af = { .IActivationFactory_iface = {&activation_factory_vtbl}, @@ -171,6 +288,13 @@ HRESULT WINAPI DllGetActivationFactory(HSTRING classid, IActivationFactory **fac IUnknown_AddRef(*factory); return S_OK; } + else if (IsEqualClassID(WindowsGetStringRawBuffer(classid, NULL), + L"Windows.Media.SpeechRecognition.SpeechRecognizer")) + { + *factory = &speechrecognition_speechrecognizer_af.IActivationFactory_iface; + IUnknown_AddRef(*factory); + return S_OK; + }
ERR("Unknown classid %s.\n", debugstr_hstring(classid)); return CLASS_E_CLASSNOTAVAILABLE; diff --git a/dlls/windows.media.speech/speechrecognizer.c b/dlls/windows.media.speech/speechrecognizer.c new file mode 100644 index 00000000000..b1d80212fd2 --- /dev/null +++ b/dlls/windows.media.speech/speechrecognizer.c @@ -0,0 +1,497 @@ +/* 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); + +/* + * + * SpeechRecognizer + * + */ + +struct speech_recognizer +{ + ISpeechRecognizer ISpeechRecognizer_iface; + IClosable IClosable_iface; + ISpeechRecognizer2 ISpeechRecognizer2_iface; + LONG ref; +}; + +/* + * + * ISpeechRecognizer + * + */ + +static inline struct speech_recognizer *impl_from_ISpeechRecognizer(ISpeechRecognizer *iface) +{ + return CONTAINING_RECORD(iface, struct speech_recognizer, ISpeechRecognizer_iface); +} + +static HRESULT STDMETHODCALLTYPE speech_recognizer_QueryInterface(ISpeechRecognizer *iface, REFIID iid, void **out) +{ + struct speech_recognizer *impl = impl_from_ISpeechRecognizer(iface); + + 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_ISpeechRecognizer)) + { + IUnknown_AddRef(iface); + *out = iface; + return S_OK; + } + + if(IsEqualGUID(iid, &IID_IClosable)) + { + IUnknown_AddRef(iface); + *out = &impl->IClosable_iface; + return S_OK; + } + + if(IsEqualGUID(iid, &IID_ISpeechRecognizer2)) + { + IUnknown_AddRef(iface); + *out = &impl->ISpeechRecognizer2_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_AddRef(ISpeechRecognizer *iface) +{ + struct speech_recognizer *impl = impl_from_ISpeechRecognizer(iface); + + ULONG ref = InterlockedIncrement(&impl->ref); + TRACE("iface %p, ref %u.\n", iface, ref); + + return ref; +} + +static ULONG STDMETHODCALLTYPE speech_recognizer_Release(ISpeechRecognizer *iface) +{ + struct speech_recognizer *impl = impl_from_ISpeechRecognizer(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_GetIids(ISpeechRecognizer *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_GetRuntimeClassName(ISpeechRecognizer *iface, HSTRING *class_name) +{ + FIXME("iface %p, class_name %p stub!\n", iface, class_name); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE speech_recognizer_GetTrustLevel(ISpeechRecognizer *iface, TrustLevel *trust_level) +{ + FIXME("iface %p, trust_level %p stub!\n", iface, trust_level); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE speech_recognizer_get_Constraints(ISpeechRecognizer *iface, + IVector_ISpeechRecognitionConstraint **vector) +{ + FIXME("iface %p, operation %p stub!\n", iface, vector); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE speech_recognizer_get_CurrentLanguage(ISpeechRecognizer *iface, + ILanguage **language) +{ + FIXME("iface %p, operation %p stub!\n", iface, language); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE speech_recognizer_get_Timeouts(ISpeechRecognizer *iface, + ISpeechRecognizerTimeouts **timeouts) +{ + FIXME("iface %p, operation %p stub!\n", iface, timeouts); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE speech_recognizer_get_UIOptions(ISpeechRecognizer *iface, + ISpeechRecognizerUIOptions **options) +{ + FIXME("iface %p, operation %p stub!\n", iface, options); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE speech_recognizer_CompileConstraintsAsync(ISpeechRecognizer *iface, + IAsyncOperation_SpeechRecognitionCompilationResult **operation) +{ + FIXME("iface %p, operation %p stub!\n", iface, operation); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE speech_recognizer_RecognizeAsync(ISpeechRecognizer *iface, + IAsyncOperation_SpeechRecognitionResult **operation) +{ + FIXME("iface %p, operation %p stub!\n", iface, operation); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE speech_recognizer_RecognizeWithUIAsync(ISpeechRecognizer *iface, + IAsyncOperation_SpeechRecognitionResult **operation) +{ + FIXME("iface %p, operation %p stub!\n", iface, operation); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE speech_recognizer_add_RecognitionQualityDegrading(ISpeechRecognizer *iface, + ITypedEventHandler_ISpeechRecognizer_ISpeechRecognitionQualityDegradingEventArgs *handler, EventRegistrationToken *token) +{ + FIXME("iface %p, operation %p, token %p, stub!\n", iface, handler, token); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE speech_recognizer_remove_RecognitionQualityDegrading( + ISpeechRecognizer *iface, EventRegistrationToken token) +{ + FIXME("iface %p, token %#I64x, stub!\n", iface, token); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE speech_recognizer_add_StateChanged(ISpeechRecognizer *iface, + ITypedEventHandler_ISpeechRecognizer_ISpeechRecognizerStateChangedEventArgs *handler, EventRegistrationToken *token) +{ + FIXME("iface %p, operation %p, token %p, stub!\n", iface, handler, token); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE speech_recognizer_remove_StateChanged( + ISpeechRecognizer *iface, EventRegistrationToken token) +{ + FIXME("iface %p, token %p, stub!\n", iface, token); + + return E_NOTIMPL; +} + +static const struct ISpeechRecognizerVtbl speech_recognizer_vtbl = +{ + /* IUnknown methods */ + speech_recognizer_QueryInterface, + speech_recognizer_AddRef, + speech_recognizer_Release, + /* IInspectable methods */ + speech_recognizer_GetIids, + speech_recognizer_GetRuntimeClassName, + speech_recognizer_GetTrustLevel, + /* ISpeechRecognizer methods */ + speech_recognizer_get_CurrentLanguage, + speech_recognizer_get_Constraints, + speech_recognizer_get_Timeouts, + speech_recognizer_get_UIOptions, + speech_recognizer_CompileConstraintsAsync, + speech_recognizer_RecognizeAsync, + speech_recognizer_RecognizeWithUIAsync, + speech_recognizer_add_RecognitionQualityDegrading, + speech_recognizer_remove_RecognitionQualityDegrading, + speech_recognizer_add_StateChanged, + speech_recognizer_remove_StateChanged, +}; + +/* + * + * IClosable + * + */ + +static inline struct speech_recognizer *impl_from_IClosable(IClosable *iface) +{ + return CONTAINING_RECORD(iface, struct speech_recognizer, IClosable_iface); +} + +static HRESULT STDMETHODCALLTYPE closable_QueryInterface( + IClosable *iface, REFIID iid, void **out) +{ + struct speech_recognizer *impl = impl_from_IClosable(iface); + + TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out); + + /* IUnknown_QueryInterface already defined by ISpeechRecognizer_iface. Redirect there. */ + return ISpeechRecognizer_QueryInterface(&impl->ISpeechRecognizer_iface, iid, out); +} + +static ULONG STDMETHODCALLTYPE closable_AddRef( + IClosable *iface) +{ + struct speech_recognizer *impl = impl_from_IClosable(iface); + + TRACE("iface %p.\n", iface); + + /* IUnknown_AddRef already defined by ISpeechRecognizer_iface. Redirect there. */ + return ISpeechRecognizer_AddRef(&impl->ISpeechRecognizer_iface); +} + +static ULONG STDMETHODCALLTYPE closable_Release( + IClosable *iface) +{ + struct speech_recognizer *impl = impl_from_IClosable(iface); + + TRACE("iface %p.\n", iface); + + /* IUnknown_Release already defined by ISpeechRecognizer_iface. Redirect there. */ + return ISpeechRecognizer_Release(&impl->ISpeechRecognizer_iface); +} + +static HRESULT STDMETHODCALLTYPE closable_GetIids( + IClosable *iface, ULONG *iid_count, IID **iids) +{ + struct speech_recognizer *impl = impl_from_IClosable(iface); + + TRACE("iface %p, iid_count %p, iids %p stub!\n", iface, iid_count, iids); + + /* IInspectable_GetIids already defined by ISpeechRecognizer_iface. Redirect there. */ + return ISpeechRecognizer_GetIids(&impl->ISpeechRecognizer_iface, iid_count, iids); +} + +static HRESULT STDMETHODCALLTYPE closable_GetRuntimeClassName( + IClosable *iface, HSTRING *class_name) +{ + struct speech_recognizer *impl = impl_from_IClosable(iface); + + TRACE("iface %p, class_name %p stub!\n", iface, class_name); + + /* IInspectable_GetRuntimeClassName already defined by ISpeechRecognizer_iface. Redirect there. */ + return ISpeechRecognizer_GetRuntimeClassName(&impl->ISpeechRecognizer_iface, class_name); +} + +static HRESULT STDMETHODCALLTYPE closable_GetTrustLevel( + IClosable *iface, TrustLevel *trust_level) +{ + struct speech_recognizer *impl = impl_from_IClosable(iface); + + TRACE("iface %p, trust_level %p stub!\n", iface, trust_level); + + /* IInspectable_GetTrustLevel already defined by ISpeechRecognizer_iface. Redirect there. */ + return ISpeechRecognizer_GetTrustLevel(&impl->ISpeechRecognizer_iface, trust_level); +} + +static HRESULT STDMETHODCALLTYPE closable_Close( + IClosable *iface) +{ + FIXME("iface %p stub.\n", iface); + + return E_NOTIMPL; +} + +static const struct IClosableVtbl closable_vtbl = +{ + /* IUnknown methods */ + closable_QueryInterface, + closable_AddRef, + closable_Release, + /* IInspectable methods */ + closable_GetIids, + closable_GetRuntimeClassName, + closable_GetTrustLevel, + /* IClosable methods */ + closable_Close, +}; + +/* + * + * ISpeechRecognizer2 + * + */ + +static inline struct speech_recognizer *impl_from_ISpeechRecognizer2(ISpeechRecognizer2 *iface) +{ + return CONTAINING_RECORD(iface, struct speech_recognizer, ISpeechRecognizer2_iface); +} + +static HRESULT STDMETHODCALLTYPE speech_recognizer2_QueryInterface(ISpeechRecognizer2 *iface, REFIID iid, void **out) +{ + struct speech_recognizer *impl = impl_from_ISpeechRecognizer2(iface); + + TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out); + + /* IUnknown_QueryInterface already defined by ISpeechRecognizer_iface. Redirect there. */ + return ISpeechRecognizer_QueryInterface(&impl->ISpeechRecognizer_iface, iid, out); +} + +static ULONG STDMETHODCALLTYPE speech_recognizer2_AddRef(ISpeechRecognizer2 *iface) +{ + struct speech_recognizer *impl = impl_from_ISpeechRecognizer2(iface); + + TRACE("iface %p.\n", iface); + + /* IUnknown_AddRef already defined by ISpeechRecognizer_iface. Redirect there. */ + return ISpeechRecognizer_AddRef(&impl->ISpeechRecognizer_iface); +} + +static ULONG STDMETHODCALLTYPE speech_recognizer2_Release(ISpeechRecognizer2 *iface) +{ + struct speech_recognizer *impl = impl_from_ISpeechRecognizer2(iface); + + TRACE("iface %p.\n", iface); + + /* IUnknown_Release already defined by ISpeechRecognizer_iface. Redirect there. */ + return ISpeechRecognizer_Release(&impl->ISpeechRecognizer_iface); +} + +static HRESULT STDMETHODCALLTYPE speech_recognizer2_GetIids(ISpeechRecognizer2 *iface, ULONG *iid_count, IID **iids) +{ + struct speech_recognizer *impl = impl_from_ISpeechRecognizer2(iface); + + TRACE("iface %p, iid_count %p, iids %p stub!\n", iface, iid_count, iids); + + /* IInspectable_GetIids already defined by ISpeechRecognizer_iface. Redirect there. */ + return ISpeechRecognizer_GetIids(&impl->ISpeechRecognizer_iface, iid_count, iids); +} + +static HRESULT STDMETHODCALLTYPE speech_recognizer2_GetRuntimeClassName(ISpeechRecognizer2 *iface, HSTRING *class_name) +{ + struct speech_recognizer *impl = impl_from_ISpeechRecognizer2(iface); + + TRACE("iface %p, class_name %p stub!\n", iface, class_name); + + /* IInspectable_GetRuntimeClassName already defined by ISpeechRecognizer_iface. Redirect there. */ + return ISpeechRecognizer_GetRuntimeClassName(&impl->ISpeechRecognizer_iface, class_name); +} + +static HRESULT STDMETHODCALLTYPE speech_recognizer2_GetTrustLevel(ISpeechRecognizer2 *iface, TrustLevel *trust_level) +{ + struct speech_recognizer *impl = impl_from_ISpeechRecognizer2(iface); + + TRACE("iface %p, trust_level %p stub!\n", iface, trust_level); + + /* IInspectable_GetTrustLevel already defined by ISpeechRecognizer_iface. Redirect there. */ + return ISpeechRecognizer_GetTrustLevel(&impl->ISpeechRecognizer_iface, trust_level); +} + +static HRESULT STDMETHODCALLTYPE speech_recognizer2_get_ContinuousRecognitionSession(ISpeechRecognizer2 *iface, + ISpeechContinuousRecognitionSession **session) +{ + FIXME("iface %p, session %p stub!\n", iface, session); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE speech_recognizer2_get_State(ISpeechRecognizer2 *iface, + SpeechRecognizerState *state) +{ + FIXME("iface %p, state %p stub!\n", iface, state); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE speech_recognizer2_StopRecognitionAsync(ISpeechRecognizer2 *iface, + IAsyncAction **action) +{ + FIXME("iface %p, action %p stub!\n", iface, action); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE speech_recognizer2_add_HypothesisGenerated(ISpeechRecognizer2 *iface, + ITypedEventHandler_ISpeechRecognizer2_ISpeechRecognitionHypothesisGeneratedEventArgs *handler, EventRegistrationToken *token) +{ + FIXME("iface %p, operation %p, token %p, stub!\n", iface, handler, token); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE speech_recognizer2_remove_HypothesisGenerated( + ISpeechRecognizer2 *iface, EventRegistrationToken token) +{ + FIXME("iface %p, token %#I64x, stub!\n", iface, token); + + return E_NOTIMPL; +} + +static const struct ISpeechRecognizer2Vtbl speech_recognizer2_vtbl = +{ + /* IUnknown methods */ + speech_recognizer2_QueryInterface, + speech_recognizer2_AddRef, + speech_recognizer2_Release, + /* IInspectable methods */ + speech_recognizer2_GetIids, + speech_recognizer2_GetRuntimeClassName, + speech_recognizer2_GetTrustLevel, + /* ISpeechRecognizer2 methods */ + speech_recognizer2_get_ContinuousRecognitionSession, + speech_recognizer2_get_State, + speech_recognizer2_StopRecognitionAsync, + speech_recognizer2_add_HypothesisGenerated, + speech_recognizer2_remove_HypothesisGenerated, +}; + +HRESULT STDMETHODCALLTYPE speech_recognizer_create_default(IInspectable **inspectable) +{ + TRACE("inspectable %p stub!\n", inspectable); + + return speech_recognizer_create(NULL, (ISpeechRecognizer**)inspectable); +} + +HRESULT STDMETHODCALLTYPE speech_recognizer_create(ILanguage *language, ISpeechRecognizer **speechrecognizer) +{ + struct speech_recognizer *impl; + HRESULT hr; + + TRACE("language %p, speechrecognizer %p stub!\n", language, speechrecognizer); + + if (!(impl = calloc(1, sizeof(*impl)))) + { + *speechrecognizer = NULL; + return E_OUTOFMEMORY; + } + + /* Stub! ILanguage not used. */ + + impl->ISpeechRecognizer_iface.lpVtbl = &speech_recognizer_vtbl; + impl->IClosable_iface.lpVtbl = &closable_vtbl; + impl->ISpeechRecognizer2_iface.lpVtbl = &speech_recognizer2_vtbl; + impl->ref = 1; + + hr = ISpeechRecognizer_QueryInterface(&impl->ISpeechRecognizer_iface, &IID_ISpeechRecognizer, (void**)speechrecognizer); + ISpeechRecognizer_Release(&impl->ISpeechRecognizer_iface); + + return hr; +} diff --git a/dlls/windows.media.speech/tests/speech.c b/dlls/windows.media.speech/tests/speech.c index 38fd5c90dd0..190c73becee 100644 --- a/dlls/windows.media.speech/tests/speech.c +++ b/dlls/windows.media.speech/tests/speech.c @@ -31,6 +31,8 @@ #include "windows.foundation.h" #define WIDL_using_Windows_Media_SpeechSynthesis #include "windows.media.speechsynthesis.h" +#define WIDL_using_Windows_Media_SpeechRecognition +#include "windows.media.speechrecognition.h"
#include "wine/test.h"
@@ -201,8 +203,66 @@ static void test_VoiceInformation(void) RoUninitialize(); }
+static void test_SpeechRecognizer(void) +{ + static const WCHAR *speech_recognition_name = L"Windows.Media.SpeechRecognition.SpeechRecognizer"; + ISpeechRecognizerFactory *sr_factory = NULL; + ISpeechRecognizer *recognizer = NULL; + ISpeechRecognizer2 *recognizer2 = NULL; + IActivationFactory *factory = NULL; + IInspectable *inspectable = NULL; + IClosable *closable = NULL; + HSTRING str; + HRESULT hr; + LONG ref; + + hr = RoInitialize(RO_INIT_MULTITHREADED); + ok(hr == S_OK, "RoInitialize failed, hr %#x\n", hr); + + hr = WindowsCreateString(speech_recognition_name, wcslen(speech_recognition_name), &str); + ok(hr == S_OK, "WindowsCreateString failed, hr %#x\n", hr); + + hr = RoGetActivationFactory(str, &IID_IActivationFactory, (void **)&factory); + ok(hr == S_OK, "RoGetActivationFactory failed, hr %#x\n", hr); + + hr = IActivationFactory_QueryInterface(factory, &IID_ISpeechRecognizerFactory, (void **)&sr_factory); + ok(hr == S_OK, "IActivationFactory_QueryInterface IID_ISpeechRecognizer failed, hr %#x\n", hr); + + ISpeechRecognizerFactory_Release(sr_factory); + IActivationFactory_Release(factory); + + hr = RoActivateInstance(str, &inspectable); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + + hr = IInspectable_QueryInterface(inspectable, &IID_ISpeechRecognizer, (void **)&recognizer); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + + hr = IInspectable_QueryInterface(inspectable, &IID_ISpeechRecognizer2, (void **)&recognizer2); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + + hr = IInspectable_QueryInterface(inspectable, &IID_IClosable, (void **)&closable); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + + ref = IClosable_Release(closable); + ok(ref == 3, "Got unexpected ref %u.\n", ref); + + ref = ISpeechRecognizer2_Release(recognizer2); + ok(ref == 2, "Got unexpected ref %u.\n", ref); + + ref = ISpeechRecognizer_Release(recognizer); + ok(ref == 1, "Got unexpected ref %u.\n", ref); + + ref = IInspectable_Release(inspectable); + ok(!ref, "Got unexpected ref %u.\n", ref); + + WindowsDeleteString(str); + + RoUninitialize(); +} + START_TEST(speech) { test_SpeechSynthesizer(); test_VoiceInformation(); + test_SpeechRecognizer(); } diff --git a/dlls/windows.media.speech/windows_media_speech_private.h b/dlls/windows.media.speech/windows_media_speech_private.h index 471eb4ef281..02cababb7d5 100644 --- a/dlls/windows.media.speech/windows_media_speech_private.h +++ b/dlls/windows.media.speech/windows_media_speech_private.h @@ -40,8 +40,12 @@ #define WIDL_using_Windows_Foundation #define WIDL_using_Windows_Foundation_Collections #include "windows.foundation.h" +#define WIDL_using_Windows_Globalization +#include "windows.globalization.h" #define WIDL_using_Windows_Media_SpeechSynthesis #include "windows.media.speechsynthesis.h" +#define WIDL_using_Windows_Media_SpeechRecognition +#include "windows.media.speechrecognition.h"
#define IsEqualClassID(classid1, classid2) (!wcscmp(classid1, classid2))
@@ -64,6 +68,7 @@ struct activation_factory { /* Factories */ IActivationFactory IActivationFactory_iface; + ISpeechRecognizerFactory ISpeechRecognizerFactory_iface; /* Static interfaces */ IInstalledVoicesStatic IInstalledVoicesStatic_iface; /* Variables */ @@ -71,6 +76,15 @@ struct activation_factory LONG ref; };
+/* + * + * Windows.Media.SpeechRecognition + * + */ + +HRESULT STDMETHODCALLTYPE speech_recognizer_create_default(IInspectable **inspectable) DECLSPEC_HIDDEN; +HRESULT STDMETHODCALLTYPE speech_recognizer_create(ILanguage *language, ISpeechRecognizer **speechrecognizer) DECLSPEC_HIDDEN; + /* * * Windows.Media.SpeechSynthesis
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=105396
Your paranoid android.
=== w8 (32 bit report) ===
windows.media.speech: speech.c:226: Test failed: RoGetActivationFactory failed, hr 0x80040154 0c84:speech: unhandled exception c0000005 at 00401D1E
=== w8adm (32 bit report) ===
windows.media.speech: speech.c:226: Test failed: RoGetActivationFactory failed, hr 0x80040154 0cac:speech: unhandled exception c0000005 at 00401D1E
=== w864 (32 bit report) ===
windows.media.speech: speech.c:226: Test failed: RoGetActivationFactory failed, hr 0x80040154 0b2c:speech: unhandled exception c0000005 at 00401D1E
=== w1064v1809 (32 bit report) ===
windows.media.speech: speech.c:235: Test failed: Got unexpected hr 0x800455a0. 19cc:speech: unhandled exception c0000005 at 00401DCD
=== w1064 (32 bit report) ===
windows.media.speech: speech.c:235: Test failed: Got unexpected hr 0x800455a0. 17f0:speech: unhandled exception c0000005 at 00401DCD
=== w1064_tsign (32 bit report) ===
windows.media.speech: speech.c:235: Test failed: Got unexpected hr 0x800455a0.
=== w864 (64 bit report) ===
windows.media.speech: speech.c:226: Test failed: RoGetActivationFactory failed, hr 0x80040154 0a8c:speech: unhandled exception c0000005 at 0000000000401B97
=== w1064v1809 (64 bit report) ===
windows.media.speech: speech.c:235: Test failed: Got unexpected hr 0x800455a0. 1a30:speech: unhandled exception c0000005 at 0000000000401C2B
=== w1064 (64 bit report) ===
windows.media.speech: speech.c:235: Test failed: Got unexpected hr 0x800455a0. 01e0:speech: unhandled exception c0000005 at 0000000000401C2B
=== w1064_2qxl (64 bit report) ===
windows.media.speech: speech.c:235: Test failed: Got unexpected hr 0x800455a0. 0c6c:speech: unhandled exception c0000005 at 0000000000401C2B
=== w1064_tsign (64 bit report) ===
windows.media.speech: speech.c:235: Test failed: Got unexpected hr 0x800455a0. 0c74:speech: unhandled exception c0000005 at 0000000000401C2B
=== w10pro64_ar (64 bit report) ===
windows.media.speech: speech.c:235: Test failed: Got unexpected hr 0x800455a0. 1f04:speech: unhandled exception c0000005 at 0000000000401C2B
=== w10pro64_he (64 bit report) ===
windows.media.speech: speech.c:235: Test failed: Got unexpected hr 0x800455a0. 16e4:speech: unhandled exception c0000005 at 0000000000401C2B
=== w10pro64_ja (64 bit report) ===
windows.media.speech: speech.c:235: Test failed: Got unexpected hr 0x800455a0. 2010:speech: unhandled exception c0000005 at 0000000000401C2B
=== w10pro64_zh_CN (64 bit report) ===
windows.media.speech: speech.c:235: Test failed: Got unexpected hr 0x800455a0. 1e18:speech: unhandled exception c0000005 at 0000000000401C2B
Signed-off-by: Bernhard Kölbl besentv@gmail.com --- dlls/windows.media.speech/Makefile.in | 1 + dlls/windows.media.speech/main.c | 137 ++++++++ .../speechrecognitionlistconstraint.c | 329 ++++++++++++++++++ dlls/windows.media.speech/tests/speech.c | 51 +++ .../windows_media_speech_private.h | 5 + 5 files changed, 523 insertions(+) create mode 100644 dlls/windows.media.speech/speechrecognitionlistconstraint.c
diff --git a/dlls/windows.media.speech/Makefile.in b/dlls/windows.media.speech/Makefile.in index c1c70538f3e..0f7a993fee5 100644 --- a/dlls/windows.media.speech/Makefile.in +++ b/dlls/windows.media.speech/Makefile.in @@ -3,6 +3,7 @@ IMPORTS = combase uuid
C_SRCS = \ main.c \ + speechrecognitionlistconstraint.c \ speechrecognizer.c \ speechsynthesis.c
diff --git a/dlls/windows.media.speech/main.c b/dlls/windows.media.speech/main.c index 9ca4c82588a..996838efc9f 100644 --- a/dlls/windows.media.speech/main.c +++ b/dlls/windows.media.speech/main.c @@ -64,6 +64,13 @@ static HRESULT STDMETHODCALLTYPE activation_factory_QueryInterface( *out = &impl->ISpeechRecognizerFactory_iface; return S_OK; } + + if (IsEqualGUID(iid, &IID_ISpeechRecognitionListConstraintFactory) && impl->ISpeechRecognitionListConstraintFactory_iface.lpVtbl) + { + IUnknown_AddRef(iface); + *out = &impl->ISpeechRecognitionListConstraintFactory_iface; + return S_OK; + }
FIXME("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid)); *out = NULL; @@ -242,12 +249,135 @@ static const struct ISpeechRecognizerFactoryVtbl speech_recognizer_factory_vtbl speech_recognizer_factory_Create };
+/* + * + * ISpeechRecognitionListConstraintFactory + * + */ + +static inline struct activation_factory *impl_from_ISpeechRecognitionListConstraintFactory(ISpeechRecognitionListConstraintFactory *iface) +{ + return CONTAINING_RECORD(iface, struct activation_factory, ISpeechRecognitionListConstraintFactory_iface); +} + +static HRESULT STDMETHODCALLTYPE speech_recognition_list_constraint_factory_QueryInterface( + ISpeechRecognitionListConstraintFactory *iface, REFIID iid, void **out) +{ + struct activation_factory *impl = impl_from_ISpeechRecognitionListConstraintFactory(iface); + + TRACE("iface %p, iid %s, out %p stub!\n", iface, debugstr_guid(iid), out); + + /* IUnknown_QueryInterface already defined by IActivationFactory_iface. Redirect there. */ + return IActivationFactory_QueryInterface(&impl->IActivationFactory_iface, iid, out); +} + +static ULONG STDMETHODCALLTYPE speech_recognition_list_constraint_factory_AddRef( + ISpeechRecognitionListConstraintFactory *iface) +{ + struct activation_factory *impl = impl_from_ISpeechRecognitionListConstraintFactory(iface); + + TRACE("iface %p\n", iface); + + /* IUnknown_AddRef already defined by IActivationFactory_iface. Redirect there. */ + return IActivationFactory_AddRef(&impl->IActivationFactory_iface); +} + +static ULONG STDMETHODCALLTYPE speech_recognition_list_constraint_factory_Release( + ISpeechRecognitionListConstraintFactory *iface) +{ + struct activation_factory *impl = impl_from_ISpeechRecognitionListConstraintFactory(iface); + + TRACE("iface %p\n", iface); + + /* IUnknown_Release already defined by IActivationFactory_iface. Redirect there. */ + return IActivationFactory_Release(&impl->IActivationFactory_iface); +} + +static HRESULT STDMETHODCALLTYPE speech_recognition_list_constraint_factory_GetIids( + ISpeechRecognitionListConstraintFactory *iface, ULONG *iid_count, IID **iids) +{ + struct activation_factory *impl = impl_from_ISpeechRecognitionListConstraintFactory(iface); + + TRACE("iface %p, iid_count %p, iids %p stub!\n", iface, iid_count, iids); + + /* IInspectable_GetIids already defined by ISpeechRecognizer_iface. Redirect there. */ + return IActivationFactory_GetIids(&impl->IActivationFactory_iface, iid_count, iids); +} + +static HRESULT STDMETHODCALLTYPE speech_recognition_list_constraint_factory_GetRuntimeClassName( + ISpeechRecognitionListConstraintFactory *iface, HSTRING *class_name) +{ + struct activation_factory *impl = impl_from_ISpeechRecognitionListConstraintFactory(iface); + + TRACE("iface %p, class_name %p stub!\n", iface, class_name); + + /* IInspectable_GetRuntimeClassName already defined by IActivationFactory_iface. Redirect there. */ + return IActivationFactory_GetRuntimeClassName(&impl->IActivationFactory_iface, class_name); +} + +static HRESULT STDMETHODCALLTYPE speech_recognition_list_constraint_factory_GetTrustLevel( + ISpeechRecognitionListConstraintFactory *iface, TrustLevel *trust_level) +{ + struct activation_factory *impl = impl_from_ISpeechRecognitionListConstraintFactory(iface); + + TRACE("iface %p, trust_level %p stub!\n", iface, trust_level); + + /* IInspectable_GetTrustLevel already defined by IActivationFactory_iface. Redirect there. */ + return IActivationFactory_GetTrustLevel(&impl->IActivationFactory_iface, trust_level); +} + +static HRESULT STDMETHODCALLTYPE speech_recognition_list_constraint_factory_Create( + ISpeechRecognitionListConstraintFactory *iface, + IIterable_HSTRING *commands, + ISpeechRecognitionListConstraint** listconstraint) +{ + TRACE("iface %p, commands %p, listconstraint %p.\n", iface, commands, listconstraint); + + return speech_recognition_list_constraint_create(commands, listconstraint); +} + +static HRESULT STDMETHODCALLTYPE speech_recognition_list_constraint_factory_CreateWithTag( + ISpeechRecognitionListConstraintFactory *iface, + IIterable_HSTRING *commands, + HSTRING tag, + ISpeechRecognitionListConstraint** listconstraint) +{ + TRACE("iface %p, commands %p, tag %p, listconstraint %p.\n", iface, commands, tag, listconstraint); + + return speech_recognition_list_constraint_create_with_tag(commands, tag, listconstraint); +} + +static const struct ISpeechRecognitionListConstraintFactoryVtbl speech_recognition_list_constraint_factory_vtbl = +{ + /* IUnknown methods */ + speech_recognition_list_constraint_factory_QueryInterface, + speech_recognition_list_constraint_factory_AddRef, + speech_recognition_list_constraint_factory_Release, + /* IInspectable methods */ + speech_recognition_list_constraint_factory_GetIids, + speech_recognition_list_constraint_factory_GetRuntimeClassName, + speech_recognition_list_constraint_factory_GetTrustLevel, + /* ISpeechRecognitionListConstraintFactory methods */ + speech_recognition_list_constraint_factory_Create, + speech_recognition_list_constraint_factory_CreateWithTag, +}; + + /* * * ActivationFactory instances * */
+static struct activation_factory speechrecognition_speechrecognitionlistconstraint_af = +{ + .IActivationFactory_iface = {&activation_factory_vtbl}, + .ISpeechRecognitionListConstraintFactory_iface = {&speech_recognition_list_constraint_factory_vtbl}, + .IInstalledVoicesStatic_iface = {&installed_voices_static_vtbl}, + .create_instance = speech_recognition_list_constraint_create_default, + .ref = 1 +}; + static struct activation_factory speechrecognition_speechrecognizer_af = { .IActivationFactory_iface = {&activation_factory_vtbl}, @@ -295,6 +425,13 @@ HRESULT WINAPI DllGetActivationFactory(HSTRING classid, IActivationFactory **fac IUnknown_AddRef(*factory); return S_OK; } + else if (IsEqualClassID(WindowsGetStringRawBuffer(classid, NULL), + L"Windows.Media.SpeechRecognition.SpeechRecognitionListConstraint")) + { + *factory = &speechrecognition_speechrecognitionlistconstraint_af.IActivationFactory_iface; + IUnknown_AddRef(*factory); + return S_OK; + }
ERR("Unknown classid %s.\n", debugstr_hstring(classid)); return CLASS_E_CLASSNOTAVAILABLE; diff --git a/dlls/windows.media.speech/speechrecognitionlistconstraint.c b/dlls/windows.media.speech/speechrecognitionlistconstraint.c new file mode 100644 index 00000000000..56263639b1f --- /dev/null +++ b/dlls/windows.media.speech/speechrecognitionlistconstraint.c @@ -0,0 +1,329 @@ +/* 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); + +/* + * + * SpeechRecognitionListConstraint + * + */ + +struct speech_recognition_list_constraint +{ + ISpeechRecognitionListConstraint ISpeechRecognitionListConstraint_iface; + ISpeechRecognitionConstraint ISpeechRecognitionConstraint_iface; + LONG ref; +}; + +/* + * + * ISpeechRecognitionListConstraint + * + */ + +static inline struct speech_recognition_list_constraint + *impl_from_ISpeechRecognitionListConstraint(ISpeechRecognitionListConstraint *iface) +{ + return CONTAINING_RECORD(iface, struct speech_recognition_list_constraint, ISpeechRecognitionListConstraint_iface); +} + +static HRESULT STDMETHODCALLTYPE speech_recognition_list_constraint_QueryInterface( + ISpeechRecognitionListConstraint *iface, REFIID iid, void **out) +{ + struct speech_recognition_list_constraint *impl = impl_from_ISpeechRecognitionListConstraint(iface); + + 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_ISpeechRecognitionListConstraint)) + { + + IUnknown_AddRef(iface); + *out = iface; + return S_OK; + } + + if(IsEqualGUID(iid, &IID_ISpeechRecognitionConstraint)) + { + IUnknown_AddRef(iface); + *out = &impl->ISpeechRecognitionConstraint_iface; + return S_OK; + } + + WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid)); + *out = NULL; + return E_NOINTERFACE; +} + +static ULONG STDMETHODCALLTYPE speech_recognition_list_constraint_AddRef(ISpeechRecognitionListConstraint *iface) +{ + struct speech_recognition_list_constraint *impl = impl_from_ISpeechRecognitionListConstraint(iface); + + ULONG ref = InterlockedIncrement(&impl->ref); + TRACE("iface %p, ref %u.\n", iface, ref); + + return ref; +} + +static ULONG STDMETHODCALLTYPE speech_recognition_list_constraint_Release(ISpeechRecognitionListConstraint *iface) +{ + struct speech_recognition_list_constraint *impl = impl_from_ISpeechRecognitionListConstraint(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_recognition_list_constraint_GetIids( + ISpeechRecognitionListConstraint *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_recognition_list_constraint_GetRuntimeClassName( + ISpeechRecognitionListConstraint *iface, HSTRING *class_name) +{ + FIXME("iface %p, class_name %p stub!\n", iface, class_name); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE speech_recognition_list_constraint_GetTrustLevel( + ISpeechRecognitionListConstraint *iface, TrustLevel *trust_level) +{ + FIXME("iface %p, trust_level %p stub!\n", iface, trust_level); + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE speech_recognition_list_constraint_get_Commands( + ISpeechRecognitionListConstraint *iface, IVector_HSTRING **value) +{ + FIXME("iface %p, value %p stub!\n", iface, value); + return E_NOTIMPL; +} + +static const struct ISpeechRecognitionListConstraintVtbl i_speech_recognition_list_constraint_vtbl = +{ + /* IUnknown methods */ + speech_recognition_list_constraint_QueryInterface, + speech_recognition_list_constraint_AddRef, + speech_recognition_list_constraint_Release, + /* IInspectable methods */ + speech_recognition_list_constraint_GetIids, + speech_recognition_list_constraint_GetRuntimeClassName, + speech_recognition_list_constraint_GetTrustLevel, + /* ISpeechRecognitionListConstraint methods */ + speech_recognition_list_constraint_get_Commands +}; + +/* + * + * ISpeechRecognitionConstraint + * + */ + +static inline struct speech_recognition_list_constraint + *impl_from_ISpeechRecognitionConstraint(ISpeechRecognitionConstraint *iface) +{ + return CONTAINING_RECORD(iface, struct speech_recognition_list_constraint, ISpeechRecognitionConstraint_iface); +} + +static HRESULT STDMETHODCALLTYPE speech_recognition_constraint_QueryInterface(ISpeechRecognitionConstraint *iface, REFIID iid, void **out) +{ + struct speech_recognition_list_constraint *impl = impl_from_ISpeechRecognitionConstraint(iface); + + TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out); + + /* IUnknown_QueryInterface already defined by ISpeechRecognitionListConstraint_iface. Redirect there. */ + return ISpeechRecognitionListConstraint_QueryInterface(&impl->ISpeechRecognitionListConstraint_iface, iid, out); +} + +static ULONG STDMETHODCALLTYPE speech_recognition_constraint_AddRef(ISpeechRecognitionConstraint *iface) +{ + struct speech_recognition_list_constraint *impl = impl_from_ISpeechRecognitionConstraint(iface); + + TRACE("iface %p.\n", iface); + + /* IUnknown_AddRef already defined by ISpeechRecognitionListConstraint_iface. Redirect there. */ + return ISpeechRecognitionListConstraint_AddRef(&impl->ISpeechRecognitionListConstraint_iface); +} + +static ULONG STDMETHODCALLTYPE speech_recognition_constraint_Release(ISpeechRecognitionConstraint *iface) +{ + struct speech_recognition_list_constraint *impl = impl_from_ISpeechRecognitionConstraint(iface); + + TRACE("iface %p.\n", iface); + + /* IUnknown_Release already defined by ISpeechRecognitionListConstraint_iface. Redirect there. */ + return ISpeechRecognitionListConstraint_Release(&impl->ISpeechRecognitionListConstraint_iface); +} + +static HRESULT STDMETHODCALLTYPE speech_recognition_constraint_GetIids( + ISpeechRecognitionConstraint *iface, ULONG *iid_count, IID **iids) +{ + struct speech_recognition_list_constraint *impl = impl_from_ISpeechRecognitionConstraint(iface); + + TRACE("iface %p, iid_count %p, iids %p stub!\n", iface, iid_count, iids); + + /* IInspectable_GetIids already defined by ISpeechRecognitionListConstraint_iface. Redirect there. */ + return ISpeechRecognitionListConstraint_GetIids(&impl->ISpeechRecognitionListConstraint_iface, iid_count, iids); +} + +static HRESULT STDMETHODCALLTYPE speech_recognition_constraint_GetRuntimeClassName( + ISpeechRecognitionConstraint *iface, HSTRING *class_name) +{ + struct speech_recognition_list_constraint *impl = impl_from_ISpeechRecognitionConstraint(iface); + + TRACE("iface %p, class_name %p stub!\n", iface, class_name); + + /* IInspectable_GetRuntimeClassName already defined by ISpeechRecognitionListConstraint_iface. Redirect there. */ + return ISpeechRecognitionListConstraint_GetRuntimeClassName(&impl->ISpeechRecognitionListConstraint_iface, class_name); +} + +static HRESULT STDMETHODCALLTYPE speech_recognition_constraint_GetTrustLevel( + ISpeechRecognitionConstraint *iface, TrustLevel *trust_level) +{ + struct speech_recognition_list_constraint *impl = impl_from_ISpeechRecognitionConstraint(iface); + + TRACE("iface %p, trust_level %p stub!\n", iface, trust_level); + + /* IInspectable_GetTrustLevel already defined by ISpeechRecognitionListConstraint_iface. Redirect there. */ + return ISpeechRecognitionListConstraint_GetTrustLevel(&impl->ISpeechRecognitionListConstraint_iface, trust_level); +} + +static HRESULT STDMETHODCALLTYPE speech_recognition_constraint_get_IsEnabled( + ISpeechRecognitionConstraint *iface, boolean *value) +{ + FIXME("iface %p, value %p stub!\n", iface, value); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE speech_recognition_constraint_put_IsEnabled( + ISpeechRecognitionConstraint *iface, boolean value) +{ + FIXME("iface %p, value %u stub!\n", iface, value); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE speech_recognition_constraint_get_Tag( + ISpeechRecognitionConstraint *iface, HSTRING *value) +{ + FIXME("iface %p, value %p stub!\n", iface, value); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE speech_recognition_constraint_put_Tag( + ISpeechRecognitionConstraint *iface, HSTRING value) +{ + FIXME("iface %p, value %p stub!\n", iface, value); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE speech_recognition_constraint_get_Type( + ISpeechRecognitionConstraint *iface, SpeechRecognitionConstraintType *value) +{ + FIXME("iface %p, value %p stub!\n", iface, value); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE speech_recognition_constraint_get_Probability( + ISpeechRecognitionConstraint *iface, SpeechRecognitionConstraintProbability *value) +{ + FIXME("iface %p, value %p stub!\n", iface, value); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE speech_recognition_constraint_put_Probability( + ISpeechRecognitionConstraint *iface, SpeechRecognitionConstraintProbability value) +{ + FIXME("iface %p, value %u stub!\n", iface, value); + + return E_NOTIMPL; +} + +static const struct ISpeechRecognitionConstraintVtbl i_speech_recognition_constraint_vtbl = +{ + /* IUnknown methods */ + speech_recognition_constraint_QueryInterface, + speech_recognition_constraint_AddRef, + speech_recognition_constraint_Release, + /* IInspectable methods */ + speech_recognition_constraint_GetIids, + speech_recognition_constraint_GetRuntimeClassName, + speech_recognition_constraint_GetTrustLevel, + /* ISpeechRecognitionConstraint methods */ + speech_recognition_constraint_get_IsEnabled, + speech_recognition_constraint_put_IsEnabled, + speech_recognition_constraint_get_Tag, + speech_recognition_constraint_put_Tag, + speech_recognition_constraint_get_Type, + speech_recognition_constraint_get_Probability, + speech_recognition_constraint_put_Probability, +}; + +HRESULT STDMETHODCALLTYPE speech_recognition_list_constraint_create_default(IInspectable **inspectable) +{ + TRACE("inspectable %p.\n", inspectable); + return speech_recognition_list_constraint_create_with_tag(NULL, NULL, (ISpeechRecognitionListConstraint**)inspectable); +} + +HRESULT STDMETHODCALLTYPE speech_recognition_list_constraint_create( + IIterable_HSTRING *commands, ISpeechRecognitionListConstraint **listconstraint) +{ + TRACE("commands %p, listconstraint %p.\n", commands, listconstraint); + return speech_recognition_list_constraint_create_with_tag(commands, NULL, listconstraint); +} + +HRESULT STDMETHODCALLTYPE speech_recognition_list_constraint_create_with_tag( + IIterable_HSTRING *commands, HSTRING tag, ISpeechRecognitionListConstraint **listconstraint) +{ + struct speech_recognition_list_constraint *impl; + HRESULT hr; + + TRACE("commands %p, tag %p, listconstraint %p.\n", commands, tag, listconstraint); + + if (!(impl = calloc(1, sizeof(*impl)))) + { + *listconstraint = NULL; + return E_OUTOFMEMORY; + } + + impl->ISpeechRecognitionListConstraint_iface.lpVtbl = &i_speech_recognition_list_constraint_vtbl; + impl->ISpeechRecognitionConstraint_iface.lpVtbl = &i_speech_recognition_constraint_vtbl; + impl->ref = 1; + + hr = ISpeechRecognitionListConstraint_QueryInterface(&impl->ISpeechRecognitionListConstraint_iface, &IID_ISpeechRecognitionListConstraint, (void**)listconstraint); + ISpeechRecognitionListConstraint_Release(&impl->ISpeechRecognitionListConstraint_iface); + + return hr; +} diff --git a/dlls/windows.media.speech/tests/speech.c b/dlls/windows.media.speech/tests/speech.c index 190c73becee..6f3824f9de1 100644 --- a/dlls/windows.media.speech/tests/speech.c +++ b/dlls/windows.media.speech/tests/speech.c @@ -260,9 +260,60 @@ static void test_SpeechRecognizer(void) RoUninitialize(); }
+static void test_SpeechRecognitionListConstraint(void) +{ + static const WCHAR *speech_recognition_list_constraint_name = L"Windows.Media.SpeechRecognition.SpeechRecognitionListConstraint"; + ISpeechRecognitionListConstraintFactory *listconstraint_factory = NULL; + ISpeechRecognitionListConstraint *listconstraint = NULL; + ISpeechRecognitionConstraint *constraint = NULL; + IActivationFactory *factory = NULL; + IInspectable *inspectable = NULL; + HSTRING str; + HRESULT hr; + LONG ref; + + hr = RoInitialize(RO_INIT_MULTITHREADED); + ok(hr == S_OK, "RoInitialize failed, hr %#x\n", hr); + + hr = WindowsCreateString(speech_recognition_list_constraint_name, wcslen(speech_recognition_list_constraint_name), &str); + ok(hr == S_OK, "WindowsCreateString failed, hr %#x\n", hr); + + hr = RoGetActivationFactory(str, &IID_IActivationFactory, (void **)&factory); + ok(hr == S_OK, "RoGetActivationFactory failed, hr %#x\n", hr); + + hr = IActivationFactory_QueryInterface(factory, &IID_ISpeechRecognitionListConstraintFactory, (void **)&listconstraint_factory); + ok(hr == S_OK, "IActivationFactory_QueryInterface IID_ISpeechRecognizer failed, hr %#x\n", hr); + + ISpeechRecognitionListConstraintFactory_Release(listconstraint_factory); + IActivationFactory_Release(factory); + + hr = RoActivateInstance(str, &inspectable); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + + hr = IInspectable_QueryInterface(inspectable, &IID_ISpeechRecognitionListConstraint, (void **)&listconstraint); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + + hr = IInspectable_QueryInterface(inspectable, &IID_ISpeechRecognitionConstraint, (void **)&constraint); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + + ref = ISpeechRecognitionConstraint_Release(constraint); + ok(ref == 2, "Got unexpected ref %u.\n", ref); + + ref = ISpeechRecognitionListConstraint_Release(listconstraint); + ok(ref == 1, "Got unexpected ref %u.\n", ref); + + ref = IInspectable_Release(inspectable); + ok(!ref, "Got unexpected ref %u.\n", ref); + + WindowsDeleteString(str); + + RoUninitialize(); +} + START_TEST(speech) { test_SpeechSynthesizer(); test_VoiceInformation(); test_SpeechRecognizer(); + test_SpeechRecognitionListConstraint(); } diff --git a/dlls/windows.media.speech/windows_media_speech_private.h b/dlls/windows.media.speech/windows_media_speech_private.h index 02cababb7d5..04b874af7bd 100644 --- a/dlls/windows.media.speech/windows_media_speech_private.h +++ b/dlls/windows.media.speech/windows_media_speech_private.h @@ -68,6 +68,7 @@ struct activation_factory { /* Factories */ IActivationFactory IActivationFactory_iface; + ISpeechRecognitionListConstraintFactory ISpeechRecognitionListConstraintFactory_iface; ISpeechRecognizerFactory ISpeechRecognizerFactory_iface; /* Static interfaces */ IInstalledVoicesStatic IInstalledVoicesStatic_iface; @@ -82,6 +83,10 @@ struct activation_factory * */
+HRESULT STDMETHODCALLTYPE speech_recognition_list_constraint_create_default(IInspectable **inspectable) DECLSPEC_HIDDEN; +HRESULT STDMETHODCALLTYPE speech_recognition_list_constraint_create(IIterable_HSTRING *commands, ISpeechRecognitionListConstraint **listconstraint) DECLSPEC_HIDDEN; +HRESULT STDMETHODCALLTYPE speech_recognition_list_constraint_create_with_tag(IIterable_HSTRING *commands, HSTRING tag, ISpeechRecognitionListConstraint **listconstraint) DECLSPEC_HIDDEN; + HRESULT STDMETHODCALLTYPE speech_recognizer_create_default(IInspectable **inspectable) DECLSPEC_HIDDEN; HRESULT STDMETHODCALLTYPE speech_recognizer_create(ILanguage *language, ISpeechRecognizer **speechrecognizer) DECLSPEC_HIDDEN;
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=105397
Your paranoid android.
=== w8 (32 bit report) ===
windows.media.speech: speech.c:226: Test failed: RoGetActivationFactory failed, hr 0x80040154 0c64:speech: unhandled exception c0000005 at 00401D18
=== w8adm (32 bit report) ===
windows.media.speech: speech.c:226: Test failed: RoGetActivationFactory failed, hr 0x80040154 0cd4:speech: unhandled exception c0000005 at 00401D18
=== w864 (32 bit report) ===
windows.media.speech: speech.c:226: Test failed: RoGetActivationFactory failed, hr 0x80040154 09f4:speech: unhandled exception c0000005 at 00401D18
=== w1064v1507 (32 bit report) ===
windows.media.speech: speech.c:291: Test failed: Got unexpected hr 0x80004001. 0ea0:speech: unhandled exception c0000005 at 004021A0
=== w1064v1809 (32 bit report) ===
windows.media.speech: speech.c:235: Test failed: Got unexpected hr 0x800455a0. 1e7c:speech: unhandled exception c0000005 at 00401DD1
=== w1064 (32 bit report) ===
windows.media.speech: speech.c:235: Test failed: Got unexpected hr 0x800455a0. 1c04:speech: unhandled exception c0000005 at 00401DD1
=== w1064_tsign (32 bit report) ===
windows.media.speech: speech.c:235: Test failed: Got unexpected hr 0x800455a0.
=== w10pro64 (32 bit report) ===
windows.media.speech: speech.c:291: Test failed: Got unexpected hr 0x80004001. 1fc8:speech: unhandled exception c0000005 at 004021A0
=== w864 (64 bit report) ===
windows.media.speech: speech.c:226: Test failed: RoGetActivationFactory failed, hr 0x80040154 0a8c:speech: unhandled exception c0000005 at 0000000000401BA6
=== w1064v1507 (64 bit report) ===
windows.media.speech: speech.c:291: Test failed: Got unexpected hr 0x80004001. 0ea8:speech: unhandled exception c0000005 at 0000000000401F84
=== w1064v1809 (64 bit report) ===
windows.media.speech: speech.c:235: Test failed: Got unexpected hr 0x800455a0. 0cb8:speech: unhandled exception c0000005 at 0000000000401C3C
=== w1064 (64 bit report) ===
windows.media.speech: speech.c:235: Test failed: Got unexpected hr 0x800455a0. 1b48:speech: unhandled exception c0000005 at 0000000000401C3C
=== w1064_2qxl (64 bit report) ===
windows.media.speech: speech.c:235: Test failed: Got unexpected hr 0x800455a0. 1644:speech: unhandled exception c0000005 at 0000000000401C3C
=== w1064_tsign (64 bit report) ===
windows.media.speech: speech.c:235: Test failed: Got unexpected hr 0x800455a0. 0ce0:speech: unhandled exception c0000005 at 0000000000401C3C
=== w10pro64 (64 bit report) ===
windows.media.speech: speech.c:291: Test failed: Got unexpected hr 0x80004001. 034c:speech: unhandled exception c0000005 at 0000000000401F84
=== w10pro64_ar (64 bit report) ===
windows.media.speech: speech.c:235: Test failed: Got unexpected hr 0x800455a0. 1f10:speech: unhandled exception c0000005 at 0000000000401C3C
=== w10pro64_he (64 bit report) ===
windows.media.speech: speech.c:235: Test failed: Got unexpected hr 0x800455a0. 1c08:speech: unhandled exception c0000005 at 0000000000401C3C
=== w10pro64_ja (64 bit report) ===
windows.media.speech: speech.c:235: Test failed: Got unexpected hr 0x800455a0. 1fc4:speech: unhandled exception c0000005 at 0000000000401C3C
=== w10pro64_zh_CN (64 bit report) ===
windows.media.speech: speech.c:235: Test failed: Got unexpected hr 0x800455a0. 1d6c:speech: unhandled exception c0000005 at 0000000000401C3C
Signed-off-by: Bernhard Kölbl besentv@gmail.com --- dlls/windows.media.speech/Makefile.in | 1 + .../speechrecognitionresult.c | 325 ++++++++++++++++++ .../windows_media_speech_private.h | 2 + 3 files changed, 328 insertions(+) create mode 100644 dlls/windows.media.speech/speechrecognitionresult.c
diff --git a/dlls/windows.media.speech/Makefile.in b/dlls/windows.media.speech/Makefile.in index 0f7a993fee5..fd6e0b1ac63 100644 --- a/dlls/windows.media.speech/Makefile.in +++ b/dlls/windows.media.speech/Makefile.in @@ -4,6 +4,7 @@ IMPORTS = combase uuid C_SRCS = \ main.c \ speechrecognitionlistconstraint.c \ + speechrecognitionresult.c \ speechrecognizer.c \ speechsynthesis.c
diff --git a/dlls/windows.media.speech/speechrecognitionresult.c b/dlls/windows.media.speech/speechrecognitionresult.c new file mode 100644 index 00000000000..3403161d27a --- /dev/null +++ b/dlls/windows.media.speech/speechrecognitionresult.c @@ -0,0 +1,325 @@ +/* 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); + +/* + * + * SpeechRecognitionResult + * + */ + +struct speech_recognition_result +{ + ISpeechRecognitionResult ISpeechRecognitionResult_iface; + ISpeechRecognitionResult2 ISpeechRecognitionResult2_iface; + LONG ref; +}; + +/* + * + * ISpeechRecognitionResult + * + */ + +static inline struct speech_recognition_result *impl_from_ISpeechRecognitionResult(ISpeechRecognitionResult *iface) +{ + return CONTAINING_RECORD(iface, struct speech_recognition_result, ISpeechRecognitionResult_iface); +} + +static HRESULT STDMETHODCALLTYPE speech_recognition_result_QueryInterface(ISpeechRecognitionResult *iface, REFIID iid, void **out) +{ + struct speech_recognition_result *impl = impl_from_ISpeechRecognitionResult(iface); + + 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_ISpeechRecognitionResult)) + { + IUnknown_AddRef(iface); + *out = iface; + return S_OK; + } + + if(IsEqualGUID(iid, &IID_ISpeechRecognitionResult2)) + { + IUnknown_AddRef(iface); + *out = &impl->ISpeechRecognitionResult2_iface; + return S_OK; + } + + WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid)); + *out = NULL; + return E_NOINTERFACE; +} + +static ULONG STDMETHODCALLTYPE speech_recognition_result_AddRef(ISpeechRecognitionResult *iface) +{ + struct speech_recognition_result *impl = impl_from_ISpeechRecognitionResult(iface); + + ULONG ref = InterlockedIncrement(&impl->ref); + TRACE("iface %p, ref %u.\n", iface, ref); + + return ref; +} + +static ULONG STDMETHODCALLTYPE speech_recognition_result_Release(ISpeechRecognitionResult *iface) +{ + struct speech_recognition_result *impl = impl_from_ISpeechRecognitionResult(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_recognition_result_GetIids(ISpeechRecognitionResult *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_recognition_result_GetRuntimeClassName(ISpeechRecognitionResult *iface, HSTRING *class_name) +{ + FIXME("iface %p, class_name %p stub!\n", iface, class_name); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE speech_recognition_result_GetTrustLevel(ISpeechRecognitionResult *iface, TrustLevel *trust_level) +{ + FIXME("iface %p, trust_level %p stub!\n", iface, trust_level); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE speech_recognition_result_get_Status( + ISpeechRecognitionResult *iface, SpeechRecognitionResultStatus *value) +{ + FIXME("iface %p, operation %p stub!\n", iface, value); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE speech_recognition_result_get_Text( + ISpeechRecognitionResult *iface, HSTRING *value) +{ + FIXME("iface %p, operation %p stub!\n", iface, value); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE speech_recognition_result_get_Confidence( + ISpeechRecognitionResult *iface, SpeechRecognitionConfidence *value) +{ + FIXME("iface %p, operation %p stub!\n", iface, value); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE speech_recognition_result_get_SemanticInterpretation( + ISpeechRecognitionResult *iface, ISpeechRecognitionSemanticInterpretation **value) +{ + FIXME("iface %p, operation %p stub!\n", iface, value); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE speech_recognition_result_GetAlternatives( + ISpeechRecognitionResult *iface, UINT32 max_amount, IVectorView_SpeechRecognitionResult **results) +{ + FIXME("iface %p, max_amount %u, results %p stub!\n", iface, max_amount, results); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE speech_recognition_result_get_Constraint( + ISpeechRecognitionResult *iface, ISpeechRecognitionConstraint **value) +{ + FIXME("iface %p, operation %p stub!\n", iface, value); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE speech_recognition_result_get_RulePath( + ISpeechRecognitionResult *iface, IVectorView_HSTRING **value) +{ + FIXME("iface %p, operation %p stub!\n", iface, value); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE speech_recognition_result_get_RawConfidence( + ISpeechRecognitionResult *iface, DOUBLE *value) +{ + FIXME("iface %p, operation %p stub!\n", iface, value); + + return E_NOTIMPL; +} + +static const struct ISpeechRecognitionResultVtbl speech_recognition_result_vtbl = +{ + /* IUnknown methods */ + speech_recognition_result_QueryInterface, + speech_recognition_result_AddRef, + speech_recognition_result_Release, + /* IInspectable methods */ + speech_recognition_result_GetIids, + speech_recognition_result_GetRuntimeClassName, + speech_recognition_result_GetTrustLevel, + /* ISpeechRecognitionResult methods */ + speech_recognition_result_get_Status, + speech_recognition_result_get_Text, + speech_recognition_result_get_Confidence, + speech_recognition_result_get_SemanticInterpretation, + speech_recognition_result_GetAlternatives, + speech_recognition_result_get_Constraint, + speech_recognition_result_get_RulePath, + speech_recognition_result_get_RawConfidence +}; + +/* + * + * ISpeechRecognitionResult2 + * + */ + +static inline struct speech_recognition_result *impl_from_ISpeechRecognitionResult2(ISpeechRecognitionResult2 *iface) +{ + return CONTAINING_RECORD(iface, struct speech_recognition_result, ISpeechRecognitionResult2_iface); +} + +static HRESULT STDMETHODCALLTYPE speech_recognition_result2_QueryInterface(ISpeechRecognitionResult2 *iface, REFIID iid, void **out) +{ + struct speech_recognition_result *impl = impl_from_ISpeechRecognitionResult2(iface); + + TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out); + + /* IUnknown_QueryInterface already defined by ISpeechRecognitionResult_iface. Redirect there. */ + return ISpeechRecognitionResult_QueryInterface(&impl->ISpeechRecognitionResult_iface, iid, out); +} + +static ULONG STDMETHODCALLTYPE speech_recognition_result2_AddRef(ISpeechRecognitionResult2 *iface) +{ + struct speech_recognition_result *impl = impl_from_ISpeechRecognitionResult2(iface); + + TRACE("iface %p.\n", iface); + + /* IUnknown_AddRef already defined by ISpeechRecognitionResult_iface. Redirect there. */ + return ISpeechRecognitionResult_AddRef(&impl->ISpeechRecognitionResult_iface); +} + +static ULONG STDMETHODCALLTYPE speech_recognition_result2_Release(ISpeechRecognitionResult2 *iface) +{ + struct speech_recognition_result *impl = impl_from_ISpeechRecognitionResult2(iface); + + TRACE("iface %p.\n", iface); + + /* IUnknown_Release already defined by ISpeechRecognitionResult_iface. Redirect there. */ + return ISpeechRecognitionResult_Release(&impl->ISpeechRecognitionResult_iface); +} + +static HRESULT STDMETHODCALLTYPE speech_recognition_result2_GetIids(ISpeechRecognitionResult2 *iface, ULONG *iid_count, IID **iids) +{ + struct speech_recognition_result *impl = impl_from_ISpeechRecognitionResult2(iface); + + FIXME("iface %p, iid_count %p, iids %p stub!\n", iface, iid_count, iids); + + /* IInspectable_GetIids already defined by ISpeechRecognitionResult_iface. Redirect there. */ + return ISpeechRecognitionResult_GetIids(&impl->ISpeechRecognitionResult_iface, iid_count, iids); +} + +static HRESULT STDMETHODCALLTYPE speech_recognition_result2_GetRuntimeClassName(ISpeechRecognitionResult2 *iface, HSTRING *class_name) +{ + struct speech_recognition_result *impl = impl_from_ISpeechRecognitionResult2(iface); + + FIXME("iface %p, class_name %p stub!\n", iface, class_name); + + /* IInspectable_GetRuntimeClassName already defined by ISpeechRecognitionResult_iface. Redirect there. */ + return ISpeechRecognitionResult_GetRuntimeClassName(&impl->ISpeechRecognitionResult_iface, class_name); +} + +static HRESULT STDMETHODCALLTYPE speech_recognition_result2_GetTrustLevel(ISpeechRecognitionResult2 *iface, TrustLevel *trust_level) +{ + struct speech_recognition_result *impl = impl_from_ISpeechRecognitionResult2(iface); + + FIXME("iface %p, trust_level %p stub!\n", iface, trust_level); + + /* IInspectable_GetTrustLevel already defined by ISpeechRecognitionResult_iface. Redirect there. */ + return ISpeechRecognitionResult_GetTrustLevel(&impl->ISpeechRecognitionResult_iface, trust_level); +} + +static HRESULT STDMETHODCALLTYPE speech_recognition_result2_get_PhraseStartTime(ISpeechRecognitionResult2 *iface, DateTime *value) +{ + FIXME("iface %p, value %p stub!\n", iface, value); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE speech_recognition_result2_get_PhraseDuration(ISpeechRecognitionResult2 *iface, TimeSpan *value) +{ + FIXME("iface %p, value %p stub!\n", iface, value); + + return E_NOTIMPL; +} + +static const struct ISpeechRecognitionResult2Vtbl speech_recognition_result2_vtbl = +{ + /* IUnknown methods */ + speech_recognition_result2_QueryInterface, + speech_recognition_result2_AddRef, + speech_recognition_result2_Release, + /* IInspectable methods */ + speech_recognition_result2_GetIids, + speech_recognition_result2_GetRuntimeClassName, + speech_recognition_result2_GetTrustLevel, + /* ISpeechRecognitionResult2 methods */ + speech_recognition_result2_get_PhraseStartTime, + speech_recognition_result2_get_PhraseDuration +}; + +HRESULT STDMETHODCALLTYPE speech_recognition_result_create_from_iid(REFIID iid, void **obj) +{ + struct speech_recognition_result *impl; + HRESULT hr; + + TRACE("iid %p, obj %p.\n", iid, obj); + + if (!(impl = calloc(1, sizeof(*impl)))) + { + *obj = NULL; + return E_OUTOFMEMORY; + } + + impl->ISpeechRecognitionResult_iface.lpVtbl = &speech_recognition_result_vtbl; + impl->ISpeechRecognitionResult2_iface.lpVtbl = &speech_recognition_result2_vtbl; + impl->ref = 1; + + hr = ISpeechRecognitionResult_QueryInterface(&impl->ISpeechRecognitionResult_iface, iid, obj); + ISpeechRecognitionResult_Release(&impl->ISpeechRecognitionResult_iface); + + return hr; +} diff --git a/dlls/windows.media.speech/windows_media_speech_private.h b/dlls/windows.media.speech/windows_media_speech_private.h index 04b874af7bd..f7a3b89e072 100644 --- a/dlls/windows.media.speech/windows_media_speech_private.h +++ b/dlls/windows.media.speech/windows_media_speech_private.h @@ -87,6 +87,8 @@ HRESULT STDMETHODCALLTYPE speech_recognition_list_constraint_create_default(IIns HRESULT STDMETHODCALLTYPE speech_recognition_list_constraint_create(IIterable_HSTRING *commands, ISpeechRecognitionListConstraint **listconstraint) DECLSPEC_HIDDEN; HRESULT STDMETHODCALLTYPE speech_recognition_list_constraint_create_with_tag(IIterable_HSTRING *commands, HSTRING tag, ISpeechRecognitionListConstraint **listconstraint) DECLSPEC_HIDDEN;
+HRESULT STDMETHODCALLTYPE speech_recognition_result_create_from_iid(REFIID iid, void **obj) DECLSPEC_HIDDEN; + HRESULT STDMETHODCALLTYPE speech_recognizer_create_default(IInspectable **inspectable) DECLSPEC_HIDDEN; HRESULT STDMETHODCALLTYPE speech_recognizer_create(ILanguage *language, ISpeechRecognizer **speechrecognizer) DECLSPEC_HIDDEN;
Signed-off-by: Bernhard Kölbl besentv@gmail.com --- dlls/windows.media.speech/Makefile.in | 1 + .../speechrecognitioncompilationresult.c | 151 ++++++++++++++++++ .../windows_media_speech_private.h | 2 + 3 files changed, 154 insertions(+) create mode 100644 dlls/windows.media.speech/speechrecognitioncompilationresult.c
diff --git a/dlls/windows.media.speech/Makefile.in b/dlls/windows.media.speech/Makefile.in index fd6e0b1ac63..7a8a784d35f 100644 --- a/dlls/windows.media.speech/Makefile.in +++ b/dlls/windows.media.speech/Makefile.in @@ -3,6 +3,7 @@ IMPORTS = combase uuid
C_SRCS = \ main.c \ + speechrecognitioncompilationresult.c \ speechrecognitionlistconstraint.c \ speechrecognitionresult.c \ speechrecognizer.c \ diff --git a/dlls/windows.media.speech/speechrecognitioncompilationresult.c b/dlls/windows.media.speech/speechrecognitioncompilationresult.c new file mode 100644 index 00000000000..d177127a26b --- /dev/null +++ b/dlls/windows.media.speech/speechrecognitioncompilationresult.c @@ -0,0 +1,151 @@ +/* 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); + +/* + * + * SpeechRecognitionCompilationResult + * + */ + +struct speech_recognition_compilation_result +{ + ISpeechRecognitionCompilationResult ISpeechRecognitionCompilationResult_iface; + LONG ref; +}; + +/* + * + * ISpeechRecognitionCompilationResult + * + */ + +static inline struct speech_recognition_compilation_result *impl_from_ISpeechRecognitionCompilationResult(ISpeechRecognitionCompilationResult *iface) +{ + return CONTAINING_RECORD(iface, struct speech_recognition_compilation_result, ISpeechRecognitionCompilationResult_iface); +} + +static HRESULT STDMETHODCALLTYPE speech_recognition_compilation_result_QueryInterface(ISpeechRecognitionCompilationResult *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_ISpeechRecognitionCompilationResult)) + { + 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_recognition_compilation_result_AddRef(ISpeechRecognitionCompilationResult *iface) +{ + struct speech_recognition_compilation_result *impl = impl_from_ISpeechRecognitionCompilationResult(iface); + + ULONG ref = InterlockedIncrement(&impl->ref); + TRACE("iface %p, ref %u.\n", iface, ref); + + return ref; +} + +static ULONG STDMETHODCALLTYPE speech_recognition_compilation_result_Release(ISpeechRecognitionCompilationResult *iface) +{ + struct speech_recognition_compilation_result *impl = impl_from_ISpeechRecognitionCompilationResult(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_recognition_compilation_result_GetIids(ISpeechRecognitionCompilationResult *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_recognition_compilation_result_GetRuntimeClassName(ISpeechRecognitionCompilationResult *iface, HSTRING *class_name) +{ + FIXME("iface %p, class_name %p stub!\n", iface, class_name); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE speech_recognition_compilation_result_GetTrustLevel(ISpeechRecognitionCompilationResult *iface, TrustLevel *trust_level) +{ + FIXME("iface %p, trust_level %p stub!\n", iface, trust_level); + + return E_NOTIMPL; +} + +static HRESULT STDMETHODCALLTYPE speech_recognition_compilation_result_get_Status( + ISpeechRecognitionCompilationResult *iface, SpeechRecognitionResultStatus* value) +{ + FIXME("iface %p, value %p stub!\n", iface, value); + + return E_NOTIMPL; +} + +static const struct ISpeechRecognitionCompilationResultVtbl speech_recognition_compilation_result_vtbl = +{ + /* IUnknown methods */ + speech_recognition_compilation_result_QueryInterface, + speech_recognition_compilation_result_AddRef, + speech_recognition_compilation_result_Release, + /* IInspectable methods */ + speech_recognition_compilation_result_GetIids, + speech_recognition_compilation_result_GetRuntimeClassName, + speech_recognition_compilation_result_GetTrustLevel, + /* ISpeechRecognitionCompilationResult methods */ + speech_recognition_compilation_result_get_Status +}; + +HRESULT STDMETHODCALLTYPE speech_recognition_compilation_result_create_from_iid(REFIID iid, void **obj) +{ + struct speech_recognition_compilation_result *impl; + HRESULT hr; + + TRACE("iid %p, obj %p.\n", iid, obj); + + if (!(impl = calloc(1, sizeof(*impl)))) + { + *obj = NULL; + return E_OUTOFMEMORY; + } + + impl->ISpeechRecognitionCompilationResult_iface.lpVtbl = &speech_recognition_compilation_result_vtbl; + impl->ref = 1; + + hr = ISpeechRecognitionCompilationResult_QueryInterface(&impl->ISpeechRecognitionCompilationResult_iface, iid, obj); + ISpeechRecognitionCompilationResult_Release(&impl->ISpeechRecognitionCompilationResult_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 f7a3b89e072..88eb9a01140 100644 --- a/dlls/windows.media.speech/windows_media_speech_private.h +++ b/dlls/windows.media.speech/windows_media_speech_private.h @@ -83,6 +83,8 @@ struct activation_factory * */
+HRESULT STDMETHODCALLTYPE speech_recognition_compilation_result_create_from_iid(REFIID iid, void **obj) DECLSPEC_HIDDEN; + HRESULT STDMETHODCALLTYPE speech_recognition_list_constraint_create_default(IInspectable **inspectable) DECLSPEC_HIDDEN; HRESULT STDMETHODCALLTYPE speech_recognition_list_constraint_create(IIterable_HSTRING *commands, ISpeechRecognitionListConstraint **listconstraint) DECLSPEC_HIDDEN; HRESULT STDMETHODCALLTYPE speech_recognition_list_constraint_create_with_tag(IIterable_HSTRING *commands, HSTRING tag, ISpeechRecognitionListConstraint **listconstraint) DECLSPEC_HIDDEN;
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