Game Development Community

Start function from code at end of sound play

by Ronald J Nelson · in Torque Game Engine · 12/01/2007 (3:27 am) · 0 replies

Basically what I need is to be able to start a function at the end of a sound file being played from code.

I have tried a couple things with bad or undesirable results and I am hoping someone can tell me a simple way to do so.

Here is my code:

// Create and play the new audio, making sure the audio handle is set.
mStartEngineSound = alxPlay(mDataBlock->sound[WheeledVehicleData::StartEngineSound], &getRenderTransform());
alxSourceMatrixF(mStartEngineSound, &getRenderTransform());
alxSourcef(mStartEngineSound, AL_GAIN_LINEAR, 0.8f);
alxSourcef(mStartEngineSound, AL_PITCH, 1.0);

setIgnition(true);

What I need it to do is call the setIgnition function once the startEngine sound file is done playing.

Any help would be appreciated.

Thanks in advance.