So I've got a question about object cleanup. I've created some sound playback functionality using SlimDX for a project I'm working on and it's working great; however I've got one hitch.
Right now I'm creating only one, static instance of my XAudio2 device that all my sounds will use to play. This is for the entire application. A while back I was having some problems with this and the advice I got was to only have once device (http://www.gamedev.n...stream-xaudio2/). This worked out well and to manage it, I created a static class called SoundEngine that would control instantiating and disposing of that XAudio2 object with the startup and shut down of my program so that everything would dispose nicely.
Now for the hitch. The product this is integrated with allows scripting and this scripting is allowed access to any DLL. This is intentional and actually fits with the goals I had in mind for this functionality. I want scripts to be able to create and play sounds. However, what I do not want is for the scripts to have access to SoundEngine, as I only want the hosting application to be able to start up and shut down the sound engine (ie, create or dispose of the XAudio2 object).
So I ran through a bunch of ideas and the simplest/easiest I could think of was to just not allow the creation/destruction of the XAudio2 object. Just create it at start up and let it get destroyed with all the other objects when the application is turned off. So I've been experimenting with this and now I'm getting the following output...
Object of type SlimDX.XAudio2.XAudio2 was not disposed. Stack trace of object creation:
Total of 1 objects still alive.[/quote]
... which makes sense. I've purposely not disposed of the XAudio2 device. So after all that rambling and backstory, my question is this: Is this a problem?
I don't intend for my device to ever get destroyed except when the application shuts down, and all my sound objects will properly dispose themselves so, under ideal circumstances, we should never see this message with more than that single object still alive. But I figured it might be a good idea to check and see if anyone had any thoughts on this and if, should any SlimDX developers be watching this forum, whether or not there could be any unintended side effects of this behaviour.
Thanks for reading, and thanks for any insight provided