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();
}