public virtual void Close() { BitmapSourceProvider.Dispose(); if (Mpeg4Recorder != null) { Mpeg4Recorder.Dispose(); } Detector.MotionDetection -= Detector_MotionDetection; Detector.Dispose(); VadFilter.VoiceDetected -= VadFilterVoiceDetected; VadFilter.Dispose(); if (SoundTimer != null) { SoundTimer.Elapsed -= ElapsedVoice; SoundTimer.Stop(); SoundTimer.Dispose(); } if (MotionTimer != null) { MotionTimer.Elapsed -= ElapsedVoice; MotionTimer.Stop(); MotionTimer.Dispose(); } }
protected override void ElapsedVoice(object sender, EventArgs eventArgs) { if (SoundTimer != null) { SoundTimer.Stop(); SoundTimer.Elapsed -= ElapsedVoice; SoundTimer.Dispose(); } Connector.Disconnect(_camera.AudioChannel, WaveStreamRecorder); WaveStreamRecorder.Stop(); WaveStreamRecorder.Dispose(); VadFilter.Enabled = true; IsSoundDetected = false; Log.Motion("Sound recording has stopped"); OnGetFilePath(new VoIPEventArgs <string>(SoundFilePath)); }