public RecordingSession(int millisecondsToRecordBeforeStopping)
     : this()
 {
     if (millisecondsToRecordBeforeStopping == 0)
     {
         millisecondsToRecordBeforeStopping = 1000;
     }
     Thread.Sleep(millisecondsToRecordBeforeStopping);
     _recorder.StopRecordingAndSaveAsWav();
 }
        private void OnRecordUp(object sender, MouseEventArgs e)
        {
            if (!_recorder.IsRecording)
            {
                return;
            }
            try
            {
                _recorder.StopRecordingAndSaveAsWav();
            }
            catch (Exception)
            {
                //swallow it review: initial reason is that they didn't hold it down long enough, could detect and give message
            }

            if (_recorder.LastRecordingMilliseconds < 500)
            {
                if (File.Exists(_path))
                {
                    File.Delete(_path);
                }
                _hint.Text = "Hold down the record button while talking.";
            }
            else
            {
                _hint.Text = "";
            }
            UpdateScreen();
            if (SoundRecorded != null)
            {
                SoundRecorded.Invoke(this, null);
                UsageReporter.SendNavigationNotice("AudioRecorded");
            }
        }
Example #3
0
 private void _stopButton_Click(object sender, EventArgs e)
 {
     try
     {
         if (_recorder.IsRecording)
         {
             _recorder.StopRecordingAndSaveAsWav();
         }
         else
         {
             _recorder.StopPlaying();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Sound Problem");
     }
     UpdateScreen();
 }
Example #4
0
 public RecordingSession(int millisecondsToRecordBeforeStopping)
     : this()
 {
     Thread.Sleep(1000);           //record a second
     _recorder.StopRecordingAndSaveAsWav();
 }