private void ResetRecorderOnError()
        {
            Debug.WriteLine("Resetting the audio recorder");
            // Try to delete the file we were writing to.
            try
            {
                RobustFile.Delete(PathToRecordableAudioForCurrentSegment);
            }
            catch (Exception error)
            {
                Logger.WriteError("Audio Recording trying to delete " + PathToRecordableAudioForCurrentSegment, error);
            }
            // The recorder may well be in a bad state.  Throw it away and get a new one.
            // But maintain the assigned recording device.
            var currentMic = RecordingDevice.ProductName;

            _recorder.Dispose();
            CreateRecorder();
            SetRecordingDevice(currentMic);
        }
Esempio n. 2
0
 public void StopRecording()
 {
     // Stop the microphone if we used it for recording
     if (recordMicrophone)
     {
         Microphone.End(null);
         microphoneSource.Stop();
         audioRecorder.Dispose();
     }
     // Stop the recording
     videoRecorder.Dispose();
     NatCorder.StopRecording();
 }
Esempio n. 3
0
        protected virtual void Dispose(bool disposing)
        {
            if (!_disposed)
            {
                if (disposing)
                {
                    // dispose-only, i.e. non-finalizable logic
                    if (_recorder != null)
                    {
                        _recorder.Dispose();
                        _recorder = null;
                    }
                }

                // shared (dispose and finalizable) cleanup logic
                _disposed = true;
            }
        }
Esempio n. 4
0
 public void Dispose()
 {
     _audioRecorder?.Dispose();
     _audioRecorder = null;
 }
Esempio n. 5
0
 private async Task StartRecordAsync()
 {
     Recorder.Dispose();
     RecordBtn.Foreground = new SolidColorBrush(Colors.Red);
     await Recorder.StartAsync();
 }
Esempio n. 6
0
 public void Dispose()
 {
     _audioRecorder?.Dispose();
 }
Esempio n. 7
0
 public void Dispose()
 {
     audioRecorder.Dispose();
     DeleteTempFile();
 }