This project has moved. For the latest updates, please go here.

Error when exiting program

Jun 15, 2011 at 4:33 PM
Edited Jun 15, 2011 at 6:04 PM

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: "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, and downloaded the source code for the latest NAudio.  

UPDATE: I added a "reload" button that essentially re-inits the whole kit-and-kaboodle, and it sometimes causes this same error.  Obviously there's something not getting disposed of correctly, but since I never once directly reference "AcmStreamHeader", it may well be inside the NAudio code somewhere.

Coordinator
Jun 15, 2011 at 7:23 PM

have answered your question on StackOverflow