HOW TO STOP THE WAV FILE
by karthikeyanK · in Torque Developer Network · 07/14/2009 (5:01 am) · 2 replies
In My project I have to play an audio file(ogg). When the User click the button audio should play and when the user click the same button the audio should off? how to do that?
Here i found code for playing sound.
function Testing()
{
$AudioTestHandleA = alxCreateSource("AudioIntroMusicProfile", expandFilename("data/sound/crowd.wav"));
if (!alxIsPlaying(%handle))
alxPlay(%handle);
else if(alxIsPlaying(%handle))
alxStop(%handle);
}
when i click the button the song is playing.. but when i click the same button the song is not off...
it is still playing...
my project is when i click the button the song should sing and when i click the same button the song should off...
The song is singing ...IT SHOULD OFF...
Here i found code for playing sound.
function Testing()
{
$AudioTestHandleA = alxCreateSource("AudioIntroMusicProfile", expandFilename("data/sound/crowd.wav"));
if (!alxIsPlaying(%handle))
alxPlay(%handle);
else if(alxIsPlaying(%handle))
alxStop(%handle);
}
when i click the button the song is playing.. but when i click the same button the song is not off...
it is still playing...
my project is when i click the button the song should sing and when i click the same button the song should off...
The song is singing ...IT SHOULD OFF...
Associate Scott Burns
GG Alumni
The second thing is you'll want to move the CreateSource line out of the function. Every time you run the function as it is you're overwriting the handle.