Game Development Community

Tip: stop all sounds and music before quiting the game

by Amjad Yahya · in Torque 2D Beginner · 08/12/2013 (8:40 am) · 5 replies

I have noticed that when I quit the game using alt+F4 or invoke a quit() function the game quits but I get the attached error

i43.tinypic.com/2ldekjb.jpg
It's an annoying error especially when you can't figure out the reason, but today it hit me, this happens when the game is playing music or sound effect, I really have no idea why this is happening but the solution is simple:

Solution: use alxStopAll() before you destroy sceneWindow in your main.cs.

function Game::destroy( %this )
{
	// destroy scene window
	alxStopAll();
	destroySceneWindow();
}

#1
08/12/2013 (9:34 am)
Thanks for this tip! I'm sure this could have introduced a lot of hours spent debugging if you weren't aware of this!
#2
08/12/2013 (9:42 am)
You're welcome.
#3
08/12/2013 (10:33 am)
I'm sorry - I should have posted that years ago....

T2D still does this?
#4
08/12/2013 (12:53 pm)
Might be worth adding to the C++ engine directly to avoid users having to take that extra step. Thanks for the find Amjad!
#5
08/13/2013 (12:08 am)
You're welcome.