Audio Tutorial frustration
by Kevin James · in Torque Game Builder · 04/01/2010 (12:18 pm) · 7 replies
audioDatabocks.cs -
Running this command in the console generates nothing:
alxPlay(blipAudio);
No sound and no error message. I've tried everything from moving the file to the Application Data location to using a dot or tilde or nothing in the path. I get the sound when I click blip.wav directly.
I've spent all day on FileIO and Audio lessons because the tutorials are out of date.
new AudioDescription(AudioNonLooping)
{
volume = 1.0;
isLooping= false;
is3D = false;
type = $GuiAudioType;
};
new AudioDescription(AudioLooping)
{
volume = 1.0;
isLooping= true;
is3D = false;
type = $GuiAudioType;
};
new AudioProfile(backgroundAudio)
{
filename = "~/game/data/audio/BLIP.wav";
description = "AudioLooping";
preload = true;
};
new AudioProfile(blipAudio)
{
filename = "~/game/data/audio/BLIP.wav";
description = "AudioNonLooping";
preload = true;
};Running this command in the console generates nothing:
alxPlay(blipAudio);
No sound and no error message. I've tried everything from moving the file to the Application Data location to using a dot or tilde or nothing in the path. I get the sound when I click blip.wav directly.
Quote:
Torque Game Builder (v1.7.4) initialized...
Loading compiled script C:/Program Files/GarageGames/TorqueGameBuilder-1.7.4/games/TutorialBase/resources/starterArt/resourceDatabase.cs.
% Game Resources : Loaded Resource starterArt
Loading compiled script C:/Program Files/GarageGames/TorqueGameBuilder-1.7.4/games/TutorialBase/game/managed/datablocks.cs.
Loading compiled script C:/Program Files/GarageGames/TorqueGameBuilder-1.7.4/games/TutorialBase/game/managed/persistent.cs.
Loading compiled script C:/Program Files/GarageGames/TorqueGameBuilder-1.7.4/games/TutorialBase/game/managed/brushes.cs.
Loading compiled script C:/Program Files/GarageGames/TorqueGameBuilder-1.7.4/games/TutorialBase/game/gameScripts/datablocks.cs.
Loading compiled script C:/Program Files/GarageGames/TorqueGameBuilder-1.7.4/games/TutorialBase/game/gameScripts/guiProfiles.cs.
Loading compiled script C:/Program Files/GarageGames/TorqueGameBuilder-1.7.4/games/TutorialBase/game/gui/mainScreen.gui.
Loading compiled script C:/Program Files/GarageGames/TorqueGameBuilder-1.7.4/games/TutorialBase/game/gameScripts/game.cs.
Compiling C:/Program Files/GarageGames/TorqueGameBuilder-1.7.4/games/TutorialBase/game/gameScripts/audioDatablocks.cs...
Loading compiled script C:/Program Files/GarageGames/TorqueGameBuilder-1.7.4/games/TutorialBase/game/gameScripts/audioDatablocks.cs.
Activating DirectInput...
DirectInput joystick failed to enable!
Loading compiled script C:/Program Files/GarageGames/TorqueGameBuilder-1.7.4/games/TutorialBase/game/data/levels/fileIO.t2d.
==>alxPlay(blipAudio);
DirectInput deactivated.
Shutting down the OpenGL display device...
Making the GL rendering context not current...
Deleting the GL rendering context...
Releasing the device context...
I've spent all day on FileIO and Audio lessons because the tutorials are out of date.
About the author
Computer security, digital forensics, and platform jumper enthusiast. shells.myw3b.net/~syreal/
#2
04/01/2010 (1:05 pm)
Which version of TGB do you use?
#3
04/01/2010 (1:07 pm)
I've used that on 1.7.4 and the previous version - can't remember which one it was.
#4
filename = "~/data/audio/" @ %name @ ".wav";
My system can't find the file. I get no error. I don't know what to fix or change. I can change it to this:
filename = "fjklasflajsdfljkasflasjflasjdflaskj";
And the result/feedback is exactly the same.
04/01/2010 (5:37 pm)
Your code is nice dynamic logic, but this line is the key:filename = "~/data/audio/" @ %name @ ".wav";
My system can't find the file. I get no error. I don't know what to fix or change. I can change it to this:
filename = "fjklasflajsdfljkasflasjflasjdflaskj";
And the result/feedback is exactly the same.
#5
You need to have a wav file in the data/audio folder of your game project with the same name that you pass to the getAudio function. (I'm pretty sure you can just change wav to ogg if that's the file format you're using.)
So if you want to play blip.wav, you call:
Make sure you are not using numeric only file names:
"1.wav" does not work but "sound1.wav" does work.
$VOLUME should be set to 1 for max volume, 0 for mute.
$SOUND should be set to true for sounds on.
If you can share some of your code, it may be easier to troubleshoot from my end.
04/02/2010 (6:40 am)
First of all, are you sure the code from my other post is being executed?You need to have a wav file in the data/audio folder of your game project with the same name that you pass to the getAudio function. (I'm pretty sure you can just change wav to ogg if that's the file format you're using.)
So if you want to play blip.wav, you call:
playSE("blip", $VOLUME);Make sure you are not using numeric only file names:
"1.wav" does not work but "sound1.wav" does work.
$VOLUME should be set to 1 for max volume, 0 for mute.
$SOUND should be set to true for sounds on.
If you can share some of your code, it may be easier to troubleshoot from my end.
#6
04/02/2010 (6:55 am)
Thanks for your help! Problem solved.
#7
07/20/2010 (8:27 pm)
OK. I have been frustrated with both the FileIO and Audio portions of the tutorial as well. Is there an easy fix to those tutorials, or is this the best approach for the audio part at least. Neither worked for me.
Torque Owner RollerJesus
Dream. Build. Repeat.
EDIT: linked to my comment in the thread.