Shared music across all menu GUI
by 000 · in Torque 3D Professional · 09/16/2012 (10:14 pm) · 5 replies
Evening all,
I've checked out other 'main menu music' threads and while I've implemented music for the mainmenugui.gui it stops when going to another GUI screen. I'd like to loop and keep the song across all the menu screens (options.gui, hostgui.gui, etc.) till the player launches the initial mission.
Any pointers to get me on the right track?
I've checked out other 'main menu music' threads and while I've implemented music for the mainmenugui.gui it stops when going to another GUI screen. I'd like to loop and keep the song across all the menu screens (options.gui, hostgui.gui, etc.) till the player launches the initial mission.
Any pointers to get me on the right track?
#2
09/17/2012 (2:05 pm)
Since my post disappeared: depending on how you implemented menu music you are also stopping the playback at some point. Just move the SFXStop() command to when the level starts or begins loading.
#3
Thanks Robert and Mike for the suggestions, I'll have to give them a shot when I get home. I was messing around with removing the SFXStop, but then it ended up playing the song repeatably everytime I accessed the menu (from main to options back to main it'd repeat). I have to look to see where I can find a call to check to see if it's playing and if so then not play. :P
09/17/2012 (2:46 pm)
@Mike: yeah, I originally made this post, then I saw it gone this morning, so I made another one in T3D General. Then I saw you replied (email notification) but when I tried to access the thread it was gone. Then it came back. Now it's gone again.Thanks Robert and Mike for the suggestions, I'll have to give them a shot when I get home. I was messing around with removing the SFXStop, but then it ended up playing the song repeatably everytime I accessed the menu (from main to options back to main it'd repeat). I have to look to see where I can find a call to check to see if it's playing and if so then not play. :P
#4
Alternatively you could move the starting of the menu music outside of the gui and into when the client starts up, then you only have to worry about stopping it when you're ready to start another track such as level music.
09/17/2012 (3:08 pm)
Ah, I see what could cause the repeating problem. If your sounds starts in a gui's onWake() and you switch to another gui and don't stop the sound before returning to the first gui then yeah it will stack and repeat until stopped. You can do a simple little check, something like this to prevent the stacking:// check to see it exists, if not create it
if (!$ActiveMenuMusic)
$ActiveMenuMusic = sfxPlay(ShellMenuMusic);
// Now play it
SFXPlay($ActiveMenuMusic);Alternatively you could move the starting of the menu music outside of the gui and into when the client starts up, then you only have to worry about stopping it when you're ready to start another track such as level music.
#5
In the end what I did was do the music call during the StartUpGUI sequence and removed the stop audio command, the song plays throughout the various GUIs in the menu with no problem. During the loadingGUI I did a stop call on the audio when it sleeps, so the music stops when a map loads and the level music takes over.
09/17/2012 (8:50 pm)
Thanks for the suggestion Mike.In the end what I did was do the music call during the StartUpGUI sequence and removed the stop audio command, the song plays throughout the various GUIs in the menu with no problem. During the loadingGUI I did a stop call on the audio when it sleeps, so the music stops when a map loads and the level music takes over.
Torque Owner Robert Fritzen
Phantom Games Development
You might have some luck starting there.