상속: IDisposable
예제 #1
0
 private void registerVoiceControllerStates(SpeechRecognizer speechEngine)
 {
     speechEngine.RegisterVoiceActionResult(x => SendEventThroughPipe( ViCharConversion.ActionToByte( (ViCharVoiceAction)x ) ) );
 }
예제 #2
0
        //Enables all the appropriate Kinect streams, and sets the smoothing for skeleton data
        // Also sets up the speech recognition engine
        private void InitializeKinectServices(KinectSensor sensor)
        {
            sensorManager.ColorFormat = ColorImageFormat.RgbResolution640x480Fps30;
            sensorManager.ColorStreamEnabled = true;

            sensor.SkeletonFrameReady += this.SkeletonsReady;
            sensorManager.TransformSmoothParameters = new TransformSmoothParameters
            {
                Smoothing = 0.5f,
                Correction = 0.5f,
                Prediction = 0.5f,
                JitterRadius = 0.05f,
                MaxDeviationRadius = 0.04f
            };
            sensorManager.SkeletonStreamEnabled = true;
            sensorManager.KinectSensorEnabled = true;

            if (!sensorManager.KinectSensorAppConflict)
            {
                speechManager = SpeechRecognizer.Create(ViCharVoiceActionGrammar.Words);

                if (speechManager != null)
                {
                    registerVoiceControllerStates(speechManager);
                    speechManager.Start(sensor.AudioSource);
                }
            }
        }
        // This method exists so that it can be easily called and return safely if the speech prereqs aren't installed.
        // We isolate the try/catch inside this class, and don't impose the need on the caller.
        public static SpeechRecognizer Create(List<string> words)
        {
            SpeechRecognizer recognizer = null;

            try
            {
                recognizer = new SpeechRecognizer(words);
            }
            catch (Exception)
            {
                // speech prereq isn't installed. a null recognizer will be handled properly by the app.
            }

            return recognizer;
        }