//Kinect enabled apps should customize which Kinect services it initializes here. private void InitializeKinectServices(Runtime runtime) { runtimeOptions = RuntimeOptions.UseDepthAndPlayerIndex | RuntimeOptions.UseSkeletalTracking | RuntimeOptions.UseColor; //KinectSDK TODO: should be able to understand a Kinect used by another app without having to try/catch. try { Kinect.Initialize(runtimeOptions); } catch (COMException comException) { //TODO: make CONST if (comException.ErrorCode == -2147220947) //Runtime is being used by another app. { Kinect = null; ShowStatus(ErrorCondition.KinectAppConflict); return; } else { throw comException; } } kinectViewer.RuntimeOptions = runtimeOptions; kinectViewer.Kinect = Kinect; Kinect.SkeletonEngine.TransformSmooth = true; Kinect.SkeletonFrameReady += new EventHandler<SkeletonFrameReadyEventArgs>(SkeletonsReady); speechRecognizer = SpeechRecognizer.Create(); //returns null if problem with speech prereqs or instantiation. if (speechRecognizer != null) { speechRecognizer.Start(new KinectAudioSource()); //KinectSDK TODO: expose Runtime.AudioSource to return correct audiosource. speechRecognizer.SaidSomething += new EventHandler<SpeechRecognizer.SaidSomethingEventArgs>(recognizer_SaidSomething); } else { ShowStatus(ErrorCondition.NoSpeech); speechRecognizer = null; } }