Game Development Community

How to determine the end of the audio playing

by Steven Chiu · in Torque Game Engine Advanced · 02/24/2009 (12:15 pm) · 1 replies

I use a shapebase's playaudio function to play audio and want to know when it finish playing. Does anyone know in engine where I can detect the end of a audio playing?

#1
02/24/2009 (4:48 pm)
Not that I know of. You could:

a) get the length of the audio playback and do a schedule() based on the length. Not perfect but sort of a cheap workaround.

b) Extend the system. SFXSource has the code to do script callbacks based on status changes (though for a reason I don't know, the actual setCallback() function has been disabled; easy to bring back, but since it has been disabled, it *may* have caused trouble). So you could go in and just add a script function to hook a callback to the source of the shape's Sound instance.