SFXEmitter getPlaybackStatus()
by Rich Adam · in Torque Game Engine · 01/16/2010 (5:04 pm) · 1 replies
I have encountered a crash when attempting to use getPlaybackStatus() to determine whether to start or stop an emitter. I wrap the play() call around a check using getPlaybackStatus() to make sure the sound is not already playing. I do the same when using stop() to prevent stopping a sound that is stopped. I began to get crashes from "index out of range" asserts. Looking deeper, it seems that there are 2 calls at times to start a sound (the getPlaybackStatus() did not return "playing") and similarly 2 calls at times to stop the same sound. The extra stop() call would ultimately trigger the assert.
I fixed it by maintaining my own playing status. Is this a known issue, or am I missing something in the theory of operation? BTW, this is all done in C++, not via script. I have used script based sound control without issue for weeks.
audibly yours,
rda
I fixed it by maintaining my own playing status. Is this a known issue, or am I missing something in the theory of operation? BTW, this is all done in C++, not via script. I have used script based sound control without issue for weeks.
audibly yours,
rda
About the author
Associate Rene Damm
Only seeing this now. Missed this as it went into the TGE forums (yeah, this can be confusing).
Is this still an issue for you? If so, is it happening with the latest beta and if yes, is it happening with all audio providers?
An important thing to watch out for with SFXEmitter::getPlaybackStatus is to call it on the correct object. In in-process server configurations, it can be called on either the server object or the ghost but in true networked setups, it will only return meaningful results when called on the ghost (since the server does not play sounds).