/* * Enable/disable SR * Disable SR when you absolutely don't need to recognize a speech. * You can keep the SR running when activate/deactivate grammars */ public void enableSR(bool b) { if (b) { if (!recOn) { while (!loadGrammarCompleted && loadGrammarCount != 0) { Thread.Sleep(3); } Debug.WriteLine("is load grammar complete before enable SR? " + loadGrammarCompleted + "\t" + EBookUtil.GetUnixTimeMillis()); ebookStream.enable(true); recEngine.RecognizeAsync(RecognizeMode.Multiple); recOn = true; Debug.WriteLine("Rec on"); } } else { if (recOn) { ebookStream.enable(false); recEngine.RecognizeAsyncCancel();//.RecognizeAsyncStop(); recOn = false; Debug.WriteLine("Rec off"); } } }
public void start() { ebookStream.enable(true); recEngine.RecognizeAsync(RecognizeMode.Multiple); }