ISpRecoContext
The ISpRecoContext interface enables applications to create different functional views or contexts of the SR engine. Each ISpRecoContext object can take interest in different SR events (see also ISpEventSource and SPEVENTENUM) and use different recognition grammars (see also ISpRecoGrammar). Applications must have at least one ISpRecoContext instance to receive recognitions. Applications can also create multiple ISpRecoContext instances to separate different types of recognition with their application. For example, a multiple-document-interface (MDI) application could associate a different ISpRecoContext instance with each document pane to localize the grammar and support and event processing.
A new ISpRecoContext object can be created by calling ISpRecognizer::CreateRecoContext.
To use a shared recognizer (see description of ISpRecognizer), an application can easily create a shared ISpRecoContext by calling ::CoCreateInstance with CLSID_SpSharedRecoContext.
Associated Class IDs
The following class IDs (CLSID) may be used with this interface. A complete CLSID listing for all interfaces is in the Class IDs section.
- CLSID_SpSharedRecoContext
Methods in Vtable Order
ISpRecoContext Methods | Description |
---|---|
ISpEventSource | Inherits from ISpEventSource and those methods are accessible from ISpRecoContext. |
GetRecognizer | Returns a reference to the current recognizer object associated with this context. |
CreateGrammar | Creates an SpGrammar object. |
GetStatus | Retrieves current state information associated with a context. |
GetMaxAlternates | Retrieves the maximum number of alternates that will be generated for command and control grammars. |
SetMaxAlternates | Sets the maximum number of alternates returned for command and control grammars. |
SetAudioOptions | Sets the audio options for results from this recognition context. |
GetAudioOptions | Retrieves the audio options for the context. |
DeserializeResult | Creates a new result object from a serialized result. |
Bookmark | Sets a bookmark within the current recognition stream. |
SetAdaptationData | Passes a block of text to the SR engine which can be used to adapt the active language models. |
Pause | Pauses the engine object to synchronize with the SR engine. |
Resume | Resumes the SR engine from the paused state and restarts the recognition process. |
SetVoice | Sets the associated ISpVoice to this context. |
GetVoice | Retrieves a reference to the associated ISpVoice object. |
SetVoicePurgeEvent | Sets the SR engine events that stop audio output, and purges the current speaking queue. |
GetVoicePurgeEvent | Retrieves the set of SR engine events that stop audio output, and purges the current speaking queue. |
SetContextState | Sets the state of the recognition context. |
GetContextState | Retrieves the state of the recognition context. |