/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // TODO: Add your initialization logic here //initialize Kinect SDK nui = new Runtime(); nui.Initialize(RuntimeOptions.UseDepthAndPlayerIndex | RuntimeOptions.UseSkeletalTracking); nui.SkeletonEngine.TransformSmooth = true; TransformSmoothParameters param = new TransformSmoothParameters(); param.Smoothing = 0.2f; param.Correction = 0.0f; param.Prediction = 0.0f; param.JitterRadius = 0.2f; param.MaxDeviationRadius = 0.3f; nui.SkeletonEngine.SmoothParameters = param; nui.SkeletonFrameReady += new EventHandler <SkeletonFrameReadyEventArgs>(nui_SkeletonFrameReady); handPos[0] = new Vector3(0.0f, 0.0f, 0.0f); handPos[1] = new Vector3(0.0f, 0.0f, 0.0f); //set up angles shiftAngleRemote1 = shiftAngleLocal + 115.3733f; shiftAngleRemote2 = shiftAngleLocal - 93.9733f; //for sphere distortion = new Distortion(Vector3.Zero, Vector3.Backward, Vector3.Up, 1, 1); //for cylinder //distortion = new Distortion(Vector3.Zero, Vector3.Backward, Vector3.Up, 1, 1, distortionShift, 4); View = Matrix.CreateLookAt(new Vector3(0, 0, 2), Vector3.Zero, Vector3.Up); Projection = Matrix.CreatePerspectiveFieldOfView( MathHelper.PiOver4, 16.0f / 9.0f, 1, 500); //setupOSC(); base.Initialize(); }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // TODO: Add your initialization logic here //initialize Kinect SDK nui = Runtime.Kinects[0]; nui.Initialize(RuntimeOptions.UseDepthAndPlayerIndex | RuntimeOptions.UseSkeletalTracking); nui.SkeletonEngine.TransformSmooth = true; TransformSmoothParameters param = new TransformSmoothParameters(); param.Smoothing = 0.2f; param.Correction = 0.0f; param.Prediction = 0.0f; param.JitterRadius = 0.2f; param.MaxDeviationRadius = 0.3f; nui.SkeletonEngine.SmoothParameters = param; nui.SkeletonFrameReady += new EventHandler<SkeletonFrameReadyEventArgs>(nui_SkeletonFrameReady); //setup audio RecognizerInfo ri = GetKinectRecognizer(); if (ri == null) { Console.WriteLine("Could not find Kinect speech recognizer. Please refer to the sample requirements."); return; } Console.WriteLine("Using: {0}", ri.Name); sre = new SpeechRecognitionEngine(); var models = new Choices(); models.Add("lander"); models.Add("flowers"); models.Add("car"); var gb = new GrammarBuilder(); //Specify the culture to match the recognizer in case we are running in a different culture. gb.Culture = ri.Culture; gb.Append(models); // Create the actual Grammar instance, and then load it into the speech recognizer. var g = new Grammar(gb); sre.LoadGrammar(g); sre.SpeechRecognized += SreSpeechRecognized; sre.SpeechHypothesized += SreSpeechHypothesized; sre.SpeechRecognitionRejected += SreSpeechRecognitionRejected; source = new KinectAudioSource(); source.FeatureMode = true; source.AutomaticGainControl = false; source.SystemMode = SystemMode.OptibeamArrayOnly; Stream s = source.Start(); sre.SetInputToAudioStream(s, new SpeechAudioFormatInfo(EncodingFormat.Pcm, 16000, 16, 1, 32000, 2, null)); Console.WriteLine("Recognizing. Say: 'red', 'green' or 'blue'. Press ENTER to stop"); sre.RecognizeAsync(RecognizeMode.Multiple); handPos[0] = new Vector3(0.0f, 0.0f, 0.0f); handPos[1] = new Vector3(0.0f, 0.0f, 0.0f); //set up angles shiftAngleRemote1 = shiftAngleLocal + 115.3733f; shiftAngleRemote2 = shiftAngleLocal - 93.9733f; //initialize hand angles prevHandYAngle = 0.0f; prevHandXAngle = 0.0f; //for sphere distortion = new Distortion(Vector3.Zero, Vector3.Backward, Vector3.Up, 1, 1); //for cylinder //distortion = new Distortion(Vector3.Zero, Vector3.Backward, Vector3.Up, 1, 1, distortionShift, 4); View = Matrix.CreateLookAt(new Vector3(0, 0, 2), Vector3.Zero, Vector3.Up); Projection = Matrix.CreatePerspectiveFieldOfView( MathHelper.PiOver4, 16.0f / 9.0f, 1, 500); //setupOSC(); base.Initialize(); }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // TODO: Add your initialization logic here //initialize Kinect SDK nui = Runtime.Kinects[0]; nui.Initialize(RuntimeOptions.UseDepthAndPlayerIndex | RuntimeOptions.UseSkeletalTracking); nui.SkeletonEngine.TransformSmooth = true; TransformSmoothParameters param = new TransformSmoothParameters(); param.Smoothing = 0.2f; param.Correction = 0.0f; param.Prediction = 0.0f; param.JitterRadius = 0.2f; param.MaxDeviationRadius = 0.3f; nui.SkeletonEngine.SmoothParameters = param; nui.SkeletonFrameReady += new EventHandler <SkeletonFrameReadyEventArgs>(nui_SkeletonFrameReady); //setup audio RecognizerInfo ri = GetKinectRecognizer(); if (ri == null) { Console.WriteLine("Could not find Kinect speech recognizer. Please refer to the sample requirements."); return; } Console.WriteLine("Using: {0}", ri.Name); sre = new SpeechRecognitionEngine(); var models = new Choices(); models.Add("lander"); models.Add("flowers"); models.Add("car"); var gb = new GrammarBuilder(); //Specify the culture to match the recognizer in case we are running in a different culture. gb.Culture = ri.Culture; gb.Append(models); // Create the actual Grammar instance, and then load it into the speech recognizer. var g = new Grammar(gb); sre.LoadGrammar(g); sre.SpeechRecognized += SreSpeechRecognized; sre.SpeechHypothesized += SreSpeechHypothesized; sre.SpeechRecognitionRejected += SreSpeechRecognitionRejected; source = new KinectAudioSource(); source.FeatureMode = true; source.AutomaticGainControl = false; source.SystemMode = SystemMode.OptibeamArrayOnly; Stream s = source.Start(); sre.SetInputToAudioStream(s, new SpeechAudioFormatInfo(EncodingFormat.Pcm, 16000, 16, 1, 32000, 2, null)); Console.WriteLine("Recognizing. Say: 'red', 'green' or 'blue'. Press ENTER to stop"); sre.RecognizeAsync(RecognizeMode.Multiple); handPos[0] = new Vector3(0.0f, 0.0f, 0.0f); handPos[1] = new Vector3(0.0f, 0.0f, 0.0f); //set up angles shiftAngleRemote1 = shiftAngleLocal + 115.3733f; shiftAngleRemote2 = shiftAngleLocal - 93.9733f; //initialize hand angles prevHandYAngle = 0.0f; prevHandXAngle = 0.0f; //for sphere distortion = new Distortion(Vector3.Zero, Vector3.Backward, Vector3.Up, 1, 1); //for cylinder //distortion = new Distortion(Vector3.Zero, Vector3.Backward, Vector3.Up, 1, 1, distortionShift, 4); View = Matrix.CreateLookAt(new Vector3(0, 0, 2), Vector3.Zero, Vector3.Up); Projection = Matrix.CreatePerspectiveFieldOfView( MathHelper.PiOver4, 16.0f / 9.0f, 1, 500); //setupOSC(); base.Initialize(); }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // TODO: Add your initialization logic here //initialize Kinect SDK nui = new Runtime(); nui.Initialize(RuntimeOptions.UseDepthAndPlayerIndex | RuntimeOptions.UseSkeletalTracking); nui.SkeletonEngine.TransformSmooth = true; TransformSmoothParameters param = new TransformSmoothParameters(); param.Smoothing = 0.2f; param.Correction = 0.0f; param.Prediction = 0.0f; param.JitterRadius = 0.2f; param.MaxDeviationRadius = 0.3f; nui.SkeletonEngine.SmoothParameters = param; nui.SkeletonFrameReady += new EventHandler<SkeletonFrameReadyEventArgs>(nui_SkeletonFrameReady); handPos[0] = new Vector3(0.0f, 0.0f, 0.0f); handPos[1] = new Vector3(0.0f, 0.0f, 0.0f); //set up angles shiftAngleRemote1 = shiftAngleLocal + 115.3733f; shiftAngleRemote2 = shiftAngleLocal - 93.9733f; //for sphere distortion = new Distortion(Vector3.Zero, Vector3.Backward, Vector3.Up, 1, 1); //for cylinder //distortion = new Distortion(Vector3.Zero, Vector3.Backward, Vector3.Up, 1, 1, distortionShift, 4); View = Matrix.CreateLookAt(new Vector3(0, 0, 2), Vector3.Zero, Vector3.Up); Projection = Matrix.CreatePerspectiveFieldOfView( MathHelper.PiOver4, 16.0f / 9.0f, 1, 500); //setupOSC(); base.Initialize(); }