Game Development Community

Cannot Get Music to play at all - please help

by Rachel P · in Technical Issues · 07/27/2008 (8:25 pm) · 2 replies

Hi guys!

I am new to TGB and only have the demo at the moment (though I plan on buying an idie license very soon). I have tried tons of tutorials to get sounds to play in-game. I've tried pretty much all of them at the Torque Developer Network. Unfortunately, I can never get the sound to play. And also, when I try pressing the ~ key to access the console, nothing happens :/

Can anyone help me out here? Right now I have an audioDatablocks.cs in the game/gameScripts file.
Using a tutorial, I have this for testing purposes:

new AudioDescription(AudioNonLooping)

{

volume = 1.0;

isLooping= false;

is3D = false;

type = $GuiAudioType;

};




new AudioDescription(AudioLooping)

{

volume = 1.0;

isLooping= true;

is3D = false;

type = $GuiAudioType;

};

// --------------------------------------------------------------------

// Background Loop.

// --------------------------------------------------------------------

new AudioProfile(backgroundAudio)

{

filename = "~/data/audio/Ambient06.wav";

description = "AudioLooping";

preload = true;

};




// --------------------------------------------------------------------

// Fire Sound.

// --------------------------------------------------------------------

new AudioProfile(fireAudio)

{

filename = "~/data/audio/Fire17.wav";

description = "AudioNonLooping";

preload = true;

};



I have made sure that I have the appropriate audio files at the appropriate place. I have heard many people talk about a client/scripts/missionDownload.cs file... I can't even find a client/scripts folder in the first place! I have a client folder, filled with a few .cs files though. Is that the same thing?

And where exactly do I put the alxPlay($musicTrack); command?

I am having so much trouble... I have been working on this all day! Any help at all would be greatly appreciated :)

Thanks!
SB

#1
07/27/2008 (10:58 pm)
Try ctrl+~ for the console.

missionDownload.cs does not exist in TGB, since there IS no mission downloading. Its not the same as TGE/TGEA, which has a client/server divide.

You can put alxPlay wherever you want to start playing the music. For example, your playScreen::onwake (or whatever you called your gui which contains the sceneWindow). Or maybe in onLevelLoaded, not sure if thats a sceneGraph or a sceneWindow calback off the top of my head.

Try setting your profile's description to AudioChannel1 instead for kicks...

new AudioProfile(backgroundAudio)

{
   filename = "~/data/audio/Ambient06.wav";
   description = AudioChannel1;
   preload = true;
};

Also you can check the value returned by alxPlay, if it returns -1 then it did not successfully play. If it returns something else (the audio source id) then it did and you can't hear it for another reason (eg. volume problems).
#2
07/28/2008 (11:46 pm)
Thank you for the reply - I will try it out!

Thanks,
Rachel