/** * <summary> * The <c>Echo</c> constructor is used to initialize the starting confidence level and the starting recognition type. * </summary> * <remarks> * The <c>Echo</c> constructor will instantiate all of its private data members and assign the initial confidence level and recognition * mode the recognition engine is in. You can the two following modes <c>RecognizeMode.Multiple</c> - where the speech recognition object * listens until told to stop - or <c>RecognizeMode.Single</c> - where once a speech pattern is recognized, it stops running. <em>Needless to * say, the <c>RecognizedMode.Multiple</c> is the preferred choice.</em> * </remarks> * <param name="Initial_Confidence"> * The initial confidence level that a given speech pattern must make before a reaction is made by the * recognition engine. * </param> * <param name="Initial_Recognition"> * The initial recognition mode the recognition engine will start off with. * </param> * <example> * <b>An example of initializing the constuctor is the following:</b> * * <code> * Echo_Major = new Echo(.80f, RecognizeMode.Multiple); * </code> * * This will set thw initial confidence level at eighty percent (80%) and sets the recognition engine to recognize multiple speech patterns. * </example> * */ public Echo(float Initial_Confidence, RecognizeMode Initial_Recognition) { this.Confidence_Level = Initial_Confidence; this.Recognition_Type = Initial_Recognition; this.Recogn_Engine = new SpeechRecognitionEngine(); this.Recogn_Engine.SetInputToDefaultAudioDevice(); #region EventHandler<SpeechRecognizedEventArgs>[] My_Events = new EventHandler<SpeechRecognizedEventArgs>[4]; My_Events[0] = new EventHandler<SpeechRecognizedEventArgs>(Default_Recognition); My_Events[1] = new EventHandler<SpeechRecognizedEventArgs>(Default_Recognition_II); // My_Events[1] = new EventHandler<SpeechRecognizedEventArgs>((sender, e) => this.Default_Recognition_III(sender, e, "repairs", "What exactly needs repairing?", this.Ham)); My_Events[2] = new EventHandler<SpeechRecognizedEventArgs>((sender, e) => this.Default_Recognition_III(sender, e, "shoot", "Why do you want to shoot?", this.Eggs)); My_Events[3] = new EventHandler<SpeechRecognizedEventArgs>(doSomething); this.Recogn_Engine.SpeechRecognized += My_Events[0]; //this.Recogn_Engine.SpeechRecognized += My_Events[1]; //this.Recogn_Engine.SpeechRecognized += My_Events[2]; #endregion this.Chain_Base = new List<Key_and_Command>(); this.Choice_Base = new List<Choices>(); this.Choice_Dictionary = new List<Key_and_Choice>(); this.Ignition_Phords = new List<GrammarBuilder>(); this.Recognition_Table.Builders_IU = new List<GrammarBuilder>(); this.Recognition_Table.Choice_Combination = new Choices(); this.Recognition_Table.Inginition_Set = new List<ushort>(); }
public void RecognizeAsync(RecognizeMode mode) { if (Grammars.Count == 0) { throw new InvalidOperationException(SR.Get(SRID.RecognizerHasNoGrammar)); } RecoBase.RecognizeAsync(mode); }
public void Recognize(RecognizeMode modo) { engine.SetInputToDefaultAudioDevice(); gramatica.Append(new Choices(escolhas)); engine.LoadGrammar(new Grammar(gramatica)); engine.RecognizeAsync(modo); }
void ListenForAsync(string[] phrases, RecognizeMode mode) { StopListening(); RecognitionEngine.UnloadAllGrammars(); var grammar = CreateGrammar(phrases); RecognitionEngine.LoadGrammar(grammar); RecognitionEngine.RecognizeAsync(mode); }
/// <summary> /// 非同期で音声認識を開始します。 /// </summary> /// <param name="multiple">常に音声を認識する場合は true</param> public static void RecognizeAsync(bool multiple) { if (IsRecognizing || Engine.Grammars.Count <= 0 || !IsAvailable) { return; } RecognizeMode mode = (multiple) ? RecognizeMode.Multiple : RecognizeMode.Single; Engine.RecognizeAsync(mode); }
/** * <summary> * The <c>Echo</c> constructor is used to initialize the starting confidence level and the starting recognition type. * </summary> * <remarks> * The <c>Echo</c> constructor will instantiate all of its private data members and assign the initial confidence level and recognition * mode the recognition engine is in. You can the two following modes <c>RecognizeMode.Multiple</c> - where the speech recognition object * listens until told to stop - or <c>RecognizeMode.Single</c> - where once a speech pattern is recognized, it stops running. <em>Needless to * say, the <c>RecognizedMode.Multiple</c> is the preferred choice.</em> * </remarks> * <param name="Initial_Confidence"> * The initial confidence level that a given speech pattern must make before a reaction is made by the * recognition engine. * </param> * <param name="Initial_Recognition"> * The initial recognition mode the recognition engine will start off with. * </param> * <example> * <b>An example of initializing the constuctor is the following:</b> * * <code> * Echo_Major = new Echo(.80f, RecognizeMode.Multiple); * </code> * * This will set thw initial confidence level at eighty percent (80%) and sets the recognition engine to recognize multiple speech patterns. * </example> * */ public Echo(float Initial_Confidence, RecognizeMode Initial_Recognition) { this.Confidence_Level = Initial_Confidence; this.Recognition_Type = Initial_Recognition; this.Recogn_Engine = new SpeechRecognitionEngine(); this.Recogn_Engine.SetInputToDefaultAudioDevice(); #region EventHandler<SpeechRecognizedEventArgs>[] My_Events = new EventHandler<SpeechRecognizedEventArgs>[4]; My_Events[0] = new EventHandler<SpeechRecognizedEventArgs>(Default_Recognition); My_Events[1] = new EventHandler<SpeechRecognizedEventArgs>(Default_Recognition_II); // My_Events[1] = new EventHandler<SpeechRecognizedEventArgs>((sender, e) => this.Default_Recognition_III(sender, e, "repairs", "What exactly needs repairing?", this.Ham)); My_Events[2] = new EventHandler<SpeechRecognizedEventArgs>((sender, e) => this.Default_Recognition_III(sender, e, "shoot", "Why do you want to shoot?", this.Eggs)); My_Events[3] = new EventHandler<SpeechRecognizedEventArgs>(doSomething); this.Recogn_Engine.SpeechRecognized += My_Events[0]; //this.Recogn_Engine.SpeechRecognized += My_Events[1]; //this.Recogn_Engine.SpeechRecognized += My_Events[2]; #endregion this.Chain_Base = new List<Key_and_Command>(); this.Choice_Base = new List<Choices>(); this.Choice_Dictionary = new List<Key_and_Choice>(); this.Ignition_Phords = new List<GrammarBuilder>(); this.Recognition_Table.Builders_IU = new List<GrammarBuilder>(); this.Recognition_Table.Choice_Combination = new Choices(); this.Recognition_Table.Inginition_Set = new List<ushort>(); }
public void RecognizeAsync( RecognizeMode mode ) { engine.RecognizeAsync( mode ); }
/// <summary> /// Recognizes speech asynchronously. /// </summary> /// <param name="mode">Recognizer mode</param> void ISpeechRecognitionEngine.RecognizeAsync(RecognizeMode mode) { engine.RecognizeAsync(mode); }
public void RecognizeAsync(RecognizeMode mode) { engine.RecognizeAsync(mode); }
public static int SetRecognizeMode(RecognizeMode recognizeMode) { Mode = (int)recognizeMode; return(CarModelRecognize.SetRecognizeMode( Mode)); }