SpeechRecognizer Status Property

Microsoft Speech SDK

Intelligent Interface Technologies Home Page Microsoft Speech SDK

Speech Automation 5.1

Interface: ISpeechRecognizer

Status Property


The Status property returns an object representing the status of the recognizer.

This method provides information for static features about the speech recognition (SR) engine such as the languages it supports. It also provides information for dynamic features such as current stream position the engine has recognized up to, and if the stream is actively being sent to the engine.


Syntax

Set: (This property is read-only)
Get: ISpeechRecognizerStatus = SpeechRecognizer.Status

Parts

SpeechRecognizer
The owning object.
ISpeechRecognizerStatus
Set: (This property is read-only)
Get: An ISpeechRecognizerStatus that gets the property.

Example

This code sample demonstrates the Status method. After creating an instance for a recognizer, Status retrieves information about the recognizer. The class ID that created the engine, the supported languages, (in decimal format) and the current device position is displayed.

To run this code, create a form with the following control:

  • A label called Label1
  • Paste this code into the Declarations section of the form.

    The Form_Load procedure creates the recognizer.

    Public WithEvents RC As SpSharedRecoContext
    Public myGrammar As ISpeechRecoGrammar
    
    Private Sub Form_Load()
        Set RC = New SpSharedRecoContext
        
        Set myGrammar = RC.CreateGrammar
        myGrammar.DictationSetState SGDSActive
        
        Dim recoStatus As ISpeechRecognizerStatus
        Set recoStatus = RC.Recognizer.Status
        
        'Display engine CLSID
        Label1.Caption = recoStatus.ClsidEngine & vbCrLf
        
        'Display supported languages
        Dim i As Long
        Dim x As Variant
        For i = 0 To UBound(recoStatus.SupportedLanguages)
            Label1.Caption = Label1.Caption & recoStatus.SupportedLanguages(i) & vbCrLf
        Next i
        
        'display audio position
        Label1.Caption = Label1.Caption & recoStatus.AudioStatus.CurrentDevicePosition
    End Sub