Game Development Community

Main Menu music won't stop playing

by Thomas Shaw · in Torque Game Engine · 07/02/2005 (3:06 pm) · 2 replies

The code

function MainMenuGui::onWake(%this)
{
	alxPlay(MainMenuMusic);
}

function MainMenuGui::onSleep(%this)
{
	alxStop(MainMenuMusic);
}


The Audio Datablock (which shouldn't have anything to do with this)

new AudioDescription(AudioMusic)
{
volume   = 2.0;
isLooping = true;
isStreaming = true;
is3D     = false;
type     = $SimAudioType;
};


new AudioProfile(MainMenuMusic)
{
filename = "~/data/sound/music/main_menu.ogg";
description = "AudioMusic";
preload = false;
};


So when I join a game, it keeps playing the song, and cancels the song I have running in-game.

#1
07/02/2005 (3:13 pm)
Test this.
function MainMenuGui::onWake(%this)
{  
     $musichandle =alxPlay(MainMenuMusic);
}

function MainMenuGui::onSleep(%this)
{
     alxStop($musichandle);
}
#2
07/02/2005 (3:23 pm)
Thanks a lot, worked like a charm.