This project has moved and is read-only. For the latest updates, please go here.

When I switch from WasapiCapture to WaveIn, DataAvailable is never called

Aug 12, 2010 at 6:29 AM

I need to record sounds from the microphone as a wav file, and got it to work pretty fast using WasapiCapture. Thanks for putting together such a useful library, Mark.

However, I am running into an issue. Because I need this to work on Windows XP as well, I replaced:

this.waveIn = new WasapiCapture(recordingDevice);

with the following code:


var waveIn = new WaveIn();        
waveIn.WaveFormat = new WaveFormat(8000, 1);        

this.waveIn = waveIn;



Bizarrely, the code stops working, and DataIsAvailable stops being called.

this.waveIn.DataAvailable += new EventHandler<WaveInEventArgs>(DataIsAvailable);
I found a thread which listed an issue, but it didn't seem that there was a resolution:

Any suggestions highly welcome! If this is of any help, I am running this on a BackgroundWorker.

Cheers, and thanks again for the great job,


Aug 12, 2010 at 6:39 AM

Never mind, found out an answer on this thread; using the constructor with CallBack does the trick.

var waveIn = new WaveIn(WaveCallbackInfo.FunctionCallback());

Aug 12, 2010 at 7:18 AM

argh, looks like we all stumbled on this call..