Add support for gapless looping music.
This commit is contained in:
committed by
abcdefg30
parent
9916e4c4ac
commit
9b1cec7712
@@ -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)
|
||||
|
||||
@@ -78,7 +78,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
|
||||
var repeatCheckbox = panel.Get<CheckboxWidget>("REPEAT");
|
||||
repeatCheckbox.IsChecked = () => Game.Settings.Sound.Repeat;
|
||||
repeatCheckbox.OnClick = () => Game.Settings.Sound.Repeat ^= true;
|
||||
repeatCheckbox.OnClick = () => Game.Sound.SetMusicLooped(!Game.Settings.Sound.Repeat);
|
||||
repeatCheckbox.IsDisabled = () => musicPlaylist.CurrentSongIsBackground;
|
||||
|
||||
panel.Get<LabelWidget>("TIME_LABEL").GetText = () =>
|
||||
|
||||
Reference in New Issue
Block a user