I just found NAudio the other day and I've been playing with it. I have written a simple windows form program that has a load button (loads a specific .wav song), and buttons to play, pause, stop, fade the sound in (my own added functionality using timers and a gradually increasing volume), and fade the sound out. I also have a trackbar control to handle the volume. I created a wrapper class to put all the NAudio stuff in, as well as to add-on extra functionality like fade-in/out and event notifications when a sound starts or is paused.
Okay, all said, that works fine. The program correctly loads, plays, pauses, stops, and fades in and out. The volume trackbar correctly reflects the volume level of the song being played. That much works, but I do have two problems.
First, after I click the "Load" button to load the sound in and then do all the playing I want to (or not), when I exit the program I get the following popup error message ("Assertion failed"): "AcmStreamHeader dispose was not called at AcmStreamHeader.Finalize()". This is one of those "Abort, Retry, Ignore" popups, but after a few seconds it disappears and the project terminates. (Note: The load functionality creates the DirectSoundOut and calls CreateInputStream... taken directly from the NAudio samples on the site. It also sets up event handlers for the defined events, but that probably doesn't matter.)
In the class destructor, I make the following calls:
mainOutputStream.Close();
mainOutputStream.Dispose();
waveOutDevice.Dispose();
But I still get the error. This is the big one, and I'll ask the other question in another thread. Any idea why this is is happening and how I can stop it?
I am running VS 10 on Windows 7 32-bit.