Пример #1
0
        /// <summary>
        /// Helper to handle event dispatch for rejected speech utterances.
        /// </summary>
        /// <param name="command">
        /// Text of speech command that was rejected. May be <code>null</code>.
        /// </param>
        /// <param name="confidenceLevel">
        /// Value (from 0.0 to 1.0) assigned by the recognizer that represents the likelihood that a
        /// recognized phrase matches a given input.
        /// </param>
        /// <param name="activeModeRecognition">
        /// <code>true</code> if speech commander was in active listening mode when this event came in.
        /// <code>false</code> otherwise.
        /// </param>
        private void OnSpeechRejected(string command, double confidenceLevel, bool activeModeRecognition)
        {
            if (SpeechRejected != null)
            {
                SpeechCommanderEventArgs e = new SpeechCommanderEventArgs();
                e.Command               = command;
                e.ConfidenceLevel       = confidenceLevel;
                e.ActiveModeRecognition = activeModeRecognition;

                SpeechRejected(this, e);
            }
        }
        /// <summary>
        /// Helper to handle event dispatch for recognized speech utterances.
        /// </summary>
        /// <param name="command">
        /// Text of semantic speech command that was recognized.
        /// </param>
        /// <param name="words">
        /// Text of speech utterance that was recognized.
        /// </param>
        /// <param name="confidenceLevel">
        /// Value (from 0.0 to 1.0) assigned by the recognizer that represents the likelihood that a
        /// recognized phrase matches a given input.
        /// </param>
        /// <param name="activeModeRecognition">
        /// <code>true</code> if speech commander was in active listening mode when this event came in.
        /// <code>false</code> otherwise.
        /// </param>
        private void OnSpeechRecognized(string command, string words, double confidenceLevel, bool activeModeRecognition)
        {
            SpeechCommanderEventArgs e = new SpeechCommanderEventArgs();

            e.Command               = command;
            e.Words                 = words;
            e.ConfidenceLevel       = confidenceLevel;
            e.ActiveModeRecognition = activeModeRecognition;

            if (this.SpeechRecognized != null)
            {
                this.SpeechRecognized(this, e);
            }
        }
        private void KinectSpeechCommander_SpeechRecognized(object sender, SpeechCommanderEventArgs e)
        {
            switch (e.Command)
            {
            case "IRMODE_NEAR":
                try
                {
                    this.KinectSensorManager.DepthRange = DepthRange.Near;
                    textBlockActionFeedback.Text        = "Range: Near";
                }
                catch (InvalidOperationException)
                {
                    textBlockActionFeedback.Text = "Near mode is not supported.";
                }

                this.OnVoiceCommandActivated();
                break;

            case "IRMODE_DEFAULT":
                this.KinectSensorManager.DepthRange = DepthRange.Default;
                textBlockActionFeedback.Text        = "Range: Default";
                this.OnVoiceCommandActivated();
                break;

            case "STMODE_SEATED":
                this.KinectSensorManager.SkeletonTrackingMode = SkeletonTrackingMode.Seated;
                textBlockActionFeedback.Text = "Skeleton: Seated";
                this.OnVoiceCommandActivated();
                break;

            case "STMODE_DEFAULT":
                this.KinectSensorManager.SkeletonTrackingMode = SkeletonTrackingMode.Default;
                textBlockActionFeedback.Text = "Skeleton: Default";
                this.OnVoiceCommandActivated();
                break;

            default:
                break;
            }
        }
        private void KinectSpeechCommander_SpeechRecognized(object sender, SpeechCommanderEventArgs e)
        {
            switch (e.Command)
            {
                case "IRMODE_NEAR":
                    try
                    {
                        this.KinectSensorManager.DepthRange = DepthRange.Near;
                        textBlockActionFeedback.Text = "Range: Near";
                    }
                    catch (InvalidOperationException)
                    {
                        textBlockActionFeedback.Text = "Near mode is not supported.";
                    }

                    this.OnVoiceCommandActivated();
                    break;
                case "IRMODE_DEFAULT":
                    this.KinectSensorManager.DepthRange = DepthRange.Default;
                    textBlockActionFeedback.Text = "Range: Default";
                    this.OnVoiceCommandActivated();
                    break;
                case "STMODE_SEATED":
                    this.KinectSensorManager.SkeletonTrackingMode = SkeletonTrackingMode.Seated;
                    textBlockActionFeedback.Text = "Skeleton: Seated";
                    this.OnVoiceCommandActivated();
                    break;
                case "STMODE_DEFAULT":
                    this.KinectSensorManager.SkeletonTrackingMode = SkeletonTrackingMode.Default;
                    textBlockActionFeedback.Text = "Skeleton: Default";
                    this.OnVoiceCommandActivated();
                    break;
                default:
                    break;
            }
        }
Пример #5
0
        /// <summary>
        /// Helper to handle event dispatch for recognized speech utterances.
        /// </summary>
        /// <param name="command">
        /// Text of semantic speech command that was recognized.
        /// </param>
        /// <param name="words">
        /// Text of speech utterance that was recognized.
        /// </param>
        /// <param name="confidenceLevel">
        /// Value (from 0.0 to 1.0) assigned by the recognizer that represents the likelihood that a
        /// recognized phrase matches a given input.
        /// </param>
        /// <param name="activeModeRecognition">
        /// <code>true</code> if speech commander was in active listening mode when this event came in.
        /// <code>false</code> otherwise.
        /// </param>
        private void OnSpeechRecognized(string command, string words, double confidenceLevel, bool activeModeRecognition)
        {
            SpeechCommanderEventArgs e = new SpeechCommanderEventArgs();
            e.Command = command;
            e.Words = words;
            e.ConfidenceLevel = confidenceLevel;
            e.ActiveModeRecognition = activeModeRecognition;

            if (this.SpeechRecognized != null)
            {
                this.SpeechRecognized(this, e);
            }
        }
        /// <summary>
        /// Helper to handle event dispatch for rejected speech utterances.
        /// </summary>
        /// <param name="command">
        /// Text of speech command that was rejected. May be <code>null</code>.
        /// </param>
        /// <param name="confidenceLevel">
        /// Value (from 0.0 to 1.0) assigned by the recognizer that represents the likelihood that a
        /// recognized phrase matches a given input.
        /// </param>
        /// <param name="activeModeRecognition">
        /// <code>true</code> if speech commander was in active listening mode when this event came in.
        /// <code>false</code> otherwise.
        /// </param>
        private void OnSpeechRejected(string command, double confidenceLevel, bool activeModeRecognition)
        {
            if (SpeechRejected != null)
            {
                SpeechCommanderEventArgs e = new SpeechCommanderEventArgs();
                e.Command = command;
                e.ConfidenceLevel = confidenceLevel;
                e.ActiveModeRecognition = activeModeRecognition;

                SpeechRejected(this, e);
            }
        }