Game Development Community

Audio profiles

by Gordon Walton · in Torque Game Engine · 02/14/2004 (4:54 am) · 12 replies

I ahve been working with the engine for some time and am trying to use more audio. If I change the AudioStartup profile to point to a file I have called sleep.wav, and delete the audioprofiles.cs.dso file, the engine will not play that sound. If I create a new audio profile and try and use that, the console has audio profile not found. I am using the latest stable release, so what am I doing wrong, or is this a bug?

#1
02/14/2004 (5:48 am)
Does you audioprofiles.cs fail to compile and therefore it can't be found?

Check the console.log and see if it sheds more light on the issue.
#2
02/14/2004 (6:18 am)
I have checked the console log, again, and now I don't see anything at all relating to my audio profiles, no errors at all, they just won't play.
#3
02/14/2004 (9:43 am)
Gordon

Show us how your audioprofiles and the script for the sound
looks like .
And how you want it to play ,is it an emitter ?
#4
02/16/2004 (1:46 am)
Sure,

in audioprofiles.cs I added a new descripton as follows:
new AudioDescription(AudioDefaultLoop)
{
volume = 1.0;
isLooping = true;
is3D = false;
type = $GuiAudioType;
};

at the end of the file i created a new profile:
new AudioProfile(MissionMusic)
{
filename = "~/data/sound/music/sleep.wav";
description = "AudioDefaultLoop";
preload = false;
};

and then finally i changed my mission start sequence as follows

function clientCmdMissionStart(%seq)
{
// The client recieves a mission start right before
// being dropped into the game.
toggleFirstPerson(1);
alxPlay("MissionMusic");

}

adding the alxplay statement

I have put the alxplay into my menu scripts too and it is completely ignored.

is there a better way of putting music into a single mission, i think this way will affect all missions.
#5
02/16/2004 (5:40 am)
Gordon

The audioprofiles.cs is this the client one , othervise
this is not working.
#6
02/18/2004 (6:33 am)
Yes, the audioprofiles.cs is the client one, it does not complain that it will not find the profile, just does not play the sound.
#7
02/18/2004 (5:15 pm)
Gordon

You can do a function the takes the musictrack
from the map and use that to play the music for the specific map.
I dont have this function and i havent looked at it but it think this is an easy one.
what i do now i start my alxplay in the onMissionDownloadComplete.
It works and i have done like you did but differnt paths only.
#8
02/18/2004 (5:39 pm)
Gordon

Try this
in common/missiondownload.cs change all %musictrack
to $musictrack
and in client/missiondownload.cs do the same and add this
at onMissionDownloadComplete()
alxPlay($musicTrack);
now if you set your musictrack = "MissionMusic"; on the map
it should play that track hopefully :)
This is a fast one but test it .
#9
02/18/2004 (6:49 pm)
Gordon

In fps\client\scripts\audioprofiles.cs (if this is your structure) make sure you have something like this:
new AudioProfile(GameMusic)
{
   filename = "~/data/sound/music/bground.ogg";
   description = "AudioMusic";
   preload = false;
};
and in fps\client\init.cs you can add something like this:
function loadMainMenu()
{
   // Startup the client with the Main menu...
   Canvas.setContent( MainMenuGui );
   alxStopAll();
   alxPlay("GameMusic");

   Canvas.setCursor("DefaultCursor");

}
This will start playing background music as soon as it loads your main menu. This is the simple way of doing it but maybe you can get the idea if you play around with it a little.
#10
02/20/2004 (4:32 pm)
If I try Billy's method, i get the line in my console.log unable to locate autio profile ' '

if I try Jackie's method, i get no errors in my console.log and the sound is not played either.

I don't know why this is.
#11
02/20/2004 (5:54 pm)
Gordon

Can you use the demoversion and tell me what you do
so we have same files.
I did this in the demoversion and it works

In demo client audioprofiles.cs do this
new AudioDescription(AudioMusic)
{
   volume   = 1.0;
   isLooping= true;
   is3D     = false;
   type     = $SimAudioType;
};


new AudioProfile(MissionMusic)
{
   filename = "~/data/sound/gui/startup.ogg";
   description = "AudioMusic";
   preload = true;
};

in client missiondownload and common missiondownload change the %musictrack to $musictrack
and add the alxplay($musictrack); like before.
In the fps.mis add this under missioninfo
musictrack = "MissionMusic";

now you should here a looping sound when the map has loaded
#12
02/21/2004 (7:15 am)
Billy, I have made all the changes to the Torque Demo, and I don't get the looping sound in the fps.mis, and no errors either.

I am at a loss