WaveOut object not disposing?

Mar 14, 2010 at 12:42 AM

Hello,

 

I've been having a strange problem using WaveOut / SineWaveProvider32. When I close my app after instantiating a WaveOut object and using it I get an error dialog saying "WaveOut deice was not closed at WaveOut.Finalize()". I get this message despite explicitly calling:

 

waveOut.Stop();

waveOut.Dispose();

waveOut = null;

 

I have confirmed via the debugger that the above three lines are being executed long before I attempt shutdown. I still get the error dialog however.

 

The second issue is probably related somehow:  After instantiating a WaveOut object and initializing it with a SineWaveProvider32 object and playing some sine wave, I execute the above 3 lines to stop playback. I then go about my business with the app and much later I shutdown. I again receive the aforementioned error dialog. However, after a bit of poking around I discovered that the "Read()" method of the SineWaveProvider32 object is being called LONG after I've disposed of "waveOut". What's going on here? Thanks in advance folks.

 

-L

 

Coordinator
Mar 25, 2010 at 4:05 PM

are you sure you didn't create more than one WaveOut object? GC.SuppressFinalize should be called when you call waveOut.Dispose()

Also, what callback mechanism are you using?

Mark

 

Feb 18, 2011 at 8:30 AM

I am having the exact same problem described above (the first one). Those three lines are being executed but I still get the error message after closing the application.

Did you manage to solve it, lkeene?

Gr, Sander

Coordinator
Feb 21, 2011 at 9:38 AM

Sander - check you are not making more than one WaveOut object

Feb 21, 2011 at 9:45 AM

Thanks for your reply. I managed to fix the issue.

Although I was convinced I was not creating a second WaveOut object, I was actually. My bad.

Gr, Sander