0
0

Hi,

I receive an AccessViolationException when I shut down my program. The exception is thrown from fmod.cs at
[code:3r8efzl8]
public class Sound
{
public RESULT release ()
{
return FMOD_Sound_Release(soundraw); //<—Here
}
[/code:3r8efzl8]

If I take out the code in Dispose that releases my sound and releases the system, I don’t get an exception. I have the system created the same way it is in the example playsound.cs and my sound is also created that way. Any ideas on why this exception is being thrown when I try to release the system and sound?

[code:3r8efzl8]
private void Form1_Load(object sender, EventArgs e)
{
uint version = 0;
FMOD.RESULT result;

        //Create system object and initialize it.

        result = FMOD.Factory.System_Create(ref system);
        ERRCHECK(result);

        result = system.getVersion(ref version);
        ERRCHECK(result);

        if (version &lt; FMOD.VERSION.number)
        {
            MessageBox.Show(&quot;Wrong Version&quot;);
            Application.Exit();
        }

        result = system.init(32, FMOD.INITFLAG.NORMAL, (IntPtr)null);
        ERRCHECK(result);


        system.createStream(&quot;noise07.wav&quot;,FMOD.MODE.HARDWARE, ref sound1);

}
[/code:3r8efzl8]

[code:3r8efzl8]
protected override void Dispose(bool disposing)
{
if (disposing)
{
FMOD.RESULT result;

            if (sound1 != null)
            {
                result = sound1.release();
                ERRCHECK(result);
            }

            if (system != null)
            {
                result = system.close();
                ERRCHECK(result);
                result = system.release();
                ERRCHECK(result);
            }

[/code:3r8efzl8]

  • You must to post comments
Showing 0 results
Your Answer

Please first to submit.