diff --git a/Output/Themes/Ambient/NextIcon.png b/Output/Themes/Ambient/NextIcon.png new file mode 100644 index 00000000..fb6bf6c4 Binary files /dev/null and b/Output/Themes/Ambient/NextIcon.png differ diff --git a/Output/Themes/Ambient/PauseIcon.png b/Output/Themes/Ambient/PauseIcon.png new file mode 100644 index 00000000..6f9c8870 Binary files /dev/null and b/Output/Themes/Ambient/PauseIcon.png differ diff --git a/Output/Themes/Ambient/PlayIcon.png b/Output/Themes/Ambient/PlayIcon.png new file mode 100644 index 00000000..5f34140b Binary files /dev/null and b/Output/Themes/Ambient/PlayIcon.png differ diff --git a/Output/Themes/Ambient/PreviousIcon.png b/Output/Themes/Ambient/PreviousIcon.png new file mode 100644 index 00000000..9a92bf23 Binary files /dev/null and b/Output/Themes/Ambient/PreviousIcon.png differ diff --git a/Output/Themes/Ambient/RepeatIcon.png b/Output/Themes/Ambient/RepeatIcon.png new file mode 100644 index 00000000..6675a41a Binary files /dev/null and b/Output/Themes/Ambient/RepeatIcon.png differ diff --git a/Output/Themes/Ambient/Resources/NextIcon.psd b/Output/Themes/Ambient/Resources/NextIcon.psd new file mode 100644 index 00000000..a6af8829 Binary files /dev/null and b/Output/Themes/Ambient/Resources/NextIcon.psd differ diff --git a/Output/Themes/Ambient/Resources/PauseIcon.psd b/Output/Themes/Ambient/Resources/PauseIcon.psd new file mode 100644 index 00000000..2046e471 Binary files /dev/null and b/Output/Themes/Ambient/Resources/PauseIcon.psd differ diff --git a/Output/Themes/Ambient/Resources/PlayIcon.psd b/Output/Themes/Ambient/Resources/PlayIcon.psd new file mode 100644 index 00000000..ba63fc5c Binary files /dev/null and b/Output/Themes/Ambient/Resources/PlayIcon.psd differ diff --git a/Output/Themes/Ambient/Resources/PreviousIcon.psd b/Output/Themes/Ambient/Resources/PreviousIcon.psd new file mode 100644 index 00000000..0e5756eb Binary files /dev/null and b/Output/Themes/Ambient/Resources/PreviousIcon.psd differ diff --git a/Output/Themes/Ambient/Resources/RepeatIcon.psd b/Output/Themes/Ambient/Resources/RepeatIcon.psd new file mode 100644 index 00000000..cd1a0637 Binary files /dev/null and b/Output/Themes/Ambient/Resources/RepeatIcon.psd differ diff --git a/Output/Themes/Ambient/Screens/PopupScreenPlayerControl.xml b/Output/Themes/Ambient/Screens/PopupScreenPlayerControl.xml index 704e7696..c24f77ca 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 + + @@ -65,5 +206,52 @@ + + + RepeatIcon + + RepeatIcon + + 265 + 0 + 0,00 + 50 + 50 + + + ButtonColor + + + ButtonSColor + + + 265 + 25 + + 32 + + 142 + + + ButtonTextColor + + + ButtonTextSColor + + Center + + + + Normal + + + + + + + + + + \ No newline at end of file diff --git a/Output/Themes/Ambient/Skin Blue.xml b/Output/Themes/Ambient/Skin Blue.xml index 585aff80..83672c2f 100644 --- a/Output/Themes/Ambient/Skin Blue.xml +++ b/Output/Themes/Ambient/Skin Blue.xml @@ -216,6 +216,11 @@ DuetIcon.png VideoIcon.png Invisible.png + PreviousIcon.png + NextIcon.png + PlayIcon.png + PauseIcon.png + RepeatIcon.png [Blue]BG_Video.mp4 diff --git a/Output/Themes/Ambient/Skin Green.xml b/Output/Themes/Ambient/Skin Green.xml index c1fb83b1..18148787 100644 --- a/Output/Themes/Ambient/Skin Green.xml +++ b/Output/Themes/Ambient/Skin Green.xml @@ -216,6 +216,11 @@ DuetIcon.png VideoIcon.png Invisible.png + PreviousIcon.png + NextIcon.png + PlayIcon.png + PauseIcon.png + RepeatIcon.png [Green]BG_Video.mp4 diff --git a/Output/Themes/Ambient/Skin Red.xml b/Output/Themes/Ambient/Skin Red.xml index bf15aab2..ff54ff23 100644 --- a/Output/Themes/Ambient/Skin Red.xml +++ b/Output/Themes/Ambient/Skin Red.xml @@ -216,6 +216,11 @@ DuetIcon.png VideoIcon.png Invisible.png + PreviousIcon.png + NextIcon.png + PlayIcon.png + PauseIcon.png + RepeatIcon.png [Red]BG_Video.mp4 diff --git a/Output/Themes/Ambient/Skin Yellow.xml b/Output/Themes/Ambient/Skin Yellow.xml index a72e0825..6920b340 100644 --- a/Output/Themes/Ambient/Skin Yellow.xml +++ b/Output/Themes/Ambient/Skin Yellow.xml @@ -216,6 +216,11 @@ DuetIcon.png VideoIcon.png Invisible.png + PreviousIcon.png + NextIcon.png + PlayIcon.png + PauseIcon.png + RepeatIcon.png [Yellow]BG_Video.mp4 diff --git a/Vocaluxe/Base/CBackgroundMusic.cs b/Vocaluxe/Base/CBackgroundMusic.cs index 403a64f9..352c9398 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,33 @@ 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 Repeat() + { + if (_AllFileNames.Count > 0 && _CurrentMusicStream != -1) + { + CSound.SetPosition(_CurrentMusicStream, 0); + } + } + public static void ApplyVolume() { CSound.SetStreamVolume(_CurrentMusicStream, CConfig.BackgroundMusicVolume); diff --git a/Vocaluxe/Menu/CGraphics.cs b/Vocaluxe/Menu/CGraphics.cs index c8a5b2fe..91908275 100644 --- a/Vocaluxe/Menu/CGraphics.cs +++ b/Vocaluxe/Menu/CGraphics.cs @@ -481,7 +481,7 @@ namespace Vocaluxe.Menu { bool handled = false; if (_CurrentPopupScreen != EPopupScreens.NoPopup) - handled = !_PopupScreens[(int)_CurrentPopupScreen].HandleInput(KeyEvent); + handled = _PopupScreens[(int)_CurrentPopupScreen].HandleInput(KeyEvent); if (!handled) Resume &= _Screens[(int)_CurrentScreen].HandleInput(KeyEvent); @@ -511,7 +511,7 @@ namespace Vocaluxe.Menu bool handled = false; if (_CurrentPopupScreen != EPopupScreens.NoPopup) - handled = !_PopupScreens[(int)_CurrentPopupScreen].HandleMouse(MouseEvent); + handled = _PopupScreens[(int)_CurrentPopupScreen].HandleMouse(MouseEvent); if (!handled && !_Fading && (_Cursor.IsActive || MouseEvent.LB || MouseEvent.RB)) Resume &= _Screens[(int)_CurrentScreen].HandleMouse(MouseEvent); @@ -563,6 +563,8 @@ namespace Vocaluxe.Menu private static bool Update() { + if (_CurrentPopupScreen != EPopupScreens.NoPopup) + _PopupScreens[(int)_CurrentPopupScreen].UpdateGame(); return _Screens[(int)_CurrentScreen].UpdateGame(); } diff --git a/Vocaluxe/Screens/CPopupScreenPlayerControl.cs b/Vocaluxe/Screens/CPopupScreenPlayerControl.cs index 5a1eafc1..c6fea31b 100644 --- a/Vocaluxe/Screens/CPopupScreenPlayerControl.cs +++ b/Vocaluxe/Screens/CPopupScreenPlayerControl.cs @@ -16,8 +16,13 @@ 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"; + private const string ButtonRepeat = "ButtonRepeat"; public CPopupScreenPlayerControl() { @@ -31,10 +36,14 @@ 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); + buttons.Add(ButtonRepeat); _ThemeButtons = buttons.ToArray(); } @@ -47,6 +56,7 @@ namespace Vocaluxe.Screens public override bool HandleInput(KeyEvent KeyEvent) { + base.HandleInput(KeyEvent); if (KeyEvent.KeyPressed && !Char.IsControl(KeyEvent.Unicode)) { @@ -63,6 +73,14 @@ namespace Vocaluxe.Screens case Keys.Enter: 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(); + if (Buttons[htButtons(ButtonRepeat)].Selected) + CBackgroundMusic.Repeat(); break; } } @@ -72,11 +90,19 @@ 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(); + if (Buttons[htButtons(ButtonRepeat)].Selected) + CBackgroundMusic.Repeat(); } else if (MouseEvent.LB) { CGraphics.HidePopup(EPopupScreens.PopupPlayerControl); @@ -91,7 +117,8 @@ namespace Vocaluxe.Screens public override bool UpdateGame() { - + Buttons[htButtons(ButtonPause)].Visible = CBackgroundMusic.IsPlaying(); + Buttons[htButtons(ButtonPlay)].Visible = !CBackgroundMusic.IsPlaying(); return true; }