示例#1
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            //Assign statusbar text box to globals
            Global.StatusBarText      = statusBarText;
            Global.StatusBarText.Text = "Starting...";
            if (kinect == null)
            {
                Global.StatusBarText.Text = "No Kinect Sensor were found";
            }
            else
            {
                // Create and configure speech grammars and recognizer
                this.welcomeGrammar   = CreateGrammar(WelcomeSpeechRule);
                this.speechRecognizer = SpeechRecognizer.Create(new[] { welcomeGrammar });


                if (null != speechRecognizer)
                {
                    this.speechRecognizer.SpeechRecognized += SpeechRecognized;
                    Global.audioStream = this.speechRecognizer.Start(kinect.AudioSource);
                }
                Global.StatusBarText.Text = "Ready";
            }
        }
示例#2
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            //Assign statusbar text box to globals
            Global.StatusBarText = statusBarText;
            Global.StatusBarText.Text = "Starting...";
            if (kinect == null)
            {
                Global.StatusBarText.Text = "No Kinect Sensor were found";
            }
            else
            {

                // Create and configure speech grammars and recognizer
                this.welcomeGrammar = CreateGrammar(WelcomeSpeechRule);
                this.speechRecognizer = SpeechRecognizer.Create(new[] { welcomeGrammar });

                if (null != speechRecognizer)
                {
                    this.speechRecognizer.SpeechRecognized += SpeechRecognized;
                    Global.audioStream = this.speechRecognizer.Start(kinect.AudioSource);

                }
                Global.StatusBarText.Text = "Ready";
            }
        }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            // Create and configure speech grammars and recognizer
            this.welcomeGrammar = CreateGrammar(WelcomeSpeechRule);
            this.gameGrammar = CreateGrammar(GameSpeechRule);
            this.gameEndGrammar = CreateGrammar(GameEndSpeechRule);
            this.EnableGrammar(this.welcomeGrammar);
            this.speechRecognizer = SpeechRecognizer.Create(new[] { welcomeGrammar, gameGrammar, gameEndGrammar });

            if (null != speechRecognizer)
            {
                this.speechRecognizer.SpeechRecognized += SpeechRecognized;
                Global.audioStream = this.speechRecognizer.Start(kinect.AudioSource);
            }
        }