Exemplo n.º 1
0
 private void TmrSpeaking_Tick(object sender, EventArgs e)
 {
     if (RecTimeout == 10)
     {
         _recognizer.RecognizeAsyncCancel();
     }
     else if (RecTimeout == 11)
     {
         TmrSpeaking.Stop();
         _recognizer.RecognizeAsync(RecognizeMode.Multiple);
     }
 }
Exemplo n.º 2
0
        //Listening for the wake word. Might not be enabled, depending on user choice.
        private void startListening_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
        {
            //when speech is recognized, store what was recognized into a string
            string speech = e.Result.Text;

            //if the wake word is heard, stop listening for wake words,
            if (speech.Equals(droidName))
            {
                recognizer.RecognizeAsync(RecognizeMode.Multiple);
                startListening.RecognizeAsyncCancel();
                astromechOn.Play();
                timeOut = 0;
                TmrSpeaking.Start();
            }
        }
Exemplo n.º 3
0
        //Determines what was heard and then acts accordingly
        private void recognizer_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
        {
            //stop the timer
            TmrSpeaking.Stop();

            //handle input
            PerformCommand(e.Result.Text);

            //reset sleep timer and start counting again
            timeOut = 0;

            if (useWakeWord)
            {
                TmrSpeaking.Start();
            }
        }
Exemplo n.º 4
0
        private void Astromech_Load(object sender, EventArgs e)
        {
            keybinds = new Keybinds();

            TmrSpeaking.Stop();
            astromechOn.LoadAsync();
            astromechOff.LoadAsync();

            //Load last used droid name, time to wait, and wake word bool
            if (Properties.Settings.Default != null)
            {
                droidNameInput.Text       = Properties.Settings.Default.Droid_Name;
                timeToWaitSelector.Value  = Properties.Settings.Default.Wait_Time;
                useWakeWordChkBox.Checked = Properties.Settings.Default.Use_Wake_Word;
            }

            droidName   = droidNameInput.Text;
            timeToWait  = (int)timeToWaitSelector.Value;
            useWakeWord = useWakeWordChkBox.Checked;
        }
Exemplo n.º 5
0
        //There is a timer active in the form. It ticks once per second when wake word is in use.
        //When ten seconds have passed with no recognizeable speech, we reset to the beginning.
        private void TmrSpeaking_Tick(object sender, EventArgs e)
        {
            timeOut++;

            if (timeOut == timeToWait)
            {
                //stop listening for major commands
                recognizer.RecognizeAsyncCancel();

                //listen for wake word
                astromechOff.Play();
                startListening.RecognizeAsync(RecognizeMode.Multiple);

                //stop timer
                TmrSpeaking.Stop();

                //reset recTimeOut
                timeOut = 0;
            }
        }