Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining

ISpRecoContext (Speech API (SAPI) SDK 5.1)

Speech API 5.3
Microsoft Speech SDK Version 5.1


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.


Methods in Vtable Order

ISpRecoContext MethodsDescription
ISpEventSourceInherits from ISpEventSource and those methods are accessible from ISpRecoContext.
GetRecognizerReturns a reference to the current recognizer object associated with this context.
CreateGrammarCreates an SpGrammar object.
GetStatusRetrieves current state information associated with a context.
GetMaxAlternatesRetrieves the maximum number of alternates that will be generated for command and control grammars.
SetMaxAlternatesSets the maximum number of alternates returned for command and control grammars.
SetAudioOptionsSets the audio options for results from this recognition context.
GetAudioOptionsRetrieves the audio options for the context.
DeserializeResultCreates a new result object from a serialized result.
BookmarkSets a bookmark within the current recognition stream.
SetAdaptationDataPasses a block of text to the SR engine which can be used to adapt the active language models.
PausePauses the engine object to synchronize with the SR engine.
ResumeResumes the SR engine from the paused state and restarts the recognition process.
SetVoiceSets the associated ISpVoice to this context.
GetVoiceRetrieves a reference to the associated ISpVoice object.
SetVoicePurgeEventSets the SR engine events that stop audio output, and purges the current speaking queue.
GetVoicePurgeEventRetrieves the set of SR engine events that stop audio output, and purges the current speaking queue.
SetContextStateSets the state of the recognition context.
GetContextStateRetrieves the state of the recognition context.
© 2015 Microsoft