Background music
by Chuck Waters · in Torque Game Engine · 09/17/2004 (2:46 pm) · 11 replies
Yeah, i was wondering. i have music playing in my menu which works fine, mostly, but if i try to get background music into the actual game, nothing happens. Ive tried setting it up in the clients audio profiles and loading it in the onMissionLoad function right after stage three is completed and I stop my menu music. That didnt work. i also tried to load it into the server side and get it up in the game start function. Nothing appears to be working. i have set it to its own channel and all that. The files in the right place and its been tested. yet, i gots nothing.any one got any clue. all help is appreciated. Thanks
About the author
#2
09/20/2004 (4:57 am)
OK...thatd be super....ive been workin on it and no dice....ima keep at it, but please post those examples if you ever get time....thanks again....
#3
Add a simular code to client/audioprofiles.cs
To start the audio edit client/missiondownload.cs in
09/20/2004 (10:57 am)
I think this is the fastest way todo it ,but there are many other ways.Add a simular code to client/audioprofiles.cs
new AudioDescription(AudioMusic)
{
volume = 1.0;
isLooping= true;
is3D = false;
type = $SimAudioType;
};new AudioProfile(InGameMusic)
{
filename = "path to audio file";
description = "AudioMusic";
preload = true;
};To start the audio edit client/missiondownload.cs in
function onMissionDownloadComplete()
{
// Client will shortly be dropped into the game, so this is
// good place for any last minute gui cleanup.
alxPlay(InGameMusic);
}
#4
09/20/2004 (11:03 am)
Thanks for the reply, but thats exactly what I do. I have even tried doin it in server/audioprofiles and doing it around the startgame function. I get the same error both times. Unable to fine audio profile InGameMusic.....im bout ready to micturate on my laptop. Any idea why it wouldnt know about the profile?
#5
Then change all %musicTrack to $musicTrack then you can start the music in any script .
And to start it call alxPlay($musicTrack);
And this kind of music is only client side audio has nothing todo with the serverside/audio or audioprofiles !
but the above scripts work fine for me , do a double check !
09/20/2004 (11:21 am)
Ok there is another way , its to use the musicTrack settings from the map.Then change all %musicTrack to $musicTrack then you can start the music in any script .
And to start it call alxPlay($musicTrack);
And this kind of music is only client side audio has nothing todo with the serverside/audio or audioprofiles !
but the above scripts work fine for me , do a double check !
#6
09/20/2004 (11:28 am)
Thanks...ill check again, whichll make 4735, but ill do it again...LOL....ill look into that musicTrack thing...thanks
#7
10/31/2004 (12:48 am)
I have this exact same problem. Chuck, did you ever figure it out?
#8
Have you tried this with a clean build? I've got it working with 1.1.2 and 1.2.2 and 1.3.
Edit: Oh and, MAKE SURE it's the correct path and check the console for any errors.
10/31/2004 (1:46 am)
I use the exact procedure Billy posted above, there is something wrong with your build.Have you tried this with a clean build? I've got it working with 1.1.2 and 1.2.2 and 1.3.
Edit: Oh and, MAKE SURE it's the correct path and check the console for any errors.
#9
Then I put the sound in the 'sounds' folder, thus getting rid of possible path problems. After that it worked with a small .wav file (mp3 didn't work, but no error on the console?). Then boldly I threw in a big .mp3, and Torque exited with an error.
So I turned streaming on, and converted the mp3 to ogg with Audacity, and -voila - it worked. So my code looks like Billy's above with a twist:
10/31/2004 (4:17 am)
I tried it, and and first it didn't work for me.Then I put the sound in the 'sounds' folder, thus getting rid of possible path problems. After that it worked with a small .wav file (mp3 didn't work, but no error on the console?). Then boldly I threw in a big .mp3, and Torque exited with an error.
So I turned streaming on, and converted the mp3 to ogg with Audacity, and -voila - it worked. So my code looks like Billy's above with a twist:
new AudioDescription(AudioMusic)
{
volume = 1.0;
isStreaming = true;
isLooping= true;
is3D = false;
type = $SimAudioType;
};
new AudioProfile(InGameMusic)
{
filename = "~/data/sound/test.ogg";
description = "AudioMusic";
preload = false;
};
#10
10/31/2004 (5:13 am)
MP3 is not supported by TGE.
#11
(I thought it did, I don't know where I have that misinformation from. Anyhow, ogg's even better)
10/31/2004 (5:13 am)
That sort of explains it :-).(I thought it did, I don't know where I have that misinformation from. Anyhow, ogg's even better)
Torque 3D Owner Billy L
I give you some examples soon if you havent found a solution .
Dont have time right now !