SpeechRecoContext EventInterests Property

Microsoft Speech SDK

Intelligent Interface Technologies Home Page Microsoft Speech SDK

Speech Automation 5.1

Interface: ISpeechRecoContext

EventInterests Property


The EventInterests property specifies the types of events accepted by the SpeechRecoContext object.

An event interest is a filtering mechanism for each recognition context. By setting EventInterests, the recognition context allows or denies speech recognition engine events to reach the application. All, none or selected types of events my be filtered. By default, speech recognition allows all events except SREAudioLevel (a change in audio level).


Syntax

Set: SpeechRecoContext.EventInterests = SpeechRecoEvents
Get: SpeechRecoEvents = SpeechRecoContext.EventInterests

Parts

SpeechRecoContext
The owning object.
SpeechRecoEvents
Set: One or more SpeechRecoEvents constants which set the property.
Get: A SpeechRecoEvents variable which gets the value of the property.

Remarks

The set of event constants defined for EventInterests is located in the SpeechRecoEvents enumeration list. Each type of event is represented by its own enumerated value. The value passed in to EventInterests is the total of each of the events required for the application. For example,

SRESoundStart + SRERecognition
could be passed as the value. Alternatively the same two interests could be passed as the single value of 18; SRESoundStart (value 2) plus SRERecognition (value 16). Conversely, if the application retrieved the current event setting and the value was 1064, it indicates that three events are active. Only SREPhraseStart (value 8), SREHypothesis (value 32), and SREInterference (value 1024) add up to that 1064 value.

See SpVoice.EventInterests for additions details. SpVoice.EventInterests is a similar function but affects text-to-speech events.

Example

The first snippet demonstrates retrieving the current event interest level. This sample assumes a valid RecognitionContext. If this value was not changed, myInterests is 327,679 (all SpeechRecoEvents values except SREAudioLevel). Both samples assume a valid RecognitionContext.

Dim myInterests As SpeechRecoEvents
myInterests = RecognitionContext.EventInterests

The next snippet demonstrates setting the event interest to three events. Instead of naming each value, a single value of 578 may be used: the sum of the three event values. The last two lines perform the same function and while displayed here for demonstration purposes, need not be used together.

Dim myInterests As SpeechRecoEvents
RecognitionContext.EventInterests = SRESoundStart + SREBookmark + SREFalseRecognition
RecognitionContext.EventInterests = 578