Game Development Community

Can Torque play .wav files?

by Matt_Lloyd · in Torque Game Engine · 09/28/2004 (6:59 pm) · 6 replies

Hi, I've looked on the forums and in the resources for this, but have been unable to find an answer.

Can Torque play .wav files or only .ogg files? I tried changing a few sounds in the starter.fps kit to .wav files but nothing gets played. I already had to set the "hardware acceleration" to none (as mentioned in a few forum posts) in order to hear the .ogg sounds but I am unable to play a .wav file.

#1
09/28/2004 (7:11 pm)
Yes, it can play multiple wav and ogg files at the same time.

I believe you need to use wavs if you want 3d audio.

You don't need a profile.

I couldn't get it to work from the game editor, but here's an example of what you can use to create 3d audio in a script.

function makeAudio() {

$sfx1 = new AudioEmitter() {
position = "0 0 0";
rotation = "1 0 0 0";
scale = "1 1 1";
useProfileDescription = "0";
fileName = "~/data/sound/your.wav";
type = "2";
volume = "1";
outsideAmbient = "1";
referenceDistance = "35";
maxDistance = "200";
isLooping = "1";
is3D = "1";
loopCount = "-1";
minLoopGap = "1000";
maxLoopGap = "5000";
coneInsideAngle = "360";
coneOutsideAngle = "360";
coneVector = "0 1 0";
minDistance = "120.0";
};



MissionCleanup.add($sfx1);
$sfx1.setTransform("-455.36 -322.159 115 0 0 1 0"); // starting location
echo("Inserting Audio Emitter 1: " @ $sfx1);

}
#2
09/28/2004 (8:09 pm)
But can I just change,for example, the "crossbowreload" sound to a wave file and expect it to play that wave file when the crossbow reload event occurs.
#3
09/28/2004 (8:30 pm)
Yes - in crossbow.cs...


datablock AudioProfile(CrossbowReloadSound)
{
filename = "~/data/sound/your.wav";
description = AudioClose3d;
preload = true;
};
#4
09/28/2004 (9:28 pm)
In that case then something seems to be wrong, as I am unable to hear these wav files play when they should. Are there specific wav formats that have to be used or can any wav file be played in this manner? (Although there was nothing unusual about the wav file I attempted to use from what I could tell).
#5
09/29/2004 (1:00 am)
When a .wav file doesn't play, the most likely reason is that it's in stereo (2 channels). Check the formatting, and if necessary, convert it to Mono format (1 channel).
#6
09/29/2004 (3:23 am)
Sorry, they do work, I must have a problem in my scripts somewhere. Tested a wav file on an unaltered version of starter.fps (I must have changed some things elsewhere).