diff --git a/Output/Themes/Ambient/Screens/PopupScreenPlayerControl.xml b/Output/Themes/Ambient/Screens/PopupScreenPlayerControl.xml
index c24f77ca..4b338b61 100644
--- a/Output/Themes/Ambient/Screens/PopupScreenPlayerControl.xml
+++ b/Output/Themes/Ambient/Screens/PopupScreenPlayerControl.xml
@@ -253,5 +253,143 @@
+
+
+ VideoIcon
+
+ VideoIcon
+
+ 315
+ 0
+ 0,00
+ 50
+ 50
+
+
+ ButtonColor
+
+
+ ButtonSColor
+
+
+ 315
+ 0
+
+ 32
+
+ 142
+
+
+ ButtonTextColor
+
+
+ ButtonTextSColor
+
+ Center
+
+
+
+ Normal
+
+
+
+
+
+
+
+
+
+
+
+
+ DuetIcon
+
+ DuetIcon
+
+ 380
+ 0
+ 0,00
+ 50
+ 50
+
+
+ ButtonColor
+
+
+ ButtonSColor
+
+
+ 380
+ 0
+
+ 32
+
+ 142
+
+
+ ButtonTextColor
+
+
+ ButtonTextSColor
+
+ Center
+
+
+
+ Normal
+
+
+
+
+
+
+
+
+
+
+
+
+ 465
+ 0
+
+ 0,00
+
+ 50
+
+ 825
+
+
+ StaticColor
+
+
+ TextSColor
+
+ Left
+
+
+
+ Normal
+
+
+
+
+
+
+
+
+ CoverBackground
+
+ 0
+ 0
+ 0,00
+ 50
+ 50
+
+
+ Visible
+
+
+
+
\ No newline at end of file
diff --git a/Vocaluxe/Base/CBackgroundMusic.cs b/Vocaluxe/Base/CBackgroundMusic.cs
index 352c9398..ba8866bf 100644
--- a/Vocaluxe/Base/CBackgroundMusic.cs
+++ b/Vocaluxe/Base/CBackgroundMusic.cs
@@ -6,6 +6,8 @@ using System.IO;
using Vocaluxe.Base;
using System.Diagnostics;
using Vocaluxe.Lib.Song;
+using Vocaluxe.Lib.Draw;
+using System.Drawing;
namespace Vocaluxe.Base
{
@@ -14,23 +16,40 @@ 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 PlaylistElement _CurrentPlaylistElement = new PlaylistElement();
+
+ 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;
private static bool _Playing;
+ private static int _Video;
+
public static void Init()
{
- _BGMusicFileNames.AddRange(Helper.ListFiles(CSettings.sFolderBackgroundMusic, "*.mp3", true, true));
- _BGMusicFileNames.AddRange(Helper.ListFiles(CSettings.sFolderBackgroundMusic, "*.wav", true, true));
- _BGMusicFileNames.AddRange(Helper.ListFiles(CSettings.sFolderBackgroundMusic, "*.ogg", true, true));
- _BGMusicFileNames.AddRange(Helper.ListFiles(CSettings.sFolderBackgroundMusic, "*.wma", true, true));
+ foreach(string path in Helper.ListFiles(CSettings.sFolderBackgroundMusic, "*.mp3", true, true))
+ {
+ _BGMusicFileNames.Add(new PlaylistElement(path));
+ }
+
+ foreach(string path in Helper.ListFiles(CSettings.sFolderBackgroundMusic, "*.ogg", true, true))
+ {
+ _BGMusicFileNames.Add(new PlaylistElement(path));
+ }
+
+ foreach(string path in Helper.ListFiles(CSettings.sFolderBackgroundMusic, "*.wma", true, true))
+ {
+ _BGMusicFileNames.Add(new PlaylistElement(path));
+ }
+
+ foreach(string path in Helper.ListFiles(CSettings.sFolderBackgroundMusic, "*.wav", true, true))
+ {
+ _BGMusicFileNames.Add(new PlaylistElement(path));
+ }
if(CConfig.BackgroundMusicSource != EBackgroundMusicSource.TR_CONFIG_ONLY_OWN_MUSIC)
AddBackgroundMusic();
@@ -60,7 +79,7 @@ namespace Vocaluxe.Base
{
CSound.FadeAndStop(_CurrentMusicStream, 0f, CSettings.BackgroundMusicFadeTime);
- _CurrentMusicFilePath = String.Empty;
+ _CurrentPlaylistElement = new PlaylistElement();
_Playing = false;
}
@@ -91,10 +110,10 @@ namespace Vocaluxe.Base
if (_NotPlayedFileNames.Count == 0)
_NotPlayedFileNames.AddRange(_AllFileNames);
- _CurrentMusicFilePath = _NotPlayedFileNames[CGame.Rand.Next(_NotPlayedFileNames.Count)];
- _NotPlayedFileNames.Remove(_CurrentMusicFilePath);
+ _CurrentPlaylistElement = _NotPlayedFileNames[CGame.Rand.Next(_NotPlayedFileNames.Count)];
+ _NotPlayedFileNames.Remove(_CurrentPlaylistElement);
- _PreviousFileNames.Add(_CurrentMusicFilePath);
+ _PreviousFileNames.Add(_CurrentPlaylistElement);
_PreviousMusicIndex = _PreviousFileNames.Count - 1;
}
else if(_PreviousFileNames.Count > 0) //We are in the previous list
@@ -102,10 +121,10 @@ namespace Vocaluxe.Base
Stop();
_PreviousMusicIndex++;
- _CurrentMusicFilePath = _PreviousFileNames[_PreviousMusicIndex];
+ _CurrentPlaylistElement = _PreviousFileNames[_PreviousMusicIndex];
}
- _CurrentMusicStream = CSound.Load(_CurrentMusicFilePath);
+ _CurrentMusicStream = CSound.Load(_CurrentPlaylistElement.GetMusicFilePath());
CSound.SetStreamVolume(_CurrentMusicStream, 0f);
Play();
}
@@ -123,10 +142,9 @@ namespace Vocaluxe.Base
if (_PreviousMusicIndex < 0)
_PreviousMusicIndex = 0; //No previous songs left, so play the first
- _CurrentMusicFilePath = _PreviousFileNames[_PreviousMusicIndex];
-
+ _CurrentPlaylistElement = _PreviousFileNames[_PreviousMusicIndex];
- _CurrentMusicStream = CSound.Load(_CurrentMusicFilePath);
+ _CurrentMusicStream = CSound.Load(_CurrentPlaylistElement.GetMusicFilePath());
CSound.SetStreamVolume(_CurrentMusicStream, 0f);
Play();
}
@@ -151,8 +169,8 @@ namespace Vocaluxe.Base
{
foreach (CSong song in CSongs.AllSongs)
{
- _AllFileNames.Add(song.GetMP3());
- _NotPlayedFileNames.Add(song.GetMP3());
+ _AllFileNames.Add(new PlaylistElement(song));
+ _NotPlayedFileNames.Add(new PlaylistElement(song));
}
}
_OwnMusicAdded = true;
@@ -169,7 +187,7 @@ namespace Vocaluxe.Base
_NotPlayedFileNames.AddRange(_BGMusicFileNames);
}
- if (IsPlaying() && !IsBackgroundFile(_CurrentMusicFilePath) || _AllFileNames.Count == 0)
+ if (IsPlaying() && !IsBackgroundFile(_CurrentPlaylistElement) || _AllFileNames.Count == 0)
Next();
_OwnMusicAdded = false;
@@ -194,7 +212,7 @@ namespace Vocaluxe.Base
AddOwnMusic();
_BackgroundMusicAdded = false;
- if (IsPlaying() && IsBackgroundFile(_CurrentMusicFilePath) || _AllFileNames.Count == 0)
+ if (IsPlaying() && IsBackgroundFile(_CurrentPlaylistElement) || _AllFileNames.Count == 0)
Next();
}
}
@@ -253,14 +271,124 @@ namespace Vocaluxe.Base
return CSound.IsPlaying(_CurrentMusicStream);
}
- private static bool IsBackgroundFile(string FilePath)
+ public static string GetSongArtistAndTitle()
{
- foreach (string file in _BGMusicFileNames)
+ return _CurrentPlaylistElement.GetArtist() +" - " + _CurrentPlaylistElement.GetTitle();
+ }
+
+ public static STexture GetCover()
+ {
+ return _CurrentPlaylistElement.GetCover();
+ }
+
+ public static void ToggleVideo()
+ {
+ _Video = CVideo.VdLoad(_CurrentPlaylistElement.GetVideoFilePath());
+ CVideo.VdSkip(_Video, CSound.GetLength(_CurrentMusicStream) / 4f, _CurrentPlaylistElement.GetVideoGap());
+ }
+
+ public static int GetSongNr()
+ {
+ return _CurrentPlaylistElement.GetSongNr();
+ }
+
+ public static bool IsDuet()
+ {
+ return _CurrentPlaylistElement.IsDuet();
+ }
+
+ private static bool IsBackgroundFile(PlaylistElement element)
+ {
+ foreach (PlaylistElement elements in _BGMusicFileNames)
{
- if (file == FilePath)
+ if (elements.GetMusicFilePath() == element.GetMusicFilePath())
return true;
}
return false;
}
}
}
+
+class PlaylistElement
+{
+ string _Title;
+ string _Artist;
+ string _MusicFilePath;
+ string _VideoFilePath;
+ STexture _Cover;
+ float _VideoGap;
+ int _SongNr;
+ bool _Duet;
+
+ public PlaylistElement(CSong song)
+ {
+ _Title = song.Title;
+ _Artist = song.Artist;
+ _MusicFilePath = song.GetMP3();
+ _VideoFilePath = song.GetVideo();
+ _Cover = song.CoverTextureSmall;
+ _VideoGap = song.VideoGap;
+ _SongNr = song.ID;
+ _Duet = song.IsDuet;
+ }
+
+ public PlaylistElement(string FilePath)
+ {
+ _Title = "Unknown";
+ _Artist = "Unknown";
+ _MusicFilePath = FilePath;
+ _VideoFilePath = string.Empty;
+ _Cover = CCover.NoCover;
+ _SongNr = -1;
+ }
+
+ public PlaylistElement()
+ {
+ _Title = "Unknown";
+ _Artist = "Unknown";
+ _MusicFilePath = string.Empty;
+ _VideoFilePath = string.Empty;
+ _Cover = CCover.NoCover;
+ _SongNr = -1;
+ }
+
+ public string GetMusicFilePath()
+ {
+ return _MusicFilePath;
+ }
+
+ public string GetVideoFilePath()
+ {
+ return _VideoFilePath;
+ }
+
+ public string GetTitle()
+ {
+ return _Title;
+ }
+
+ public string GetArtist()
+ {
+ return _Artist;
+ }
+
+ public STexture GetCover()
+ {
+ return _Cover;
+ }
+
+ public float GetVideoGap()
+ {
+ return _VideoGap;
+ }
+
+ public int GetSongNr()
+ {
+ return _SongNr;
+ }
+
+ public bool IsDuet()
+ {
+ return _Duet;
+ }
+}
diff --git a/Vocaluxe/Lib/Song/CSong.cs b/Vocaluxe/Lib/Song/CSong.cs
index 39c1d35f..bfb8e7b2 100644
--- a/Vocaluxe/Lib/Song/CSong.cs
+++ b/Vocaluxe/Lib/Song/CSong.cs
@@ -118,6 +118,11 @@ namespace Vocaluxe.Lib.Song
return Path.Combine(Folder, MP3FileName);
}
+ public string GetVideo()
+ {
+ return Path.Combine(Folder, VideoFileName);
+ }
+
public bool ReadTXTSong(string FilePath)
{
if (!File.Exists(FilePath))
diff --git a/Vocaluxe/Program.cs b/Vocaluxe/Program.cs
index 6ff04a93..2239d6ff 100644
--- a/Vocaluxe/Program.cs
+++ b/Vocaluxe/Program.cs
@@ -86,13 +86,6 @@ namespace Vocaluxe
Application.DoEvents();
- // Init Background Music
- CLog.StartBenchmark(0, "Init Background Music");
- CBackgroundMusic.Init();
- CLog.StopBenchmark(0, "Init Background Music");
-
- Application.DoEvents();
-
// Init Profiles
CLog.StartBenchmark(0, "Init Profiles");
CProfiles.Init();
@@ -121,6 +114,13 @@ namespace Vocaluxe
Application.DoEvents();
+ // Init Background Music
+ CLog.StartBenchmark(0, "Init Background Music");
+ CBackgroundMusic.Init();
+ CLog.StopBenchmark(0, "Init Background Music");
+
+ Application.DoEvents();
+
// Theme System
CLog.StartBenchmark(0, "Init Theme");
CTheme.InitTheme();
diff --git a/Vocaluxe/Screens/CPopupScreenPlayerControl.cs b/Vocaluxe/Screens/CPopupScreenPlayerControl.cs
index c6fea31b..f1df4730 100644
--- a/Vocaluxe/Screens/CPopupScreenPlayerControl.cs
+++ b/Vocaluxe/Screens/CPopupScreenPlayerControl.cs
@@ -7,6 +7,7 @@ using System.Windows.Forms;
using Vocaluxe.Base;
using Vocaluxe.Lib.Draw;
using Vocaluxe.Menu;
+using Vocaluxe.Lib.Song;
namespace Vocaluxe.Screens
{
@@ -16,13 +17,17 @@ namespace Vocaluxe.Screens
const int ScreenVersion = 1;
private const string StaticBG = "StaticBG";
- private const string Cover = "Cover";
+ private const string StaticCover = "StaticCover";
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";
+ private const string ButtonShowVideo = "ButtonShowVideo";
+ private const string ButtonSing = "ButtonSing";
+
+ private const string TextCurrentSong = "TextCurrentSong";
public CPopupScreenPlayerControl()
{
@@ -36,7 +41,8 @@ namespace Vocaluxe.Screens
_ThemeName = "PopupScreenPlayerControl";
_ScreenVersion = ScreenVersion;
- _ThemeStatics = new string[] { StaticBG, Cover };
+ _ThemeStatics = new string[] { StaticBG, StaticCover };
+ _ThemeTexts = new string[] { TextCurrentSong };
List buttons = new List();
buttons.Add(ButtonPlay);
@@ -44,6 +50,8 @@ namespace Vocaluxe.Screens
buttons.Add(ButtonPrevious);
buttons.Add(ButtonNext);
buttons.Add(ButtonRepeat);
+ buttons.Add(ButtonShowVideo);
+ buttons.Add(ButtonSing);
_ThemeButtons = buttons.ToArray();
}
@@ -81,6 +89,10 @@ namespace Vocaluxe.Screens
CBackgroundMusic.Pause();
if (Buttons[htButtons(ButtonRepeat)].Selected)
CBackgroundMusic.Repeat();
+ if (Buttons[htButtons(ButtonShowVideo)].Selected)
+ CBackgroundMusic.ToggleVideo();
+ if (Buttons[htButtons(ButtonSing)].Selected)
+ StartSong(CBackgroundMusic.GetSongNr(), CBackgroundMusic.IsDuet());
break;
}
}
@@ -103,6 +115,10 @@ namespace Vocaluxe.Screens
CBackgroundMusic.Pause();
if (Buttons[htButtons(ButtonRepeat)].Selected)
CBackgroundMusic.Repeat();
+ if (Buttons[htButtons(ButtonShowVideo)].Selected)
+ CBackgroundMusic.ToggleVideo();
+ if (Buttons[htButtons(ButtonSing)].Selected)
+ StartSong(CBackgroundMusic.GetSongNr(), CBackgroundMusic.IsDuet());
} else if (MouseEvent.LB)
{
CGraphics.HidePopup(EPopupScreens.PopupPlayerControl);
@@ -119,6 +135,8 @@ namespace Vocaluxe.Screens
{
Buttons[htButtons(ButtonPause)].Visible = CBackgroundMusic.IsPlaying();
Buttons[htButtons(ButtonPlay)].Visible = !CBackgroundMusic.IsPlaying();
+ Texts[htTexts(TextCurrentSong)].Text = CBackgroundMusic.GetSongArtistAndTitle();
+ Statics[htStatics(StaticCover)].Texture = CBackgroundMusic.GetCover();
return true;
}
@@ -135,5 +153,22 @@ namespace Vocaluxe.Screens
return base.Draw();
}
+
+ private void StartSong(int SongNr, bool Duet)
+ {
+ if (SongNr >= 0 && CSongs.SongsLoaded)
+ {
+ if (Duet)
+ CGame.SetGameMode(GameModes.EGameMode.Duet);
+ else
+ CGame.SetGameMode(GameModes.EGameMode.Normal);
+
+ CGame.Reset();
+ CGame.ClearSongs();
+ CGame.AddSong(SongNr);
+
+ CGraphics.FadeTo(EScreens.ScreenNames);
+ }
+ }
}
}