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);
        }
Example #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();
 }
        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;
            }
        }
Example #4
0
 public void Dispose()
 {
     _audioRecorder?.Dispose();
     _audioRecorder = null;
 }
 private async Task StartRecordAsync()
 {
     Recorder.Dispose();
     RecordBtn.Foreground = new SolidColorBrush(Colors.Red);
     await Recorder.StartAsync();
 }
Example #6
0
 public void Dispose()
 {
     _audioRecorder?.Dispose();
 }
Example #7
0
 public void Dispose()
 {
     audioRecorder.Dispose();
     DeleteTempFile();
 }