Game Development Community

Main Menu Music not looping

by Foestar · in Torque Game Engine Advanced · 12/23/2009 (4:43 am) · 2 replies

Hey, so I'm having some trouble getting my menu music to loop. All I did to play the music was the following.
In my audioProfiles.cs
new SFXProfile(MainMenuMusic)
{
   isLooping=true;
   filename = "~/data/sound/music/MainMenu";
   description = "MusicLooping";
	preload = true;
};
In my gui cs
function UnifiedMainMenuGui::onWake(%this)
{
   if($MMMP==""){
      $MMMP=1;
   }
   if($MMMP==1){
      $musicHandle = sfxPlay(MainMenuMusic);
      $MMMP=2;
   }
}
And within my play gui I simply stop the music and set the variable to 1 so when you return to the menu it will play.
sfxStop($musicHandle);
   $MMMP=1;
So I've tried and tried making audiodescriptions for the file with
isLooping= true;
But it doesn't seem to work. Any ideas?

#1
12/23/2009 (3:52 pm)

The isLooping property must be defined on the SFXDescription and not the SFXProfile (i.e. on "MusicLooping" in your case). Also, the SFXDescription referenced by an SFXProfile must be available when the SFXProfile is created--if it is not, the SFXProfile will automatically default to a generic SFXDescription.

Besides this, are there errors in the console.log?
#2
12/23/2009 (9:37 pm)
Wow, now I feel silly. I didn't originally have the isLooping in the SFXProfile, but rather added it later to see if I could get some sort of response. There were no errors in the console.log. Then I realized I very foolishly created the description after my profile. I probably wouldn't have even noticed it had you not mentioned it being available. lol, thanks!