Note

Please see Azure Cognitive Services for Speech documentation for the latest supported speech solutions.

Microsoft Speech Platform

ISpRecoContext

The ISpRecoContext interface enables applications to create different functional views or contexts of the speech recognition (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 event processing.

A new ISpRecoContext object can be created by calling ISpRecognizer::CreateRecoContext.

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.
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.