private void BACK_Click(object sender, EventArgs e) { KSensor.Dispose(); this.Hide(); Choosing ch = new Choosing(username); ch.Show(); }
/// <summary> /// KinectSensor Dispose /// </summary> public void Dispose() { if (_kinect == null) { return; } _kinect.Dispose(); }
/// <summary> /// Kinectの動作を停止する /// </summary> /// <param name="kinect"></param> private void StopKinect(KinectSensor kinect) { if (kinect != null) { if (kinect.IsRunning) { // 音声のスレッドを停止する isContinue = false; // フレーム更新イベントを削除する kinect.ColorFrameReady -= kinect_ColorFrameReady; kinect.DepthFrameReady -= kinect_DepthFrameReady; kinect.SkeletonFrameReady -= kinect_SkeletonFrameReady; // 音源方向更新イベントを削除する kinect.AudioSource.BeamAngleChanged -= AudioSource_BeamAngleChanged; kinect.AudioSource.SoundSourceAngleChanged -= AudioSource_SoundSourceAngleChanged; // Kinectの停止と、ネイティブリソースを解放する kinect.Stop(); kinect.Dispose(); imageRgb.Source = null; imageDepth.Source = null; } } }
private void AudioThread() { _abort = new ManualResetEvent(false); while (!_abort.WaitOne(0) && !MainForm.ShuttingDown) { int dataLength = _audioStream.Read(_audioBuffer, 0, _audioBuffer.Length); if (DataAvailable != null) { _waveProvider.AddSamples(_audioBuffer, 0, dataLength); if (Listening) { WaveOutProvider.AddSamples(_audioBuffer, 0, dataLength); } //forces processing of volume level without piping it out var sampleBuffer = new float[dataLength]; int read = _sampleChannel.Read(sampleBuffer, 0, dataLength); DataAvailable?.Invoke(this, new DataAvailableEventArgs((byte[])_audioBuffer.Clone(), read)); } } try { if (_sensor != null) { _sensor.AudioSource?.Stop(); _sensor.Stop(); _sensor.SkeletonFrameReady -= SensorSkeletonFrameReady; _sensor.ColorFrameReady -= SensorColorFrameReady; _sensor.DepthFrameReady -= SensorDepthFrameReady; _sensor.Dispose(); _sensor = null; } } catch { // ignored } if (_sampleChannel != null) { _sampleChannel.PreVolumeMeter -= SampleChannelPreVolumeMeter; } if (_waveProvider != null && _waveProvider.BufferedBytes > 0) { _waveProvider.ClearBuffer(); } Listening = false; PlayingFinished?.Invoke(this, new PlayingFinishedEventArgs(_res)); _abort.Close(); }
/// <summary> /// Stop Knect Runtimes /// </summary> public void Stop() { if (KSensor != null) { KSensor.Stop(); KSensor.Dispose(); } }
public void Cleanup() { if (_sensor != null) { _sensor.Stop(); _sensor.Dispose(); } }
public static void Disable(KinectSensor sensor) { sensor.AudioSource.Stop(); sensor.ColorStream.Disable(); sensor.DepthStream.Disable(); sensor.Stop(); sensor.Dispose(); }
public void Dispose() { if (sensor != null) { sensor.Stop(); sensor.Dispose(); } }
/// <summary> /// Kinectの動作を停止する /// </summary> /// <param name="kinect"></param> private static void StopKinect(KinectSensor kinect) { if (kinect.IsRunning) { kinect.Stop(); kinect.Dispose(); } }
public void DisposeKinect() { if (myKinect != null) { isOK = false; myKinect.Dispose(); } }
private void DeActivateSensor() { if (kinectSensor != null) { kinectSensor.Stop(); kinectSensor.ColorFrameReady -= new EventHandler <ColorImageFrameReadyEventArgs>(kinectSensor_ColorFrameReady); kinectSensor.Dispose(); } }
/// <summary> /// UnloadContent will be called once per game and is the place to unload /// all content. /// </summary> protected override void UnloadContent() { // TODO: Unload any non ContentManager content here if (kinectSensor != null) { kinectSensor.Stop(); kinectSensor.Dispose(); } }
void Current_Exit(object sender, ExitEventArgs e) { if (sensor != null) { sensor.Stop(); sensor.Dispose(); sensor = null; } }
private void Clean() { if (kinectSensor != null) { presenceControl.Clean(); kinectSensor.Dispose(); kinectSensor = null; } }
private void Window_Closed(object sender, EventArgs e) { if (kinect != null) { kinect.Stop(); kinect.Dispose(); kinect = null; } }
//evento para cerrar el sensor private void Window_Closed(object sender, EventArgs e) { if (sensor != null) { sensor.AudioSource.Stop(); sensor.Stop(); sensor.Dispose(); sensor = null; } }
public void Dispose() { if (sensor != null) { timer.Stop(); sensor.SkeletonStream.Disable(); sensor.Stop(); sensor.Dispose(); } }
public void Stop() { if (m_KinectSensor != null) { m_KinectSensor.SkeletonFrameReady -= new EventHandler <SkeletonFrameReadyEventArgs>(OnSkeletonFrameReady); m_KinectSensor.Stop(); m_KinectSensor.Dispose(); m_KinectSensor = null; } }
//cleans up the sensor public void CleanUp() { if (_sensor == null) { return; } _sensor.Stop(); _sensor.Dispose(); }
protected override void OnClosing(System.ComponentModel.CancelEventArgs e) { if (sensor == null) { return; } sensor.Stop(); sensor.Dispose(); base.OnClosing(e); }
void OnApplicationQuit() { // Dispose the Kinect sensor if (sensor != null) { sensor.Dispose(); sensor = null; } Debug.Log("Goodbye"); return; }
public void shutdown(object sender, CancelEventArgs e) { if (voiceController != null) { voiceController.StopRecognition(); } if (sensor != null) { sensor.Stop(); sensor.Dispose(); } }
/// <summary> /// Kinectの動作を停止する /// </summary> /// <param name="kinect"></param> private void StopKinect(KinectSensor kinect) { if (kinect != null) { if (kinect.IsRunning) { // Kinectの停止と、ネイティブリソースを解放する kinect.Stop(); kinect.Dispose(); } } }
/// <summary> /// Kinectの動作を停止する /// </summary> /// <param name="kinect"></param> private void StopKinect(KinectSensor kinect) { if (kinect != null) { if (kinect.IsRunning) { kinect.AllFramesReady -= kinect_AllFramesReady; kinect.Stop(); kinect.Dispose(); } } }
public void Stop() { if (_sampleChannel != null) { _sampleChannel.PreVolumeMeter -= SampleChannelPreVolumeMeter; } if (_stopEvent != null) { _stopEvent.Set(); Thread.Sleep(500); _stopEvent.Close(); _stopEvent.Dispose(); _stopEvent = null; } try { if (_sensor != null) { if (_sensor.AudioSource != null) { _sensor.AudioSource.Stop(); } _sensor.Stop(); _sensor.SkeletonFrameReady -= SensorSkeletonFrameReady; _sensor.ColorFrameReady -= SensorColorFrameReady; _sensor.DepthFrameReady -= SensorDepthFrameReady; _sensor.Dispose(); _sensor = null; } } catch (Exception) { } if (_waveProvider != null && _waveProvider.BufferedBytes > 0) { _waveProvider.ClearBuffer(); } Listening = false; _stopEvent = null; _isrunning = false; }
private void btnConnectClick(object sender, RoutedEventArgs e) { if (btnConnect.Content.ToString() == "Connect") { if (KinectSensor.KinectSensors.Count > 0) { this.btnConnect.Content = "Stop"; kSensor = KinectSensor.KinectSensors[0]; if (kSensor.Status == KinectStatus.Connected) { this.connectStatus.Content = kSensor.Status.ToString(); } KinectSensor.KinectSensors.StatusChanged += KinectSensors_StatusChanged; } try { kSensor.Start(); kSensor.ColorStream.Enable(ColorImageFormat.RgbResolution640x480Fps30); kSensor.ColorFrameReady += KSensor_ColorFrameReady; } catch { this.connectStatus.Content = "Cannot connect Kinect"; } } else { if (kSensor != null && kSensor.IsRunning) { if (videoWriter != null) { videoWriter.Dispose(); } kSensor.Stop(); kSensor.ColorStream.Disable(); kSensor.SkeletonStream.Disable(); kSensor.Dispose(); kSensor = null; btnRecord.Content = "Record"; this.btnConnect.Content = "Connect"; this.connectStatus.Content = "Disconnect"; this.frameStatus.Content = "Disconnect"; this.count = 0; } } }
/// <summary> /// Dispose method /// </summary> public void Dispose() { if (audioSource != null) { audioSource.Stop(); //not really needed since we'll call Stop on the sensor itself audioSource = null; } if (sensor != null) { sensor.Stop(); sensor.Dispose(); sensor = null; } }
void Current_Exit(object sender, ExitEventArgs e) { if (speechRecognizer != null) { speechRecognizer.RecognizeAsyncCancel(); speechRecognizer.RecognizeAsyncStop(); } if (sensor != null) { sensor.AudioSource.Stop(); sensor.Stop(); sensor.Dispose(); sensor = null; } }
private void disconnectSensor() { if (activeSensor != null) { KinectSensor localSensor = activeSensor; activeSensor = null; CurrentStatus = KinectStatus.Disconnected; localSensor.Stop(); localSensor.Dispose(); if (SensorDisconnected != null) { SensorDisconnected.Invoke(this); } } }
public byte dispose(string[] args) { try { verifArgs(1, args); getKinectSensor(int.Parse(args[0])); sensor.Dispose(); Console.WriteLine("dispose"); return(KSuccess.QueryOk); } catch (KActionException e) { rData = e.Message; return(e.exceptionNumber); } }