private void buttonStopRecording_Click(object sender, EventArgs e) { if (_asioIn != null) { if (_plmRec != null) { _plmRec.Stop(); _plmRec = null; } // stop the device, since we don't need it anymore _asioIn.Stop(); // and dispose (unjoin and disable any channel) _asioIn.Dispose(); _asioIn = null; this.comboBoxAsioInputDevice.Enabled = true; this.comboBoxAsioInputChannel.Enabled = true; this.buttonStartRecording.Enabled = true; this.buttonStopRecording.Enabled = false; this.radioButtonNoFullDuplex.Checked = true; this.radioButtonAsioFullDuplex.Checked = false; this.radioButtonBassFullDuplex.Checked = false; this.radioButtonNoFullDuplex.Enabled = false; this.radioButtonAsioFullDuplex.Enabled = false; this.radioButtonBassFullDuplex.Enabled = false; this.comboBoxBassDevice.Enabled = false; this.checkBoxSaveToWave.Enabled = false; this.progressBarRecL.Value = 0; this.progressBarRecR.Value = 0; } }
private void buttonStartRecording_Click(object sender, EventArgs e) { // now setup the ASIO handler (recording 48kHz, stereo) _asioIn = new BassAsioHandler(true, comboBoxAsioInputDevice.SelectedIndex, comboBoxAsioInputChannel.SelectedIndex * 2, 2, BASSASIOFormat.BASS_ASIO_FORMAT_FLOAT, 48000d); if (_asioIn.Start((int)this.numericUpDownAsioBuffer.Value, 1)) { // use a DSP to measure the Level of the input _plmRec = new DSP_PeakLevelMeter(_asioIn.InputChannel, 0); _plmRec.Notification += new EventHandler(_plm_Rec_Notification); this.comboBoxAsioInputDevice.Enabled = false; this.comboBoxAsioInputChannel.Enabled = false; this.buttonStopRecording.Enabled = true; this.buttonStartRecording.Enabled = false; this.radioButtonNoFullDuplex.Enabled = true; this.radioButtonAsioFullDuplex.Enabled = true; this.radioButtonBassFullDuplex.Enabled = true; this.comboBoxBassDevice.Enabled = true; this.checkBoxSaveToWave.Enabled = true; } else { _asioIn.Dispose(); _asioIn = null; MessageBox.Show("Asio Device could not be started!"); } }
private void buttonOpenFile_Click(object sender, System.EventArgs e) { this.openFileDialog.FileName = _fileName; if (DialogResult.OK == this.openFileDialog.ShowDialog(this)) { if (File.Exists(this.openFileDialog.FileName)) { _fileName = this.openFileDialog.FileName; // create the decoding stream _stream = Bass.BASS_StreamCreateFile(_fileName, 0, 0, BASSFlag.BASS_STREAM_DECODE | BASSFlag.BASS_SAMPLE_FLOAT); if (_stream != 0) { // now setup the ASIO handler _asioOut = new BassAsioHandler(comboBoxAsioOutputDevice.SelectedIndex, comboBoxAsioOutputChannel.SelectedIndex * 2, _stream); if (_asioOut.Start((int)this.numericUpDownAsioBuffer.Value, 1)) { // use a DSP to measure the Level _plmPlay = new DSP_PeakLevelMeter(_asioOut.OutputChannel, 0); _plmPlay.Notification += new EventHandler(_plm_Play_Notification); this.comboBoxAsioOutputDevice.Enabled = false; this.comboBoxAsioOutputChannel.Enabled = false; this.buttonOpenFile.Enabled = false; this.buttonStop.Enabled = true; } else { _asioOut.Dispose(); _asioOut = null; MessageBox.Show("Asio Device could not be started!"); } } else { MessageBox.Show(String.Format("Error = {0}", Bass.BASS_ErrorGetCode())); } } else { _fileName = String.Empty; } } }
private void buttonStop_Click(object sender, System.EventArgs e) { if (_asioOut != null) { // stop the DSP _plmPlay.Stop(); _plmPlay = null; // stop the device, since we don't need it anymore _asioOut.Stop(); // and dispose (unjoin and disable any channel) _asioOut.Dispose(); _asioOut = null; // and free the source channel Bass.BASS_StreamFree(_stream); _stream = 0; this.comboBoxAsioOutputDevice.Enabled = true; this.comboBoxAsioOutputChannel.Enabled = true; this.buttonOpenFile.Enabled = true; this.buttonStop.Enabled = false; this.progressBarPlayL.Value = 0; this.progressBarPlayR.Value = 0; } }