Game Development Community

HOW TO PLAY OGG (AUDIO ) FILE?

by karthikeyanK · in Torque Developer Network · 06/28/2009 (9:36 pm) · 3 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?

#1
07/09/2009 (3:51 am)
You can set proper soundButtonDown and soundButtonOver fields in GUI profile if you are using GuiButtons - that way you will get onMouseEnter and onMouseDown sounds. For starting sound alxPlay (in command function) and alxStop for stopping.

Check this tdn.garagegames.com/wiki/TorqueScript_Console_Functions_1 to learn about audio in Torque.

#2
07/14/2009 (4:46 am)

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 wav file is playing.. but when i click the same button the song is not off..

please spot error in my code...
#3
07/14/2009 (6:14 am)
See the other thread you created.