public void SpeechRecognitionEngineProperties() { using (var rec = new SpeechRecognitionEngine()) { rec.SetInputToNull(); rec.InitialSilenceTimeout = new TimeSpan(); rec.BabbleTimeout = new TimeSpan(); rec.EndSilenceTimeout = new TimeSpan(); rec.EndSilenceTimeoutAmbiguous = new TimeSpan(); rec.MaxAlternates = 1; Assert.Throws <KeyNotFoundException>(() => rec.QueryRecognizerSetting("foo")); Assert.Throws <KeyNotFoundException>(() => rec.UpdateRecognizerSetting("foo", "bar")); Assert.Throws <KeyNotFoundException>(() => rec.UpdateRecognizerSetting("foo", 1)); } }
private static void ListSettings(SpeechRecognitionEngine recognizer) { foreach (string setting in settings) { try { object value = recognizer.QueryRecognizerSetting(setting); Console.WriteLine(" {0,-30} = {1}", setting, value); } catch { Console.WriteLine(" {0,-30} is not supported by this recognizer.", setting); } } Console.WriteLine(); }
public int getRecognizerSetting(String name) { return((int)speechRecognitionEngine.QueryRecognizerSetting(name)); }