I am working on a C # application that uses the SAPI COM component. In the following snippe code, how can I tell the recognizer to start recognizing based on the grammar and wav file? Thanks.
ISpRecognizer sre = new SpInprocRecognizerClass(); ISpRecoContext context = null; sre.CreateRecoContext(out context); ISpRecoGrammar grammar = null; context.CreateGrammar(1, out grammar); grammar.LoadCmdFromFile(@"c:\grammar", SPLOADOPTIONS.SPLO_STATIC); grammar.SetGrammarState(SPGRAMMARSTATE.SPGS_ENABLED); SpFileStreamClass fs = new SpFileStreamClass(); fs.Open(@"c:\1.wav", SpeechStreamFileMode.SSFMOpenForRead, false); ((SpInprocRecognizerClass)sre).AudioInputStream = fs;
source share