1
0
forked from 0ad/0ad
0ad/binaries/data/mods/public/gui/session_new/music.js
Ykkrosh e140aa7baf Avoid running the old simulation code in the background when it's not needed.
Optimise GUI updates to only occur when necessary.
Switch to more peaceful music after starting the game.

This was SVN commit r7492.
2010-05-01 16:20:58 +00:00

28 lines
534 B
JavaScript

var g_CurrentMusic = null;
/*
* At some point, this ought to be extended to do dynamic music selection and
* crossfading - it at least needs to pick the music track based on the player's
* civ and peace/battle
*/
function startMusic()
{
var gain = 0.5;
g_CurrentMusic = new Sound("audio/music/germanic_peace_1.ogg");
if (g_CurrentMusic)
{
g_CurrentMusic.loop();
g_CurrentMusic.fade(0.0, gain, 10.0);
}
}
function stopMusic()
{
if (g_CurrentMusic)
{
g_CurrentMusic.fade(-1, 0.0, 5.0);
g_CurrentMusic = null;
}
}