Add support for gapless looping music.

This commit is contained in:
Matthias Mailänder
2021-08-22 20:59:13 +02:00
committed by abcdefg30
parent 9916e4c4ac
commit 9b1cec7712
6 changed files with 43 additions and 18 deletions

View File

@@ -162,13 +162,15 @@ namespace OpenRA.Mods.Common.Traits
if (!SongExists(currentSong) || (CurrentSongIsBackground && IsBackgroundMusicMuted))
return;
Game.Sound.PlayMusicThen(currentSong, () =>
{
if (!CurrentSongIsBackground && !Game.Settings.Sound.Repeat)
currentSong = GetNextSong();
Game.Sound.PlayMusicThen(currentSong, PlayNextSong);
}
Play();
});
void PlayNextSong()
{
if (!CurrentSongIsBackground)
currentSong = GetNextSong();
Play();
}
public void Play(MusicInfo music)