public void InsertRecording(Recording recording) { using (var connection = new SQLiteConnection(_dbPath) { Trace = true }) { connection.Insert(recording); } }
/// <summary> /// Update UI doo-dads every 250 milliseconds. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void uiTimer_Tick(object sender, EventArgs e) { if (comboMicrophone.SelectedItem != null) { var micLevel = (int)(Math.Round(((MMDevice)comboMicrophone.SelectedItem).AudioMeterInformation.MasterPeakValue * 100)); vuMeter.Level = micLevel; } _ticksBetweenBarks++; // Has enough time elapsed between ticks to start a new wav? if (_isRecording && _ticksBetweenBarks >= _maxTicksBetweenBarks) { // Stop recording and throw away the current wav file. StopRecording(true); _currentRecording = null; // reset tick counter _ticksBetweenBarks = 0; // Restart recording StartRecording(); } }
private void StartNewWaveFile() { var fileName = Path.Combine(Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "wav"), DateTime.Now.ToString("yyyyMMddTHHmmss") + ".wav"); _currentRecording = new Recording(fileName); _waveSource = new WaveIn(); _waveSource.WaveFormat = new WaveFormat(44100, 1); _waveSource.DataAvailable += new EventHandler<WaveInEventArgs>(waveSource_DataAvailable); _waveSource.RecordingStopped += new EventHandler<StoppedEventArgs>(waveSource_RecordingStopped); _waveFile = new WaveFileWriter(_currentRecording.FileName, _waveSource.WaveFormat); _waveSource.StartRecording(); }