protected override void OnKinectStatusChanged(object sender, KinectSensorManagerEventArgs <KinectStatus> args) { if ((null != this.KinectSensorManager) && (null != this.KinectSensorManager.KinectSensor) && (null != this.KinectSensorManager.KinectSensor.AudioSource)) { this.EnsureAudio(this.KinectSensorManager.KinectSensor, this.KinectSensorManager.KinectSensor.Status); } }
protected override void OnKinectSensorChanged(object sender, KinectSensorManagerEventArgs <KinectSensor> args) { if (null == args) { throw new ArgumentNullException("args"); } if ((null != args.OldValue) && (null != args.OldValue.AudioSource)) { // remove old handlers args.OldValue.AudioSource.BeamAngleChanged -= this.AudioSourceBeamChanged; args.OldValue.AudioSource.SoundSourceAngleChanged -= this.AudioSourceSoundSourceAngleChanged; if (null != this.audioStream) { this.audioStream.Close(); } args.OldValue.AudioSource.Stop(); } if ((null != args.NewValue) && (null != args.NewValue.AudioSource)) { // add new handlers args.NewValue.AudioSource.BeamAngleChanged += this.AudioSourceBeamChanged; args.NewValue.AudioSource.SoundSourceAngleChanged += this.AudioSourceSoundSourceAngleChanged; this.EnsureAudio(args.NewValue, args.NewValue.Status); } }
protected override void OnKinectSensorChanged(object sender, KinectSensorManagerEventArgs <KinectSensor> args) { if (null == args) { throw new ArgumentNullException("args"); } if (null != args.OldValue) { args.OldValue.ColorFrameReady -= this.ColorImageReady; if (!this.RetainImageOnSensorChange) { kinectColorImage.Source = null; this.lastImageFormat = ColorImageFormat.Undefined; } } if ((null != args.NewValue) && (KinectStatus.Connected == args.NewValue.Status)) { ResetFrameRateCounters(); if (ColorImageFormat.RawYuvResolution640x480Fps15 == args.NewValue.ColorStream.Format) { throw new NotImplementedException("RawYuv conversion is not yet implemented."); } else { args.NewValue.ColorFrameReady += this.ColorImageReady; } } }
protected override void OnKinectSensorChanged(object sender, KinectSensorManagerEventArgs <KinectSensor> args) { if (null != args.OldValue) { args.OldValue.AllFramesReady -= this.KinectAllFramesReady; } if ((null != args.NewValue) && (KinectStatus.Connected == args.NewValue.Status)) { args.NewValue.AllFramesReady += this.KinectAllFramesReady; } }
protected override void OnKinectSensorChanged(object sender, KinectSensorManagerEventArgs <KinectSensor> args) { if (null == args) { throw new ArgumentNullException("args"); } if (null != this.processingThread) { // The background thread handles sensor changes and events, so call the processingThread object // to switch sensors. this.processingThread.SensorChanged(args.OldValue, args.NewValue); } }
protected override void OnKinectRunningStateChanged(object sender, KinectSensorManagerEventArgs <bool> args) { if ((null != this.KinectSensorManager) && (null != this.KinectSensorManager.KinectSensor)) { if (this.KinectSensorManager.KinectSensor.IsRunning) { kinectSpeechCommander.Start(this.KinectSensorManager.KinectSensor); } else { kinectSpeechCommander.Stop(); } } }
protected override void OnKinectSensorChanged(object sender, KinectSensorManagerEventArgs <KinectSensor> args) { if (null == args) { throw new ArgumentNullException("args"); } var oldKinectSensor = args.OldValue; var newKinectSensor = args.NewValue; if (oldKinectSensor != null) { oldKinectSensor.SkeletonFrameReady -= this.SkeletonFrameReady; } if (newKinectSensor != null && newKinectSensor.Status == KinectStatus.Connected) { newKinectSensor.SkeletonFrameReady += this.SkeletonFrameReady; } this.EnsureSkeletonStreamState(); }
protected override void OnKinectSensorChanged(object sender, KinectSensorManagerEventArgs <KinectSensor> args) { if ((null != args.OldValue) && (null != args.OldValue.AudioSource)) { // remove old handlers kinectSpeechCommander.Stop(); kinectSpeechCommander.ActiveListeningModeChanged -= this.KinectSpeechCommander_ActiveListeningModeChanged; kinectSpeechCommander.SpeechRecognized -= this.KinectSpeechCommander_SpeechRecognized; } if ((null != args.NewValue) && (null != args.NewValue.AudioSource)) { if (args.NewValue.IsRunning) { kinectSpeechCommander.Start(args.NewValue); } // add new handlers kinectSpeechCommander.ActiveListeningModeChanged += this.KinectSpeechCommander_ActiveListeningModeChanged; kinectSpeechCommander.SpeechRecognized += this.KinectSpeechCommander_SpeechRecognized; } }
/// <summary> /// Virtual method which can be used to react to app conflict state changes of the underlying KinectSensor. /// </summary> /// <param name="sender">The current KinectSensorManager</param> /// <param name="args">The args, which contain the old and new values</param> protected virtual void OnKinectAppConflictChanged(object sender, KinectSensorManagerEventArgs <bool> args) { }
/// <summary> /// Virtual method which can be used to react to running state changes of the underlying KinectSensor. /// </summary> /// <param name="sender">The current KinectSensorManager</param> /// <param name="args">The args, which contain the old and new values</param> protected virtual void OnKinectRunningStateChanged(object sender, KinectSensorManagerEventArgs <bool> args) { }
/// <summary> /// Virtual method which can be used to react to status changes of the underlying KinectSensor. /// </summary> /// <param name="sender">The current KinectSensorManager</param> /// <param name="args">The args, which contain the old and new values</param> protected virtual void OnKinectStatusChanged(object sender, KinectSensorManagerEventArgs <KinectStatus> args) { }