Finally got some time to check sga_IsPlaying. Didn't notice any performance problems, running in both singlethreaded and multithreaded environments.
Thanks for checking!
I tested the previous version in both enviroments as well and the game still crashed, so I'm using a single emitter for the music at the moment, and manually keeping track of the last music played (all looping) to determine which song is playing.
I will test if something changed with the old code and the new version as soon as possible.
Anyway, I'm now testing the new version and only now I'm experiencing this issue (I'm pretty sure I didn't change a single comma on my side):
Now, whenever I call
[music is playing now]
sga_Stop(MusicEmitter);
and then
MusicEmitter = sga_TrackPlay(MusicEmitter, ds_map_find_value(MusicFilenames, argument0), 1, 0);
I get a
40963 OpenAL error. Previous version didn't fire this exception and everything was going (apparently) fine.
The arguments are all valid, and the very same function gets called several times with no problem, exception made for this particular case.
I googled it and found this article (yes, it's not about GameMaker, but I thought it could be handy, since the posters seemed to have fixed the issue. Again, I have no idea of how you wrapped the OpenAL library, so I'm blindly posting the link, don't know if the classes are the same)
http://www.cocos2d-i...orum/topic/2578What is this error about? Thank you for your time!
EDIT:I probably managed to circumvent this issue by changing my "musicStopAll" script to
sga_Stop(MusicEmitter);
MusicEmitter = -1;
The small description of the sga_TrackPlay function states:
//// This script plays a track
// Arguments: emitter ID or -1 for the first time, File name, Looping mode (0/1), Type flags
We actually have to set it to -1 every time the emitter gets stopped or has never been played, right?
Or, is it because I'm using the same emitter to play different tracks? Will the behavior of this function change to take this case in account?
Edited by Hiric, 05 October 2011 - 07:25 PM.