public SequenceRecorder(Conductor cond, KeyboardConfiguration key) { conductor = cond; keyboard = key; InitializeComponent(); int waveInDevices = NAudio.Wave.WaveIn.DeviceCount; for (int waveInDevice = 0; waveInDevice < waveInDevices; waveInDevice++) { NAudio.Wave.WaveInCapabilities deviceInfo = NAudio.Wave.WaveIn.GetCapabilities(waveInDevice); microphoneList.Items.Add(waveInDevice+": "+deviceInfo.ProductName); } microphoneList.SelectedIndex = 0; sensitivity.SelectedIndex = 0; sourceStream = new NAudio.Wave.WaveIn(); sourceStream.DeviceNumber = 0; sourceStream.WaveFormat = conductor.GetWaveFormat();// new NAudio.Wave.WaveFormat(44100, NAudio.Wave.WaveIn.GetCapabilities(0).Channels); bytesPerChannel = (sourceStream.WaveFormat.BitsPerSample / 8); bytesPerSample = bytesPerChannel * sourceStream.WaveFormat.Channels; sourceStream.DataAvailable += new EventHandler<NAudio.Wave.WaveInEventArgs>(sourceStream_DataAvailable); sourceStream.StartRecording(); }
public SequenceRecorder(Conductor cond, KeyboardConfiguration key) { conductor = cond; keyboard = key; InitializeComponent(); int waveInDevices = NAudio.Wave.WaveIn.DeviceCount; for (int waveInDevice = 0; waveInDevice < waveInDevices; waveInDevice++) { NAudio.Wave.WaveInCapabilities deviceInfo = NAudio.Wave.WaveIn.GetCapabilities(waveInDevice); microphoneList.Items.Add(waveInDevice + ": " + deviceInfo.ProductName); } microphoneList.SelectedIndex = 0; sensitivity.SelectedIndex = 0; sourceStream = new NAudio.Wave.WaveIn(); sourceStream.DeviceNumber = 0; sourceStream.WaveFormat = conductor.GetWaveFormat();// new NAudio.Wave.WaveFormat(44100, NAudio.Wave.WaveIn.GetCapabilities(0).Channels); bytesPerChannel = (sourceStream.WaveFormat.BitsPerSample / 8); bytesPerSample = bytesPerChannel * sourceStream.WaveFormat.Channels; sourceStream.DataAvailable += new EventHandler <NAudio.Wave.WaveInEventArgs>(sourceStream_DataAvailable); sourceStream.StartRecording(); }