Game Development Community

Playing GUI Music ?

by Sikosis · in Torque Game Engine · 01/06/2007 (3:00 pm) · 5 replies

Hi,

I'm trying to get some music to play when the MainMenuGui launches, however, so far, I'm getting nothing.

I've added the following to client\scripts\audioProfiles.cs

new AudioDescription (AgentIntroMusicDesc)
{
   volume = 1.0;
   isLooping = true;
   loopCount = -1;
   is3D = false;
   type = $GuiAudioType;
};

new AudioProfile(AgentIntroMusicProfile)
{
   //filename = "~/data/sound/Agent26IntroMusic.ogg";
   filename = "~/data/sound/dust.ogg";
   description = "AgentIntroMusicDesc";
   preload = true;
};

I tried my own ogg file first, then I tried one of the 1.5 supplied files with no success.

In client\init.cs I added the following to the function loadMainMenu:-

function loadMainMenu()
{
   // Startup the client with the Main menu...
   Canvas.setContent( MainMenuGui );

   alxPlay( AgentIntroMusicProfile );  // play music please

...

I even tried launching alxPlay from ::onWake in MainMenuGui, but that did nothing either.

Any ideas ?

#1
01/06/2007 (3:14 pm)
Here's a good resource for GUI music. You'll also want to add the user fixes that have been posted.


www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=2729
#2
01/06/2007 (3:25 pm)
Hrmmm ... I'm not sure how that resource helps -- it pretty much covers everything that I've tried and when users have commented like

"Caleb (May 26, 2006 at 07:21) -Worked Fine!!!!!! Thanks."

and then

"Eli Peters (Jun 10, 2006 at 12:00) i can't get it to work... :("

seems to me that this is an issue with not just me, but others as well. People seem to be confused on what the volume level is to be as well as what channel to play the audio on. Maybe someone from GG could actually clear this up ???

There are no errors in console.log and the only sound that does happen is from the default WAV file that is being used on the Options menu when you move the Volume slider.
#3
01/06/2007 (3:49 pm)
I used your code, and put alxPlay() in loadMainMenu() after

if($Audio::initFailed) {
      MessageBoxOK("Audio Initialization Failed", 
         "The OpenAL audio system failed to initialize.  " @
         "You can get the most recent OpenAL drivers <a:www.garagegames.com/docs/torque/gstarted/openal.html>here</a>.");
   }

and it worked perfectly. I dont know what your problem is, maybe drivers? sound turned up? your script looks fine.
#4
01/08/2007 (1:07 am)
Yes, it is weird -- I tried after that line as well (well, it really should be after that line anyway, since it's sound related), but no joy here.

I listen to music regularly (iTunes) and play other games on this system BF2142, etc. I'll try and update my drivers, maybe reinstall Torque 1.5 and hope that it works.

edit: grammar
#5
01/08/2007 (1:47 am)
I'm using the VMPlayer resource and it works great for me. It's way easier than setting up the audio description blocks etc manually.

Just my 2 Euro-cent :-)