当前位置: 首页>>代码示例>>C#>>正文


C# SpeechRecognitionEngine.SetInputToNull方法代码示例

本文整理汇总了C#中SpeechRecognitionEngine.SetInputToNull方法的典型用法代码示例。如果您正苦于以下问题:C# SpeechRecognitionEngine.SetInputToNull方法的具体用法?C# SpeechRecognitionEngine.SetInputToNull怎么用?C# SpeechRecognitionEngine.SetInputToNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SpeechRecognitionEngine的用法示例。


在下文中一共展示了SpeechRecognitionEngine.SetInputToNull方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: addApplication

        public void addApplication(MonaApplication app)
        {
            SpeechRecognitionEngine appReco = new SpeechRecognitionEngine();

            lock (runningApplications)
            {
                runningApplications[app.getIndex()] = app;

                lock (commands)
                {
                    commands[app.getIndex()] = new Dictionary<string, int>();

                    lock (engines)
                    {
                        lock (grammars)
                        {
                            grammars[app.getIndex()] = new Dictionary<string, Grammar>();
                        }

                        appReco.SetInputToNull();
                        appReco.SpeechRecognized += recognizedWord;
                        appReco.MaxAlternates = 1;


                        engines[app.getIndex()] = appReco;
                    }
                }

                lock (numberLock)
                {
                    applicationsNb++;
                }
            }
        }
开发者ID:rokuan,项目名称:mona,代码行数:34,代码来源:MainWindow.xaml.cs

示例2: AddRecognizer

        AudioInstance AddRecognizer(bool active)
        {
            SpeechRecognitionEngine recognizer = new SpeechRecognitionEngine(new CultureInfo("en-GB"));
            try
            {
                //dumpSupported(recognizer);
                Thread.CurrentThread.CurrentCulture = new CultureInfo("en-GB");
                Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-GB");
                //recognizer.LoadGrammar(CreateGrammar(mTheWorld));

                // Configure the input to the recognizer.
                recognizer.SetInputToNull();

                // Attach event handlers.
                recognizer.SpeechRecognized += new EventHandler<SpeechRecognizedEventArgs>(recognizer_SpeechRecognized);
                recognizer.RecognizeCompleted += new EventHandler<RecognizeCompletedEventArgs>(recognizer_RecognizeCompleted);
                recognizer.SpeechHypothesized += new EventHandler<SpeechHypothesizedEventArgs>(recognizer_SpeechHypothesized);

                // Perform recognition of the whole file.
                //Form1.updateLog("Starting asynchronous recognition...");

                AudioInstance ai = new AudioInstance();
                ai.audioStream = null;
                ai.ID = null;
                ai.engine = recognizer;
                ai.Active = false;
                ai.NeedNewGrammar = true;
                //Console.WriteLine("Entering lock: AddRecognizer");
                lock (engines)
                {
                    engines.Add(ai);
                    if (active) ai.Active = true;
                }
                //Console.WriteLine("Exitting lock: AddRecognizer");
                return ai;
            }
            catch (Exception e)
            {
                Form1.updateLog("AddStream exception: " + e.ToString(), ELogLevel.Error,
                    ELogType.Audio | ELogType.SpeechRecog);
            }
            return null;
        }
开发者ID:kingtut666,项目名称:holly,代码行数:43,代码来源:AudioRecog_SAPI.cs


注:本文中的SpeechRecognitionEngine.SetInputToNull方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。