Пример #1
0
 /// <summary>
 /// Releases the recorder object
 /// </summary>
 private void CloseRecorder()
 {
     try
     {
         if (waveStreamRecorder != null)
         {
             waveStreamRecorder.StopStreaming();
             OnIntroductionStoped(waveStreamRecorder);
             waveStreamRecorder.StopStreaming();
             waveStreamRecorder.Dispose();
         }
     }
     catch (Exception)
     {
     }
 }
Пример #2
0
        /// <summary>
        /// Stops wav recording.
        /// </summary>
        public void StopWavRecording()
        {
            if (wavRecorder == null)
            {
                return;
            }

            wavRecorder.StopStreaming();
            wavRecorder.Dispose();
        }
Пример #3
0
        private void CallEnded()
        {
            _log.Info("Audio position at " + _wavRecorder.Stream.Position);
            _log.Info("Call Completed");
            _wavRecorder.StopStreaming();
            _connector.Disconnect(_audioReceiver, _mixer);
            _connector.Disconnect(_mixer, _wavRecorder);
            _wavRecorder.Stream.Flush();
            _wavRecorder.Dispose();
            _wavRecorder = null;
            _audioReceiver.Detach();
            _log.Info("Call tear down done");

            // Wake up the main thread
            _complete = true;
            lock (_sync)
            {
                Monitor.Pulse(_sync);
            }
        }
        public void StopRecording()
        {
            recording_duration = DateTime.Now.Subtract(recording_started);
            var new_filename = String.Empty;

            switch (format)
            {
            case RecordingFileFormat.MP3:
                if (mp3_recorder.IsStreaming)
                {
                    ConnectOrDisconnectAudioReceiver(mp3_recorder, false);
                    mp3_recorder.StopStreaming();
                    mp3_recorder.Dispose();
                    new_filename = String.Format("{0}_{1}_{2}{3}{4}_{5}{6}{7}_{8}.mp3", session.Caller, session.Callee, recording_started.Year, recording_started.Month.ToString("D2"), recording_started.Day.ToString("D2"), recording_started.Hour.ToString("D2"), recording_started.Minute.ToString("D2"), recording_started.Second.ToString("D2"), recording_duration.ToString("hhmmss"));
                }
                break;

            case RecordingFileFormat.WAV:
                if (wav_recorder.IsStreaming)
                {
                    ConnectOrDisconnectAudioReceiver(wav_recorder, false);
                    wav_recorder.StopStreaming();
                    wav_recorder.Dispose();
                    new_filename = String.Format("{0}_{1}_{2}{3}{4}_{5}{6}{7}_{8}.wav", session.Caller, session.Callee, recording_started.Year, recording_started.Month.ToString("D2"), recording_started.Day.ToString("D2"), recording_started.Hour.ToString("D2"), recording_started.Minute.ToString("D2"), recording_started.Second.ToString("D2"), recording_duration.ToString("hhmmss"));
                }
                break;

            default:
                throw new NotImplementedException();
            }

            var path = Path.Combine(SettingsHelper.RecordingPath, extension_subpath);

            CreateFolderIfNecessery(path);
            File.Move(recorder_filename, Path.Combine(path, new_filename));
        }