SpeechRecognizer.PreloadGrammarsAsync Method

Initiates the process of loading grammars for the SpeechRecognizer to use.

Syntax

public:
IAsyncAction^ PreloadGrammarsAsync()  

Return value

Type: IAsyncAction 

Returns an IAsyncAction object that represents the state of the asynchronous operation. Completion of the asynchronous operation is signaled by using a handler that is passed to the IAsyncAction.Completed property.

Remarks

For speech recognition to work with custom grammars, each grammar must be added, loaded, and used by the RecognizeAsync method. AddGrammarFromList, AddGrammarFromUri and AddGrammarFromPredefinedType add a grammar to an internal queue, but the grammars are not yet in a loaded state. Grammars are loaded in one of two ways: you can call PreloadGrammarsAsync prior to calling RecognizeAsync, or you can skip calling PreloadGrammarsAsync and RecognizeAsync will call it for you. The same delay occurs in both cases, but leaving the burden to RecognizeAsync means that the delay will occur when a user attempts speech recognition, and there is a higher chance they will notice the delay. For this reason, unless you have only a few simple grammars, you may wish to call this method.

Requirements

Namespace: Windows.Xbox.Speech.Recognition

Metadata: windows.winmd

See also

Reference

SpeechRecognizer Class

SpeechRecognizer Members

Windows.Xbox.Speech.Recognition Namespace