コード例 #1
0
        public void Start()
        {
            try {
                favoritesList   = new FavoritesList(config);
                spellBook       = new SpellBook(config);
                shoutsKnowledge = new ShoutsKnowledge(config);
                commandList     = config.GetConsoleCommandList();

                commandQueue = new BlockingCollection <string>();
                recognizer   = new SpeechRecognitionManager(config);
                recognizer.OnDialogueLineRecognized += Recognizer_OnDialogueLineRecognized;

                // Start in command-mode
                recognizer.StartSpeechRecognition(false, commandList, favoritesList, spellBook, shoutsKnowledge);

                listenThread     = new Thread(ListenForInput);
                submissionThread = new Thread(SubmitCommands);
                submissionThread.Start();
                listenThread.Start();
            }
            catch (Exception ex) {
                Trace.TraceError("Failed to initialize speech recognition due to error:");
                Trace.TraceError(ex.ToString());
            }
        }
コード例 #2
0
        public static Thread Start()
        {
            try {
                favoritesList = new FavoritesList();
                commandQueue  = new BlockingCollection <string>();
                recognizer    = new SpeechRecognitionManager();
                recognizer.OnDialogueLineRecognized += Recognizer_OnDialogueLineRecognized;

                // Start in command-mode
                recognizer.StartSpeechRecognition(false, Configuration.GetConsoleCommandList(), favoritesList);

                Thread listenThread = new Thread(ListenForInput);
                submissionThread = new Thread(SubmitCommands);
                submissionThread.Start();
                listenThread.Start();
                return(listenThread);
            }
            catch (Exception ex) {
                Trace.TraceError("Failed to initialize speech recognition due to error:");
                Trace.TraceError(ex.ToString());
            }

            return(null);
        }