GotSpeech.NET

The online community for Microsoft Speech Server developers
Welcome to GotSpeech.NET Sign in | Join | Help
in Search
Gold Systems

Starting/Stopping Inproc Recognizer

Last post 03-15-2010, 11:20 PM by cjreynolds. 0 replies.
Sort Posts: Previous Next
  •  03-15-2010, 11:20 PM 10249

    Starting/Stopping Inproc Recognizer

    I'm writing a c&c app in VB6 using an inproc recognizer. I have one particular form that needs to be shown as vbModal, therefore it needs to create it's own reco, because the reco that is running on the main form won't receive commands if a form is displayed modally. I tried just initializing the reco, etc. on the modal form's form_load method, but it's not recognizing any commands. I am using this to initialize SR:

    Public WithEvents rc As SpInProcRecoContext
    Public Recognizer As SpInprocRecognizer
    Public myGrammar, b As ISpeechRecoGrammar
    ____________________________________________

    Private Sub Form_Load()
    Dim Category As SpObjectTokenCategory
    Dim Token As SpObjectToken
        
        Set rc = New SpInProcRecoContext
        Set Recognizer = rc.Recognizer
        Set myGrammar = rc.CreateGrammar
        
        Filename = App.Path & "\grammars\prmt_x_drive.xml"
        myGrammar.CmdLoadFromFile Filename, SLODynamic
        myGrammar.CmdSetRuleIdState 0, SGDSActive

        Set Category = New SpObjectTokenCategory
        Category.SetId SpeechCategoryAudioIn

        Set Token = New SpObjectToken
        Token.SetId Category.Default()
        Set Recognizer.AudioInput = Token

    End Sub

     I have tried setting all of the objects to "Nothing" - Do I need to reset the AudioInput value, or is there another way I need to close the previous reco?


    joe
View as RSS news feed in XML