Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. WPF
  4. Sound Command that can intercept the Active Thread

Sound Command that can intercept the Active Thread

Scheduled Pinned Locked Moved WPF
csharpwpfiothelptutorial
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    Vimalsoft Pty Ltd
    wrote on last edited by
    #1

    Good Day all i am working on a Kinect Sensor Program, but i think this question can best be answered by the WPF forum. In my Kinect Project , the User can use Kinect Gestures or Voice Commands. THe Gestures work nicely its like one is using a mouse. i have a challenge with the Voice Commands which follow a certain Process. Please note that this functionality works well when one is not using voice commands. Let me make a simple example. i have a 3 Buttons Button 1 = "System Ok " Button 2 = " View Error" Button 3 = "System Reboot" Step 1: Now the logic say , if a user enter a wrong command , the System must play a sound for Error and the button for " View Error" must Animate. Step 2: The Rule goes on and say if the User has not click the " View Error" within 5 seconds , Stop the Animation on the " View Error" Step 3: and Animate the "System Reboot" and play the Sound for "System Reboot" Now on a normal button click with a Mouse , this would work. But now i am not clicking the Button Physically, i am using Voice Commands and i have trapped the SpeechRecognized event which is defined like this

    private void SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
    {
    // Speech utterance confidence below which we treat speech as if it hadn't been heard
    const double ConfidenceThreshold = 0.3;

            // Number of degrees in a right angle.
            const int DegreesInRightAngle = 90;
    
            // Number of pixels turtle should move forwards or backwards each time.
            const int DisplacementAmount = 60;
    
            this.ClearRecognitionHighlights();
    
            if (e.Result.Confidence >= ConfidenceThreshold)
            {
                switch (e.Result.Semantics.Value.ToString())
                { 
                  
                    case "VIEWERROR":
                        Error\_Escaped = true;
                        btnViewError\_Click(null, null); 
                        break;
                    case "SYSTEMREBOOT":
                        btnSystemReboot\_Click(null, null);
                        break;
                    case "SYSTEMSTATUS":
                        SystemStatus\_Click(null, null); 
                        break; 
                }
            }
            else
            {
                // set the status text
                this.Status.Content = Properties.Resources.GrammarConfidenceLow;
                Logger.NormalLog(
    
    L 1 Reply Last reply
    0
    • V Vimalsoft Pty Ltd

      Good Day all i am working on a Kinect Sensor Program, but i think this question can best be answered by the WPF forum. In my Kinect Project , the User can use Kinect Gestures or Voice Commands. THe Gestures work nicely its like one is using a mouse. i have a challenge with the Voice Commands which follow a certain Process. Please note that this functionality works well when one is not using voice commands. Let me make a simple example. i have a 3 Buttons Button 1 = "System Ok " Button 2 = " View Error" Button 3 = "System Reboot" Step 1: Now the logic say , if a user enter a wrong command , the System must play a sound for Error and the button for " View Error" must Animate. Step 2: The Rule goes on and say if the User has not click the " View Error" within 5 seconds , Stop the Animation on the " View Error" Step 3: and Animate the "System Reboot" and play the Sound for "System Reboot" Now on a normal button click with a Mouse , this would work. But now i am not clicking the Button Physically, i am using Voice Commands and i have trapped the SpeechRecognized event which is defined like this

      private void SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
      {
      // Speech utterance confidence below which we treat speech as if it hadn't been heard
      const double ConfidenceThreshold = 0.3;

              // Number of degrees in a right angle.
              const int DegreesInRightAngle = 90;
      
              // Number of pixels turtle should move forwards or backwards each time.
              const int DisplacementAmount = 60;
      
              this.ClearRecognitionHighlights();
      
              if (e.Result.Confidence >= ConfidenceThreshold)
              {
                  switch (e.Result.Semantics.Value.ToString())
                  { 
                    
                      case "VIEWERROR":
                          Error\_Escaped = true;
                          btnViewError\_Click(null, null); 
                          break;
                      case "SYSTEMREBOOT":
                          btnSystemReboot\_Click(null, null);
                          break;
                      case "SYSTEMSTATUS":
                          SystemStatus\_Click(null, null); 
                          break; 
                  }
              }
              else
              {
                  // set the status text
                  this.Status.Content = Properties.Resources.GrammarConfidenceLow;
                  Logger.NormalLog(
      
      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      I would launch a timer from ViewError(); instead of putting it into a wait state. The speech recognition event can kill the timer if it still running; else the timer sets off whatever needs to be done after time has elapsed. (A basic "timeout" pattern).

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups