Hi, I have 2 identical USB microphones and I would like to start recording sound(with WaveIn) at the same time from both microphones. I tried to use 2 System.Threading.Thread’s with the WaveCallbackInfo.FunctionCallback() option when initiating the WaveIn class. Also I used 2 different device numbers. But the first recording(wav file) in the first thread I started, is a smaller and unrecognized file. But the second recording(wav file) in the second thread I started, records and plays the file perfectly. Does Naudio support multithreading or/and recording from multiple sources. If so, does anybody have any suggestions/examples for me to achieve my goal?
... Thread tWaveRecord = new Thread(StartRecording); tWaveRecord.IsBackground = true; Thread tWaveRecord2 = new Thread(StartRecording2); tWaveRecord2.IsBackground = true; tWaveRecord.Start(); tWaveRecord2.Start(); ... private void StartRecording() { waveIn = new WaveIn(WaveCallbackInfo.FunctionCallback()); waveIn.DeviceNumber = 0; waveIn.WaveFormat = new WaveFormat(96000, 1); writer = new WaveFileWriter(outputFilename, waveIn.WaveFormat); waveIn.DataAvailable += new EventHandler<WaveInEventArgs>(waveIn_DataAvailable); waveIn.RecordingStopped += new EventHandler(waveIn_RecordingStopped); waveIn.StartRecording(); Debug.WriteLine("Start Recording"); } private void StartRecording2() { waveIn2 = new WaveIn(WaveCallbackInfo.FunctionCallback()); waveIn2.DeviceNumber = 3; waveIn2.WaveFormat = new WaveFormat(96000, 1); writer2 = new WaveFileWriter(outputFilename2, waveIn2.WaveFormat); waveIn2.DataAvailable += new EventHandler<WaveInEventArgs>(waveIn_DataAvailable2); waveIn2.RecordingStopped += new EventHandler(waveIn_RecordingStopped2); waveIn2.StartRecording(); Debug.WriteLine("Start Recording 2"); }