diff --git a/Output/Languages/French.xml b/Output/Languages/French.xml index 0e877864..2c2f7944 100644 --- a/Output/Languages/French.xml +++ b/Output/Languages/French.xml @@ -85,9 +85,9 @@ Normal Développé - TODO: Own Music and Background Music - TODO: No own Music - TODO: Only own Music + Musique personnelle et Musique de fond + Pas de Musique personnelle + Seulement la Musique personnelle Chargement @@ -163,9 +163,9 @@ Test du Retard Options du Son - TODO: Background Music - TODO: Background Music Volume - TODO: Background Music Source + Musique de fond + Volume de la Musique de fond + Source de la Musique de fond Options du Thème Thème diff --git a/Vocaluxe/Base/CBackgroundMusic.cs b/Vocaluxe/Base/CBackgroundMusic.cs index 77163853..403a64f9 100644 --- a/Vocaluxe/Base/CBackgroundMusic.cs +++ b/Vocaluxe/Base/CBackgroundMusic.cs @@ -16,10 +16,12 @@ namespace Vocaluxe.Base private static string _CurrentMusicFilePath = String.Empty; private static List _AllFileNames = new List(); + private static List _NotPlayedFileNames = new List(); private static List _BGMusicFileNames = new List(); private static bool _OwnMusicAdded; private static bool _BackgroundMusicAdded; + private static bool _Playing; public static void Init() { @@ -30,6 +32,8 @@ namespace Vocaluxe.Base if(CConfig.BackgroundMusicSource != EBackgroundMusicSource.TR_CONFIG_ONLY_OWN_MUSIC) AddBackgroundMusic(); + + _Playing = false; } public static void Play() @@ -42,6 +46,7 @@ namespace Vocaluxe.Base { CSound.Fade(_CurrentMusicStream, CConfig.BackgroundMusicVolume, CSettings.BackgroundMusicFadeTime); CSound.Play(_CurrentMusicStream); + _Playing = true; } else Next(); @@ -54,11 +59,13 @@ namespace Vocaluxe.Base CSound.FadeAndStop(_CurrentMusicStream, 0f, CSettings.BackgroundMusicFadeTime); _CurrentMusicFilePath = String.Empty; + _Playing = false; } public static void Pause() { CSound.FadeAndPause(_CurrentMusicStream, 0f, CSettings.BackgroundMusicFadeTime); + _Playing = false; } public static void Update() @@ -66,8 +73,8 @@ namespace Vocaluxe.Base if (_AllFileNames.Count > 0 && _CurrentMusicStream != -1) { float timeToPlay = CSound.GetLength(_CurrentMusicStream) - CSound.GetPosition(_CurrentMusicStream); - - if (timeToPlay <= CSettings.BackgroundMusicFadeTime) + bool finished = CSound.IsFinished(_CurrentMusicStream); + if (_Playing && (timeToPlay <= CSettings.BackgroundMusicFadeTime || finished)) Next(); } } @@ -78,7 +85,12 @@ namespace Vocaluxe.Base { Stop(); - _CurrentMusicFilePath = _AllFileNames[CGame.Rand.Next(_AllFileNames.Count)]; + if (_NotPlayedFileNames.Count == 0) + _NotPlayedFileNames.AddRange(_AllFileNames); + + _CurrentMusicFilePath = _NotPlayedFileNames[CGame.Rand.Next(_NotPlayedFileNames.Count)]; + _NotPlayedFileNames.Remove(_CurrentMusicFilePath); + _CurrentMusicStream = CSound.Load(_CurrentMusicFilePath); CSound.SetStreamVolume(_CurrentMusicStream, 0f); Play(); @@ -99,6 +111,7 @@ namespace Vocaluxe.Base foreach (CSong song in CSongs.AllSongs) { _AllFileNames.Add(song.GetMP3()); + _NotPlayedFileNames.Add(song.GetMP3()); } } _OwnMusicAdded = true; @@ -107,9 +120,13 @@ namespace Vocaluxe.Base public static void RemoveOwnMusic() { _AllFileNames.Clear(); + _NotPlayedFileNames.Clear(); if (_BackgroundMusicAdded) + { _AllFileNames.AddRange(_BGMusicFileNames); + _NotPlayedFileNames.AddRange(_BGMusicFileNames); + } if (IsPlaying() && !IsBackgroundFile(_CurrentMusicFilePath) || _AllFileNames.Count == 0) Next(); @@ -122,6 +139,7 @@ namespace Vocaluxe.Base if (!_BackgroundMusicAdded) { _AllFileNames.AddRange(_BGMusicFileNames); + _NotPlayedFileNames.AddRange(_BGMusicFileNames); _BackgroundMusicAdded = true; } } diff --git a/Vocaluxe/Base/CConfig.cs b/Vocaluxe/Base/CConfig.cs index 45ec4a5e..6f172561 100644 --- a/Vocaluxe/Base/CConfig.cs +++ b/Vocaluxe/Base/CConfig.cs @@ -87,10 +87,10 @@ namespace Vocaluxe.Base public enum ESongMenu { - TR_CONFIG_LIST, //a simple list - TR_CONFIG_DREIDEL, //as in ultrastar deluxe + //TR_CONFIG_LIST, //a simple list + //TR_CONFIG_DREIDEL, //as in ultrastar deluxe TR_CONFIG_TILE_BOARD, //chessboard like - TR_CONFIG_BOOK //for playlists + //TR_CONFIG_BOOK //for playlists } public enum ESongSorting diff --git a/Vocaluxe/Menu/SongMenu/CSongMenu.cs b/Vocaluxe/Menu/SongMenu/CSongMenu.cs index 3ab202a5..24dd94d1 100644 --- a/Vocaluxe/Menu/SongMenu/CSongMenu.cs +++ b/Vocaluxe/Menu/SongMenu/CSongMenu.cs @@ -166,21 +166,21 @@ namespace Vocaluxe.Menu.SongMenu switch (CConfig.SongMenu) { - case ESongMenu.TR_CONFIG_LIST: - _SongMenu = new CSongMenuList(); - break; + //case ESongMenu.TR_CONFIG_LIST: + // _SongMenu = new CSongMenuList(); + // break; - case ESongMenu.TR_CONFIG_DREIDEL: - _SongMenu = new CSongMenuDreidel(); - break; + //case ESongMenu.TR_CONFIG_DREIDEL: + // _SongMenu = new CSongMenuDreidel(); + // break; case ESongMenu.TR_CONFIG_TILE_BOARD: _SongMenu = new CSongMenuTileBoard(); break; - case ESongMenu.TR_CONFIG_BOOK: - _SongMenu = new CSongMenuBook(); - break; + //case ESongMenu.TR_CONFIG_BOOK: + // _SongMenu = new CSongMenuBook(); + // break; } _Type = CConfig.SongMenu;