I have a quite annoying problem with the XAudio2 object : if I close the application while a sound is playing (an ogg file), the sound sometimes keeps looping and the application crashes 3 secondes after.
What could I do to solve this problem?
Does this happen in the latest testing build, 0.99.3?
Develop games in your browser. Powerful, performant & highly capable.
For now I've only tested the 0.98.9 version. I'm downloding the 0.99.3
EDIT : Looks like it works )
All right then, thanks for fixing this bug
Re-edit : Damn. It just happened again. But it occurs less often than with the 0.98.9.
Does this happen with builds, or with previews? Or both?
Anyway, as a workaround, you could add a shutdown procedure to your game:
+On key "Esc" pressed
-Stop all sounds
-Call function "Close" after 100ms
+On function "Close"
or something like that. It might be overkill, but as a workaround it might do the trick for now.
It happens with both builds and previews.
Your workaround is a good idea, but it won't work if the user decides to close the application by pressing Alt+F4, for instance. Is there any way to prevent the application from being closed using Alt+F4?
Hmm, not sure. I tried the "Cancel close" action using a variety of conditions (including keypresses and "End of Application") but it didn't seem to work. I'm not sure if I'm doing it wrong or what.
Anyway, you might try something like this:
+End of application
>Stop all sounds[/code:3mza8m3i]
and see if that has any effect. Worth a shot, anyway.
I tried the "Cancel close" too but like you, seems like I'm doing it wrong
The "End of Application > Stop all sounds" doesn't work, too bad. I really thought it was working after 6 tries, but the 7th one proved me wrong