Game Development Community

Menu Music

by Edward Smith · in Torque Game Engine · 04/15/2002 (2:41 am) · 10 replies

I was thinking how can I put music in to the Menu and play until player exits or the mission starts?


Thx!

Edward Smith

#1
04/15/2002 (10:02 am)
I have this in my project. I don't have the code here at school or work, so I'll have to get back to you.
#2
04/15/2002 (10:52 am)
Wav or MP3?
#3
04/15/2002 (6:46 pm)
Well .wav would be easyer I think...but doesn't really matter.


Thx!


Edward Smith
#4
04/15/2002 (6:49 pm)
mp3 won't be something you'll want to use unless you're making a free game. Retail games have fairly hefty costs with mp3 use.

I'm not, so I'll be waiting for Ogg Vorbis (i'm not a sound guy!) and until then I'll use my nice lil' wavs.
#5
04/19/2002 (11:04 pm)
yeah wavs are better I think because there faster also.
#6
04/21/2002 (8:07 pm)
have you got that code?
#7
05/13/2002 (11:16 am)
Bump
#8
05/20/2002 (11:01 am)
bumpity bump bump
#9
05/20/2002 (11:14 am)
I don't see the problem here... I've added the Ogg Vorbis support (see resources) to Torque, and you can play a sound file anytime you want... and this should work with wavs, too... (not sure, haven't tested yet...)
But with Ogg Vorbis, you simply define an AudioProfile, e.g in mainMenuGui.gui, just like this:
new AudioProfile(Mission_Music) {
      fileName = "~/data/sound/music/Track09.ogg";
      description = "AudioMusic";
      preload = "0";
   };
and then, e.g. in init.cs, loadMainMenu() (or whereever you want...), play the sound:
function loadMainMenu()
   {
      // Startup the client with the Main menu...
      Canvas.setContent( MainMenuGui );
      Canvas.setCursor("DefaultCursor");
      alxPLay("Mission_Music");
   }
So, if it doesn't work with wavs (and/or you want to have much smaller file sizes), add the Ogg Vorbis resource and everything should be fine :-)
#10
05/20/2002 (11:31 am)
Playing music in game / menu

That's a resource that should be approved in the next couple of days. Should work with both Ogg Vorbis and .wav files assuming you've added the Ogg Vorbis code linked to from the resource.