Play sound from c++
by ArchieMD User · in Torque 3D Professional · 02/22/2010 (3:23 pm) · 2 replies
I've spent some time on the forums trying to figure out how to play sounds.
I want to put my sound playing code in the engine. I don't want to screw around with datablocks and such as I'm going to have 100s of sound files (speeches for an AI). The sound file to play is going to be determined in engine code already (speech rec + db lookup integration). So...
What is the most dead simple way to play a sound file from engine code? I don't care about 3d. I want something as close to SoundSystem::playSound("this is a sound.wav") as possible.
Thanks in advance.
I want to put my sound playing code in the engine. I don't want to screw around with datablocks and such as I'm going to have 100s of sound files (speeches for an AI). The sound file to play is going to be determined in engine code already (speech rec + db lookup integration). So...
What is the most dead simple way to play a sound file from engine code? I don't care about 3d. I want something as close to SoundSystem::playSound("this is a sound.wav") as possible.
Thanks in advance.
#2
BTW, if you want to have the sound automatically reclaimed when it has played in full, add
02/22/2010 (3:46 pm)
BTW, if you want to have the sound automatically reclaimed when it has played in full, add
SFX->deleteWhenStopped( source );
Associate Rene Damm
//Edit: Corrected my omission of the description; you need an SFXDescription datablock