diff --git a/Output/Themes/Ambient/Screens/PopupScreenPlayerControl.xml b/Output/Themes/Ambient/Screens/PopupScreenPlayerControl.xml index 704e7696..8a21c449 100644 --- a/Output/Themes/Ambient/Screens/PopupScreenPlayerControl.xml +++ b/Output/Themes/Ambient/Screens/PopupScreenPlayerControl.xml @@ -18,16 +18,16 @@ - + - Button + PreviousIcon - Button + PreviousIcon - 145 - 2 + 50 + 0 0,00 - 150 + 50 50 @@ -56,7 +56,148 @@ Normal - TR_SCREENMAIN_BUTTON_SING + + + + + + + + + + + + PlayIcon + + PlayIcon + + 125 + 5 + 0,00 + 40 + 40 + + + ButtonColor + + + ButtonSColor + + + 75 + 2 + + 32 + + 142 + + + ButtonTextColor + + + ButtonTextSColor + + Center + + + + Normal + + + + + + + + + + + + + PauseIcon + + PauseIcon + + 125 + 5 + 0,00 + 40 + 40 + + + ButtonColor + + + ButtonSColor + + + 75 + 2 + + 32 + + 142 + + + ButtonTextColor + + + ButtonTextSColor + + Center + + + + Normal + + + + + + + + + + + + + NextIcon + + NextIcon + + 190 + 0 + 0,00 + 50 + 50 + + + ButtonColor + + + ButtonSColor + + + 190 + 25 + + 32 + + 142 + + + ButtonTextColor + + + ButtonTextSColor + + Center + + + + Normal + + diff --git a/Output/Themes/Ambient/Skin Blue.xml b/Output/Themes/Ambient/Skin Blue.xml index 585aff80..732c2f9d 100644 --- a/Output/Themes/Ambient/Skin Blue.xml +++ b/Output/Themes/Ambient/Skin Blue.xml @@ -216,6 +216,10 @@ DuetIcon.png VideoIcon.png Invisible.png + PreviousIcon.png + NextIcon.png + PlayIcon.png + PauseIcon.png [Blue]BG_Video.mp4 diff --git a/Output/Themes/Ambient/Skin Green.xml b/Output/Themes/Ambient/Skin Green.xml index c1fb83b1..fe1b9b45 100644 --- a/Output/Themes/Ambient/Skin Green.xml +++ b/Output/Themes/Ambient/Skin Green.xml @@ -216,6 +216,10 @@ DuetIcon.png VideoIcon.png Invisible.png + PreviousIcon.png + NextIcon.png + PlayIcon.png + PauseIcon.png [Green]BG_Video.mp4 diff --git a/Output/Themes/Ambient/Skin Red.xml b/Output/Themes/Ambient/Skin Red.xml index bf15aab2..1b74be2e 100644 --- a/Output/Themes/Ambient/Skin Red.xml +++ b/Output/Themes/Ambient/Skin Red.xml @@ -216,6 +216,10 @@ DuetIcon.png VideoIcon.png Invisible.png + PreviousIcon.png + NextIcon.png + PlayIcon.png + PauseIcon.png [Red]BG_Video.mp4 diff --git a/Output/Themes/Ambient/Skin Yellow.xml b/Output/Themes/Ambient/Skin Yellow.xml index a72e0825..1a001daa 100644 --- a/Output/Themes/Ambient/Skin Yellow.xml +++ b/Output/Themes/Ambient/Skin Yellow.xml @@ -216,6 +216,10 @@ DuetIcon.png VideoIcon.png Invisible.png + PreviousIcon.png + NextIcon.png + PlayIcon.png + PauseIcon.png [Yellow]BG_Video.mp4 diff --git a/Vocaluxe/Base/CBackgroundMusic.cs b/Vocaluxe/Base/CBackgroundMusic.cs index 403a64f9..99bf2596 100644 --- a/Vocaluxe/Base/CBackgroundMusic.cs +++ b/Vocaluxe/Base/CBackgroundMusic.cs @@ -13,11 +13,13 @@ namespace Vocaluxe.Base { private static CHelper Helper = new CHelper(); private static int _CurrentMusicStream = -1; + private static int _PreviousMusicIndex = 0; 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 List _PreviousFileNames = new List(); private static bool _OwnMusicAdded; private static bool _BackgroundMusicAdded; @@ -83,13 +85,25 @@ namespace Vocaluxe.Base { if (_AllFileNames.Count > 0) { - Stop(); + if (_PreviousMusicIndex == _PreviousFileNames.Count - 1 || _PreviousFileNames.Count == 0) //We are not currently in the previous list + { + Stop(); + if (_NotPlayedFileNames.Count == 0) + _NotPlayedFileNames.AddRange(_AllFileNames); - if (_NotPlayedFileNames.Count == 0) - _NotPlayedFileNames.AddRange(_AllFileNames); + _CurrentMusicFilePath = _NotPlayedFileNames[CGame.Rand.Next(_NotPlayedFileNames.Count)]; + _NotPlayedFileNames.Remove(_CurrentMusicFilePath); - _CurrentMusicFilePath = _NotPlayedFileNames[CGame.Rand.Next(_NotPlayedFileNames.Count)]; - _NotPlayedFileNames.Remove(_CurrentMusicFilePath); + _PreviousFileNames.Add(_CurrentMusicFilePath); + _PreviousMusicIndex = _PreviousFileNames.Count - 1; + } + else if(_PreviousFileNames.Count > 0) //We are in the previous list + { + Stop(); + _PreviousMusicIndex++; + + _CurrentMusicFilePath = _PreviousFileNames[_PreviousMusicIndex]; + } _CurrentMusicStream = CSound.Load(_CurrentMusicFilePath); CSound.SetStreamVolume(_CurrentMusicStream, 0f); @@ -99,6 +113,25 @@ namespace Vocaluxe.Base Stop(); } + public static void Previous() + { + if (_PreviousFileNames.Count > 0 || _PreviousMusicIndex >= 0) + { + Stop(); + + _PreviousMusicIndex--; + if (_PreviousMusicIndex < 0) + _PreviousMusicIndex = 0; //No previous songs left, so play the first + + _CurrentMusicFilePath = _PreviousFileNames[_PreviousMusicIndex]; + + + _CurrentMusicStream = CSound.Load(_CurrentMusicFilePath); + CSound.SetStreamVolume(_CurrentMusicStream, 0f); + Play(); + } + } + public static void ApplyVolume() { CSound.SetStreamVolume(_CurrentMusicStream, CConfig.BackgroundMusicVolume); diff --git a/Vocaluxe/Menu/CGraphics.cs b/Vocaluxe/Menu/CGraphics.cs index ce018613..0a136b27 100644 --- a/Vocaluxe/Menu/CGraphics.cs +++ b/Vocaluxe/Menu/CGraphics.cs @@ -552,7 +552,10 @@ namespace Vocaluxe.Menu private static bool Update() { - return _Screens[(int)_CurrentScreen].UpdateGame(); + bool popup = true; + if (_CurrentPopupScreen != EPopupScreens.NoPopup) + popup = _PopupScreens[(int)_CurrentPopupScreen].UpdateGame(); + return _Screens[(int)_CurrentScreen].UpdateGame() && popup; } private static void DrawDebugInfos() diff --git a/Vocaluxe/Screens/CPopupScreenPlayerControl.cs b/Vocaluxe/Screens/CPopupScreenPlayerControl.cs index 141d5703..1909d67e 100644 --- a/Vocaluxe/Screens/CPopupScreenPlayerControl.cs +++ b/Vocaluxe/Screens/CPopupScreenPlayerControl.cs @@ -16,7 +16,11 @@ namespace Vocaluxe.Screens const int ScreenVersion = 1; private const string StaticBG = "StaticBG"; + private const string Cover = "Cover"; + private const string ButtonPrevious = "ButtonPrevious"; + private const string ButtonPlay = "ButtonPlay"; + private const string ButtonPause = "ButtonPause"; private const string ButtonNext = "ButtonNext"; public CPopupScreenPlayerControl() @@ -31,15 +35,19 @@ namespace Vocaluxe.Screens _ThemeName = "PopupScreenPlayerControl"; _ScreenVersion = ScreenVersion; - _ThemeStatics = new string[] { StaticBG }; + _ThemeStatics = new string[] { StaticBG, Cover }; List buttons = new List(); + buttons.Add(ButtonPlay); + buttons.Add(ButtonPause); + buttons.Add(ButtonPrevious); buttons.Add(ButtonNext); _ThemeButtons = buttons.ToArray(); } public override bool HandleInput(KeyEvent KeyEvent) { + base.HandleInput(KeyEvent); if (KeyEvent.KeyPressed && !Char.IsControl(KeyEvent.Unicode)) { @@ -57,6 +65,15 @@ namespace Vocaluxe.Screens if (Buttons[htButtons(ButtonNext)].Selected) CBackgroundMusic.Next(); break; + if (Buttons[htButtons(ButtonPrevious)].Selected) + ;//CBackgroundMusic.Previous(); + break; + if (Buttons[htButtons(ButtonPlay)].Selected) + CBackgroundMusic.Play(); + break; + if (Buttons[htButtons(ButtonPause)].Selected) + CBackgroundMusic.Pause(); + break; } } @@ -65,11 +82,17 @@ namespace Vocaluxe.Screens public override bool HandleMouse(MouseEvent MouseEvent) { + base.HandleMouse(MouseEvent); if (MouseEvent.LB && IsMouseOver(MouseEvent)) { if (Buttons[htButtons(ButtonNext)].Selected) CBackgroundMusic.Next(); - + if (Buttons[htButtons(ButtonPrevious)].Selected) + CBackgroundMusic.Previous(); + if (Buttons[htButtons(ButtonPlay)].Selected) + CBackgroundMusic.Play(); + if (Buttons[htButtons(ButtonPause)].Selected) + CBackgroundMusic.Pause(); } else if (MouseEvent.LB) { CGraphics.HidePopup(EPopupScreens.PopupPlayerControl); @@ -84,7 +107,8 @@ namespace Vocaluxe.Screens public override bool UpdateGame() { - + Buttons[htButtons(ButtonPause)].Visible = CBackgroundMusic.IsPlaying(); + Buttons[htButtons(ButtonPlay)].Visible = !CBackgroundMusic.IsPlaying(); return true; }