T3d 1.1 Beta 3 - MainMenu Music only Plays in Mission!? - resolved by Rene
by Steve Acaster · in Torque 3D Professional · 09/23/2010 (11:08 pm) · 8 replies
T3D 1.1 beta 3
Win7
Target:
Audio -> main menu
Issue:
Setting music to play in the main menu ... and nothing happens ... until you get into a mission ... and then it plays! Slightly too late and at the wrong time there ...
This wasn't an issue in the previous betas.
Repeat:
Add a script to art/gui/mainmenu.gui to get it to play music:
Hear nothing happen until you load a mission - which isn't when you want the sound for the main menu to be playing. echoes fire so the scripts are getting reached.
Do the same in 1.1 beta 2 or earlier and hear the music play as soon as the main menu has loaded.
Suggest:
Make the music/audio play in the main menu like you'd expect, or update some docs with info if this has all changed.
Win7
Target:
Audio -> main menu
Issue:
Setting music to play in the main menu ... and nothing happens ... until you get into a mission ... and then it plays! Slightly too late and at the wrong time there ...
This wasn't an issue in the previous betas.
Repeat:
Add a script to art/gui/mainmenu.gui to get it to play music:
//--- OBJECT WRITE END ---
//mainmenu gui scripts above ---> custom yorks new below!
new SFXProfile(theme1)
{
filename = "art/sound/music/timeogg.ogg";//change this to your music file obviously
description = "AudioMusicLoop2D";
preload = false;
};
function MainMenuGui::onWake(%this)
{
if (isFunction("getWebDeployment") &&
getWebDeployment() &&
isObject(%this-->ExitButton))
%this-->ExitButton.setVisible(false);
//yorks
$maintheme1=sfxCreateSource("theme1");
$maintheme1.play();
echo("Start Main Menu Theme");
}
function MainMenuGui::onSleep(%this)
{
//yorks
$maintheme1.stop(2);
echo("Stop Main Menu Theme");
}Hear nothing happen until you load a mission - which isn't when you want the sound for the main menu to be playing. echoes fire so the scripts are getting reached.
Do the same in 1.1 beta 2 or earlier and hear the music play as soon as the main menu has loaded.
Suggest:
Make the music/audio play in the main menu like you'd expect, or update some docs with info if this has all changed.
About the author
One Bloke ... In His Bedroom ... Making Indie Games ...
#3
09/24/2010 (8:56 am)
Yes, I've got the same problem here. It seems that the sounds starts right after the call to SyncClock in GameCore::onClientEnterGame().
#4
I was still looking for a solution here and let it be this way in B3. Best thing probably is to take the music group out of this and restrict it to just the sound effects group.
To solve the issue for you, simply do
Also, to completely disable the play/stop cycle of the music group, take the AudioChannelMusic.play() and stop() commands out of the mission start and end functions (core/scripts/client/mission.cs).
Sorry for the annoyance.
09/24/2010 (10:23 am)
The secret lies in the sound groups. In B3, the music and effects group is by default stopped and only goes to playing state when a game actually starts. This solves the annoying problem of sounds starting to play while the level is still loading rather than starting to play when the mission actually begins. However, it interferes with music in the main menu GUI as you have found :)I was still looking for a solution here and let it be this way in B3. Best thing probably is to take the music group out of this and restrict it to just the sound effects group.
To solve the issue for you, simply do
AudioChannelMusic.play();
Also, to completely disable the play/stop cycle of the music group, take the AudioChannelMusic.play() and stop() commands out of the mission start and end functions (core/scripts/client/mission.cs).
Sorry for the annoyance.
#5
09/24/2010 (1:15 pm)
Gotcha, Rene.new SFXProfile(theme1)
{
filename = "art/sound/music/timeogg.ogg";
description = "AudioMusicLoop2D";
preload = false;
};
function MainMenuGui::onWake(%this)
{
if (isFunction("getWebDeployment") &&
getWebDeployment() &&
isObject(%this-->ExitButton))
%this-->ExitButton.setVisible(false);
//yorks
$maintheme1=sfxCreateSource("theme1");
AudioChannelMusic.play();// MAKE ROCKET GO NOW!
$maintheme1.play();
echo("Start Main Menu Theme");
}
function MainMenuGui::onSleep(%this)
{
//yorks
$maintheme1.stop(2);
echo("Stop Main Menu Theme");
}And all is again well, in the land of mainmenu music ... :)
#6
09/25/2010 (10:32 am)
Thanks Rene, it did the trick.
#7
Cannot this be solved with
Or is possible, if you want the main menu background music going on even when loading the mission, just call a stop and then a play of of AudioChannelMusic when now it calls a play to it after mission start?
12/30/2010 (9:05 pm)
Rene, Quote:However, it interferes with music in the main menu GUI as you have found :)
I was still looking for a solution here and let it be this way in B3. Best thing probably is to take the music group out of this and restrict it to just the sound effects group.
Cannot this be solved with
function MainMenuGui::onWake(%this)
{
...
AudioChannelMusic.play();
...
}
function MainMenuGui::onSleep(%this)
{
...
AudioChannelMusic.stop();
...
}?Or is possible, if you want the main menu background music going on even when loading the mission, just call a stop and then a play of of AudioChannelMusic when now it calls a play to it after mission start?
#8
mainMenuGui.gui
loadingGui.cs
12/30/2010 (9:38 pm)
I preferred to simply create various SFXSource and assign them to the AudioGui profile.mainMenuGui.gui
function MainMenuGui::onWake(%this)
{
if (!$handleMenuMusic)
$handleMenuMusic = sfxCreateSource(AudioGui, "art/tracks/menu1_ver2");
SFXPlay($handleMenuMusic);
}
function MainMenuGui::onSleep (%this)
{
sfxStop($handleMenuMusic);
}loadingGui.cs
function LoadingGui::onWake(%this)
{
if (!$handleLoadingMusic)
$handleLoadingMusic = sfxCreateSource(AudioGui, "art/tracks/loop2");
SFXPlay($handleLoadingMusic);
}
//------------------------------------------------------------------------------
function LoadingGui::onSleep(%this)
{
....
sfxStop($handleLoadingMusic);
}
Associate Konrad Kiss
Bitgap Games