Audio manager onSoundComplete
by Alejandro Lopez · in General Discussion · 10/17/2008 (10:00 am) · 4 replies
I am trying to make an audio manager , thats control all the tracks , that are in the game,
when a track finished , another track in the list starts.
but i see there there is no function onSoundComplete or something like this,
just the method "isPlaying".
My question is how to use the setCallback method of Sfx sim objects, is there a callback that send me a value when the sound is completed.?
something like that?
when a track finished , another track in the list starts.
but i see there there is no function onSoundComplete or something like this,
just the method "isPlaying".
My question is how to use the setCallback method of Sfx sim objects, is there a callback that send me a value when the sound is completed.?
something like that?
%this.track.setCallback( %this.callback);
audioManager::callback(this, %callback){
if (%callback = ''end'' )
// next song
}
}
#2
One script method that should work with TGEA 1.7 and above is...
10/18/2008 (11:11 pm)
@Alejandro -One script method that should work with TGEA 1.7 and above is...
function SFXSource::onStatus( %this, %status )
{
if ( %this != %currTrackSource )
return;
if ( %status $= "stopped" )
playNextTrack();
}If you post to the TGEA private forums i can share some source code with you to allow the callback to be set on a per-SFXSource basis.
#4
I'm really interested in the "source code to allow the callback to be set on a per-SFXSource basis" ...
I've posted a new thread in TGEA private forum: Allow a callback to be set on a per-SFXSource basis...
Many thanks for your time ;-)
JoZ
11/06/2008 (4:49 pm)
Hey Tom! :-)I'm really interested in the "source code to allow the callback to be set on a per-SFXSource basis" ...
I've posted a new thread in TGEA private forum: Allow a callback to be set on a per-SFXSource basis...
Many thanks for your time ;-)
JoZ
Associate Anthony Rosenbaum
Another option, if you are using TGE and the ALX system is to use alxGetWaveLen(filename) to get the milliseconds the sound will play then use that value in a schedule to start up the next song
$timePause = 500; function playSong(%profile){ $songTimeInMilliseconds = alxGetWaveLen(%profile.filename); $songId = alxplay(%profile); $clearSongId = schedule( $songTimeInMilliseconds, 0, ClearSong); } function ClearSong(){ alxStop($songId); %profile = getNextSong(); schedule( $timePause, 0, playSong, %profile); }