Having a playlist / music track that is playing from a previous game stop when a save-game is loaded

I sometimes find when loading new games, while the music from a previous game is playing, the music either keeps playing once the new game save is used, or there is a double-music effect of two tracks playing at once.

I haven’t a clue on how to easily prevent this from happening.

Story Init

<<createplaylist "bgm_GameLibraryD">>
	<<track "LDA" volume 0.1>>
	<<track "Cosmic" volume 0.1>>
<</createplaylist>>

In Passage

<<playlist "bgm_GameLibraryD" play>>

Obviously I have lots more music playlists in the game, but those are just an example.

You can use the Config.saves.onLoad method and the SimpleAudio API to stop playing audio before the save loads. For example:

Config.saves.onLoad = function () {
	SimpleAudio.select(":all").stop();
};
1 Like