SampleApp.MainForm.btnStart_Click C# (CSharp) Method

btnStart_Click() private method

Starts capturing from the chosen audio input interface
private btnStart_Click ( object sender, EventArgs e ) : void
sender object
e EventArgs
return void
        void btnStart_Click(object sender, EventArgs e)
        {
            // Get the device currently selected in the combobox
            AudioDeviceInfo info = comboBox1.SelectedItem as AudioDeviceInfo;

            if (info == null)
            {
                MessageBox.Show("No audio devices available.");
                return;
            }

            // Create a new audio capture device
            source = new AudioCaptureDevice(info)
            {
                // Capture at 22050 Hz
                DesiredFrameSize = 2048,
                SampleRate = 22050
            };

            // Wire up some notification events
            source.NewFrame += source_NewFrame;
            source.AudioSourceError += source_AudioSourceError;
            
            // Start it!
            source.Start();
        }
MainForm