Game Development Community

Hopefully basic sound problem...

by Ohio University Student (#0006) · in Torque Game Engine · 10/03/2008 (3:44 pm) · 6 replies

I am in the process of learning how to play sounds using Torque but have run into an odd problem. I have gotten sounds to work using example code from a book but whenever I try to use a sound file that did not already come with Torque, it does not work. Here is the code I am using right now:


-------------------------------------------------------------------------------------------------------

new AudioDescription(loopSound2d)
{
volume = 1.0;
isLooping = true;
loopCount = -1;
is3D = false;
type = $GuiAudioType;
};


new AudioProfile(testsoundB)
{
filename = "~/data/sound/testing.wav";
description = loopSound2d;
};


new AudioProfile(testsoundBB)
{
filename = "~/data/sound/footfall.wav";
description = loopSound2d;
};


new AudioProfile(testsoundBBB)
{
filename = "~/data/sound/blunders.wav";
description = loopSound2d;
};

-----------------------------------------------------------------------------------



I am testing the sound using the alxPlay(); command from the console. While the first two work fine, testsoundBBB doesn't, even though the only difference I can see is the specific file being played. They are all .wav files and all in the same place for Torque to find them but the last one never plays. Does anyone have an idea what I am doing wrong?

#1
10/03/2008 (5:52 pm)
I know there is an audio tutorial by Desmond Fletcher that might help. Try a search for Holodeck. I'm sorry I can't be of more help. What book are you using?

Tony
PS: Go Bobcats!
#2
10/03/2008 (6:00 pm)
Make sure blunders.wav is mono. Also, make sure your spelling of the name is correct.
blunders.wav and Blunders.wav are 2 different sound files to torque.
Check your console.log in a text editor to see if it is throwing an error there.
#3
10/03/2008 (6:43 pm)
I checked and it is mono, spelled correctly (I renamed it something short and simple so I couldn't mess that up while testing), and the console threw no errors. It simply failed to play anything even with my sound maxed out. The file plays perfectly fine outside of Torque in a media player. I'm using The Game Programmers Guide to Torque at the moment although after hitting the first few chapters I skipped right to sound since that is currently my responsibility on a team project.
#4
10/03/2008 (7:08 pm)
Well, I don't know what to say. Looking at your code, everything looks like it should work. Sorry I'm of no help. One thing you may try tho, just to make sure your function is working is to take one of the default sounds and put it in place of the blunders.wav and try it. If it works, then at least you know without a doubt it's your sound file. If it doesn't work, then something is wrong and I don't know what that could be.
#5
10/05/2008 (8:40 pm)
Try deleting the file with the *.cs.dso extension (NOT the *.cs extension!). This is the compiled script, and sometimes Torque doesn't seem to recompile the script unless this has been done. Also, are you sure that you are passing in the correct spelling to the alxPlay(); function?

Your code looks fine, I don't see any reason it wouldn't work except the reasons mentioned above. I would definitely say replace the blunders.wav with one of the others and see if it works as Mike suggested.
#6
10/05/2008 (8:53 pm)
Try comparing the working audio files properties with your new ones, maybe there's an elusive difference between them.