diff --git a/Output/Languages/Deutsch.xml b/Output/Languages/Deutsch.xml
index be0b28c6..3262bf6f 100644
--- a/Output/Languages/Deutsch.xml
+++ b/Output/Languages/Deutsch.xml
@@ -180,5 +180,6 @@
Video-Hintergründe
Video-Vorschau
Videos während des Singens
+ Videos der Hintergrundmusik
diff --git a/Output/Languages/English.xml b/Output/Languages/English.xml
index 50a87ba8..f0df105b 100644
--- a/Output/Languages/English.xml
+++ b/Output/Languages/English.xml
@@ -180,5 +180,6 @@
Video Backgrounds
Video Preview
Videos while singing
+ Display current backgroundmusic video
diff --git a/Output/Languages/French.xml b/Output/Languages/French.xml
index 2c2f7944..4c2d3ec9 100644
--- a/Output/Languages/French.xml
+++ b/Output/Languages/French.xml
@@ -180,5 +180,6 @@
Vidéo en arrière plan
Prévisualisation des Vidéos
Vidéos pendant que l'on chante
+ TODO: Display current backgroundmusic video
diff --git a/Output/Languages/Spanish.xml b/Output/Languages/Spanish.xml
index d304e24c..cb106774 100644
--- a/Output/Languages/Spanish.xml
+++ b/Output/Languages/Spanish.xml
@@ -180,5 +180,6 @@
Videos de Fondo
Previsualización del Video
Videos al Cantar
+ TODO: Display current backgroundmusic video
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
new file mode 100644
index 00000000..df19d2c3
--- /dev/null
+++ b/Output/Themes/Ambient/Screens/PopupScreenPlayerControl.xml
@@ -0,0 +1,442 @@
+
+
+
+ 1
+
+
+ Menu
+
+ 49
+ 0
+ 0,00
+ 1181
+ 50
+
+
+ Visible
+
+
+
+
+
+
+ CoverBackground
+
+ 50
+ 0
+ 0,00
+ 50
+ 50
+
+
+ Visible
+
+
+
+
+
+
+ PreviousIcon
+
+ PreviousIcon
+
+ 125
+ 0
+ 0,00
+ 50
+ 50
+
+
+ ButtonColor
+
+
+ ButtonSColor
+
+
+ 75
+ 2
+
+ 32
+
+ 142
+
+
+ ButtonTextColor
+
+
+ ButtonTextSColor
+
+ Center
+
+
+
+ Normal
+
+
+
+
+
+
+
+
+
+
+
+
+ PlayIcon
+
+ PlayIcon
+
+ 200
+ 5
+ 0,00
+ 40
+ 40
+
+
+ ButtonColor
+
+
+ ButtonSColor
+
+
+ 75
+ 2
+
+ 32
+
+ 142
+
+
+ ButtonTextColor
+
+
+ ButtonTextSColor
+
+ Center
+
+
+
+ Normal
+
+
+
+
+
+
+
+
+
+
+
+
+ PauseIcon
+
+ PauseIcon
+
+ 200
+ 5
+ 0,00
+ 40
+ 40
+
+
+ ButtonColor
+
+
+ ButtonSColor
+
+
+ 75
+ 2
+
+ 32
+
+ 142
+
+
+ ButtonTextColor
+
+
+ ButtonTextSColor
+
+ Center
+
+
+
+ Normal
+
+
+
+
+
+
+
+
+
+
+
+
+ NextIcon
+
+ NextIcon
+
+ 265
+ 0
+ 0,00
+ 50
+ 50
+
+
+ ButtonColor
+
+
+ ButtonSColor
+
+
+ 190
+ 25
+
+ 32
+
+ 142
+
+
+ ButtonTextColor
+
+
+ ButtonTextSColor
+
+ Center
+
+
+
+ Normal
+
+
+
+
+
+
+
+
+
+
+
+
+ RepeatIcon
+
+ RepeatIcon
+
+ 330
+ 0
+ 0,00
+ 50
+ 50
+
+
+ ButtonColor
+
+
+ ButtonSColor
+
+
+ 405
+ 25
+
+ 32
+
+ 142
+
+
+ ButtonTextColor
+
+
+ ButtonTextSColor
+
+ Center
+
+
+
+ Normal
+
+
+
+
+
+
+
+
+
+
+
+
+ VideoIcon
+
+ VideoIcon
+
+ 405
+ 0
+ 0,00
+ 50
+ 50
+
+
+ ButtonColor
+
+
+ ButtonSColor
+
+
+ 315
+ 0
+
+ 32
+
+ 142
+
+
+ ButtonTextColor
+
+
+ ButtonTextSColor
+
+ Center
+
+
+
+ Normal
+
+
+
+
+
+
+
+
+
+
+
+
+ VideoIcon
+
+ VideoIcon
+
+ 480
+ 0
+ 0,00
+ 50
+ 50
+
+
+ ButtonColor
+
+
+ ButtonSColor
+
+
+ 315
+ 0
+
+ 32
+
+ 142
+
+
+ ButtonTextColor
+
+
+ ButtonTextSColor
+
+ Center
+
+
+
+ Normal
+
+
+
+
+
+
+
+
+
+
+
+
+ DuetIcon
+
+ DuetIcon
+
+ 555
+ 0
+ 0,00
+ 50
+ 50
+
+
+ ButtonColor
+
+
+ ButtonSColor
+
+
+ 380
+ 0
+
+ 32
+
+ 142
+
+
+ ButtonTextColor
+
+
+ ButtonTextSColor
+
+ Center
+
+
+
+ Normal
+
+
+
+
+
+
+
+
+
+
+
+
+ 630
+ 0
+
+ 0,00
+
+ 50
+
+ 650
+
+
+ StaticColor
+
+
+ TextSColor
+
+ Left
+
+
+
+ Outline
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Output/Themes/Ambient/Screens/ScreenOptionsVideo.xml b/Output/Themes/Ambient/Screens/ScreenOptionsVideo.xml
index c74bdfd3..9d8b1bc1 100644
--- a/Output/Themes/Ambient/Screens/ScreenOptionsVideo.xml
+++ b/Output/Themes/Ambient/Screens/ScreenOptionsVideo.xml
@@ -1,7 +1,7 @@
- 1
+ 2
Video
@@ -185,6 +185,33 @@
+
+
+ 75
+ 285
+
+ 0,00
+
+ 32
+
+
+
+ StaticColor
+
+
+ TextSColor
+
+ Left
+
+
+
+ Normal
+
+ TR_SCREENO_VIDEO_VIDEOSTOBACKGROUND
+
+
+
+
Button
@@ -435,5 +462,70 @@
3
+
+
+ Invisible
+
+ SelectSlideArrowLeft
+
+ SelectSlideArrowRight
+
+ SelectSlide
+
+ SelectSlideArrowLeft
+
+ SelectSlideArrowRight
+
+ SelectSlide
+
+ 500
+ 280
+ 0,00
+ 700
+ 50
+
+ 505
+ 225
+ 0,00
+ 40
+ 40
+
+ 1170
+ 225
+ 0,00
+ 40
+ 40
+
+
+ SelectSlideColor
+
+
+ SelectSlideSColor
+
+
+ SelectSlideHColor
+
+
+ ArrowColor
+
+
+ ArrowSColor
+
+
+ TextColor
+
+
+ TextSColor
+
+ 32,00
+
+ 205,33
+
+ Normal
+
+ Bold
+
+ 3
+
\ No newline at end of file
diff --git a/Output/Themes/Ambient/Skin Blue.xml b/Output/Themes/Ambient/Skin Blue.xml
index 62fefa5d..705cef3d 100644
--- a/Output/Themes/Ambient/Skin Blue.xml
+++ b/Output/Themes/Ambient/Skin Blue.xml
@@ -264,6 +264,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 9d6047ae..6a4b7979 100644
--- a/Output/Themes/Ambient/Skin Green.xml
+++ b/Output/Themes/Ambient/Skin Green.xml
@@ -264,6 +264,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 b74a054b..a44f8a41 100644
--- a/Output/Themes/Ambient/Skin Red.xml
+++ b/Output/Themes/Ambient/Skin Red.xml
@@ -264,6 +264,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 5d63b033..b56f2854 100644
--- a/Output/Themes/Ambient/Skin Yellow.xml
+++ b/Output/Themes/Ambient/Skin Yellow.xml
@@ -264,6 +264,11 @@
DuetIcon.png
VideoIcon.png
Invisible.png
+ PreviousIcon.png
+ NextIcon.png
+ PlayIcon.png
+ PauseIcon.png
+ RepeatIcon.png
[Yellow]BG_Video.mp4
diff --git a/Output/Themes/Changelog/Changelog_ScreenOptionsVideo.txt b/Output/Themes/Changelog/Changelog_ScreenOptionsVideo.txt
new file mode 100644
index 00000000..a6898ab5
--- /dev/null
+++ b/Output/Themes/Changelog/Changelog_ScreenOptionsVideo.txt
@@ -0,0 +1,10 @@
+ScreenOptionsTheme
+
+++++++++++
+Version 2:
+
+Add:
+
+and some texts and statics for description (Text5)
+"TR_SCREENO_VIDEO_VIDEOSTOBACKGROUND"
+++++++++++
\ No newline at end of file
diff --git a/Vocaluxe/Base/CBackgroundMusic.cs b/Vocaluxe/Base/CBackgroundMusic.cs
index 403a64f9..da7618bc 100644
--- a/Vocaluxe/Base/CBackgroundMusic.cs
+++ b/Vocaluxe/Base/CBackgroundMusic.cs
@@ -6,6 +6,9 @@ using System.IO;
using Vocaluxe.Base;
using System.Diagnostics;
using Vocaluxe.Lib.Song;
+using Vocaluxe.Lib.Draw;
+using System.Drawing;
+using Vocaluxe.Menu;
namespace Vocaluxe.Base
{
@@ -13,25 +16,126 @@ namespace Vocaluxe.Base
{
private static CHelper Helper = new CHelper();
private static int _CurrentMusicStream = -1;
- 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 int _PreviousMusicIndex = 0;
+ 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 int _Video = -1;
+ private static STexture _CurrentVideoTexture = new STexture(-1);
+ private static Stopwatch _FadeTimer = new Stopwatch();
+ private static bool _VideoEnabled;
private static bool _OwnMusicAdded;
private static bool _BackgroundMusicAdded;
private static bool _Playing;
+ private static bool _Disabled;
+
+ public static bool VideoEnabled
+ {
+ get
+ {
+ return _VideoEnabled;
+ }
+ set
+ {
+ if (_VideoEnabled && value)
+ return;
+ if (!_VideoEnabled && !value)
+ return;
+ if(_VideoEnabled && !value)
+ ToggleVideo();
+ if (!_VideoEnabled && value)
+ ToggleVideo();
+ _VideoEnabled = value;
+ }
+ }
+
+ public static bool Disabled
+ {
+ get
+ {
+ return _Disabled;
+ }
+ set
+ {
+ _Disabled = value;
+ if (_Disabled)
+ Pause();
+ else
+ Play();
+ }
+ }
+
+ public static int SongID
+ {
+ get
+ {
+ return _CurrentPlaylistElement._SongID;
+ }
+ }
+
+ public static bool Duet
+ {
+ get
+ {
+ return _CurrentPlaylistElement.Duet;
+ }
+ }
+
+ public static bool SongHasVideo
+ {
+ get
+ {
+ return File.Exists(_CurrentPlaylistElement.VideoFilePath);
+ }
+ }
+
+ public static bool Playing
+ {
+ get
+ {
+ return CSound.IsPlaying(_CurrentMusicStream);
+ }
+ }
+
+ public static string ArtistAndTitle
+ {
+ get
+ {
+ return _CurrentPlaylistElement.Artist + " - " + _CurrentPlaylistElement.Title;
+ }
+ }
+
+ public static STexture Cover
+ {
+ get
+ {
+ return _CurrentPlaylistElement.Cover;
+ }
+ }
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));
+ List templist = new List();
+
+ foreach(string ending in CSettings.MusicFileTypes)
+ {
+ templist.AddRange(Helper.ListFiles(CSettings.sFolderBackgroundMusic, ending, true, true));
+ }
+
+ foreach (string path in templist)
+ {
+ _BGMusicFileNames.Add(new PlaylistElement(path));
+ }
if(CConfig.BackgroundMusicSource != EBackgroundMusicSource.TR_CONFIG_ONLY_OWN_MUSIC)
AddBackgroundMusic();
+ if (CConfig.VideoBackgrounds == EOffOn.TR_CONFIG_ON)
+ _VideoEnabled = true;
_Playing = false;
}
@@ -46,6 +150,8 @@ namespace Vocaluxe.Base
{
CSound.Fade(_CurrentMusicStream, CConfig.BackgroundMusicVolume, CSettings.BackgroundMusicFadeTime);
CSound.Play(_CurrentMusicStream);
+ if (_VideoEnabled && _Video != -1)
+ CVideo.VdResume(_Video);
_Playing = true;
}
else
@@ -56,14 +162,25 @@ namespace Vocaluxe.Base
public static void Stop()
{
+ if (_VideoEnabled && _Video != -1)
+ {
+ CVideo.VdClose(_Video);
+ CDraw.RemoveTexture(ref _CurrentVideoTexture);
+ _Video = -1;
+ }
CSound.FadeAndStop(_CurrentMusicStream, 0f, CSettings.BackgroundMusicFadeTime);
- _CurrentMusicFilePath = String.Empty;
+ _CurrentPlaylistElement = new PlaylistElement();
_Playing = false;
}
public static void Pause()
{
+ if (_VideoEnabled && _Video != -1)
+ {
+ CVideo.VdPause(_Video);
+ CVideo.VdSkip(_Video, CSound.GetPosition(_CurrentMusicStream) + CSettings.BackgroundMusicFadeTime, _CurrentPlaylistElement.VideoGap);
+ }
CSound.FadeAndPause(_CurrentMusicStream, 0f, CSettings.BackgroundMusicFadeTime);
_Playing = false;
}
@@ -83,15 +200,28 @@ 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);
+ _CurrentPlaylistElement = _NotPlayedFileNames[CGame.Rand.Next(_NotPlayedFileNames.Count)];
+ _NotPlayedFileNames.Remove(_CurrentPlaylistElement);
- _CurrentMusicFilePath = _NotPlayedFileNames[CGame.Rand.Next(_NotPlayedFileNames.Count)];
- _NotPlayedFileNames.Remove(_CurrentMusicFilePath);
+ _PreviousFileNames.Add(_CurrentPlaylistElement);
+ _PreviousMusicIndex = _PreviousFileNames.Count - 1;
+ }
+ else if(_PreviousFileNames.Count > 0) //We are in the previous list
+ {
+ Stop();
+ _PreviousMusicIndex++;
- _CurrentMusicStream = CSound.Load(_CurrentMusicFilePath);
+ _CurrentPlaylistElement = _PreviousFileNames[_PreviousMusicIndex];
+ }
+ _CurrentMusicStream = CSound.Load(_CurrentPlaylistElement.MusicFilePath);
+ if (_VideoEnabled)
+ LoadVideo();
CSound.SetStreamVolume(_CurrentMusicStream, 0f);
Play();
}
@@ -99,6 +229,36 @@ 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
+
+ _CurrentPlaylistElement = _PreviousFileNames[_PreviousMusicIndex];
+
+ _CurrentMusicStream = CSound.Load(_CurrentPlaylistElement.MusicFilePath);
+ if (_VideoEnabled)
+ LoadVideo();
+ CSound.SetStreamVolume(_CurrentMusicStream, 0f);
+ Play();
+ }
+ }
+
+ public static void Repeat()
+ {
+ if (_AllFileNames.Count > 0 && _CurrentMusicStream != -1)
+ {
+ CSound.SetPosition(_CurrentMusicStream, 0);
+ if (_VideoEnabled && _Video != -1)
+ CVideo.VdSkip(_Video, 0f, _CurrentPlaylistElement.VideoGap);
+ }
+ }
+
public static void ApplyVolume()
{
CSound.SetStreamVolume(_CurrentMusicStream, CConfig.BackgroundMusicVolume);
@@ -110,8 +270,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;
@@ -128,7 +288,7 @@ namespace Vocaluxe.Base
_NotPlayedFileNames.AddRange(_BGMusicFileNames);
}
- if (IsPlaying() && !IsBackgroundFile(_CurrentMusicFilePath) || _AllFileNames.Count == 0)
+ if (Playing && !IsBackgroundFile(_CurrentPlaylistElement) || _AllFileNames.Count == 0)
Next();
_OwnMusicAdded = false;
@@ -153,7 +313,7 @@ namespace Vocaluxe.Base
AddOwnMusic();
_BackgroundMusicAdded = false;
- if (IsPlaying() && IsBackgroundFile(_CurrentMusicFilePath) || _AllFileNames.Count == 0)
+ if (Playing && IsBackgroundFile(_CurrentPlaylistElement) || _AllFileNames.Count == 0)
Next();
}
}
@@ -207,19 +367,232 @@ namespace Vocaluxe.Base
CConfig.SaveConfig();
}
- public static bool IsPlaying()
+ public static void ToggleVideo()
{
- return CSound.IsPlaying(_CurrentMusicStream);
+ if (_Video != -1)
+ {
+ if (_VideoEnabled)
+ {
+ _VideoEnabled = false;
+ CVideo.VdClose(_Video);
+ _Video = -1;
+ CDraw.RemoveTexture(ref _CurrentVideoTexture);
+ return;
+ }
+ if (CVideo.VdFinished(_Video))
+ {
+ CVideo.VdClose(_Video);
+ CDraw.RemoveTexture(ref _CurrentVideoTexture);
+ _Video = -1;
+ return;
+ }
+ }
+ else
+ LoadVideo();
}
- private static bool IsBackgroundFile(string FilePath)
+ public static STexture GetVideoTexture()
{
- foreach (string file in _BGMusicFileNames)
+ if (_Video != -1)
{
- if (file == FilePath)
+ float vtime = 0f;
+ CVideo.VdGetFrame(_Video, ref _CurrentVideoTexture, CSound.GetPosition(_CurrentMusicStream), ref vtime);
+ if (_FadeTimer.ElapsedMilliseconds <= 3000L)
+ {
+ _CurrentVideoTexture.color.A = (_FadeTimer.ElapsedMilliseconds / 3000f);
+ }
+ else
+ {
+ _CurrentVideoTexture.color.A = 1f;
+ _FadeTimer.Stop();
+ }
+ return _CurrentVideoTexture;
+ }
+ return new STexture(-1);
+ }
+
+ private static bool IsBackgroundFile(PlaylistElement element)
+ {
+ foreach (PlaylistElement elements in _BGMusicFileNames)
+ {
+ if (elements.MusicFilePath == element.MusicFilePath)
return true;
}
return false;
}
+
+ private static void LoadVideo()
+ {
+ if (_Video == -1)
+ {
+ _Video = CVideo.VdLoad(_CurrentPlaylistElement.VideoFilePath);
+ CVideo.VdSkip(_Video, 0f, _CurrentPlaylistElement.VideoGap);
+ _VideoEnabled = true;
+ _FadeTimer.Reset();
+ _FadeTimer.Start();
+ }
+ }
+ }
+}
+
+class PlaylistElement
+{
+ public int _SongID;
+ private string _MusicFilePath;
+
+ public string MusicFilePath
+ {
+ get
+ {
+ if (_SongID >= 0)
+ {
+ CSong song = CSongs.GetSong(_SongID);
+ if (song != null)
+ return song.GetMP3();
+ else
+ {
+ _SongID = -1;
+ CLog.LogError("Song not found");
+ }
+ }
+ return _MusicFilePath;
+ }
+
+ set
+ {
+ _MusicFilePath = value;
+ }
+ }
+
+ public string VideoFilePath
+ {
+ get
+ {
+ if (_SongID >= 0)
+ {
+ CSong song = CSongs.GetSong(_SongID);
+ if (song != null)
+ return song.GetVideo();
+ else
+ {
+ _SongID = -1;
+ CLog.LogError("Song not found");
+ }
+ }
+ return string.Empty;
+ }
+ }
+
+ public string Title
+ {
+ get
+ {
+ if (_SongID >= 0)
+ {
+ CSong song = CSongs.GetSong(_SongID);
+ if (song != null)
+ return song.Title;
+ else
+ {
+ _SongID = -1;
+ CLog.LogError("Song not found");
+ }
+ }
+ return "Unknown";
+ }
+ }
+
+ public string Artist
+ {
+ get
+ {
+ if (_SongID >= 0)
+ {
+ CSong song = CSongs.GetSong(_SongID);
+ if (song != null)
+ return song.Artist;
+ else
+ {
+ _SongID = -1;
+ CLog.LogError("Song not found");
+ }
+ }
+ return "Unknown";
+ }
+ }
+
+ public STexture Cover
+ {
+ get
+ {
+ if (_SongID >= 0)
+ {
+ CSong song = CSongs.GetSong(_SongID);
+ if (song != null)
+ return song.CoverTextureSmall;
+ else
+ {
+ _SongID = -1;
+ CLog.LogError("Song not found");
+ }
+ }
+ return CCover.NoCover;
+ }
+ }
+
+ public float VideoGap
+ {
+ get
+ {
+ if (_SongID >= 0)
+ {
+ CSong song = CSongs.GetSong(_SongID);
+ if (song != null)
+ return song.VideoGap;
+ else
+ {
+ _SongID = -1;
+ CLog.LogError("Song not found");
+ }
+ }
+ return 0;
+ }
+ }
+
+ public bool Duet
+ {
+ get
+ {
+ if (_SongID >= 0)
+ {
+ CSong song = CSongs.GetSong(_SongID);
+ if (song != null)
+ return song.IsDuet;
+ else
+ {
+ _SongID = -1;
+ CLog.LogError("Song not found");
+ }
+ }
+ return false;
+ }
+ }
+
+ public PlaylistElement(CSong song)
+ {
+ MusicFilePath = string.Empty;
+ _SongID = song.ID;
+ }
+
+ public PlaylistElement(string FilePath)
+ {
+ MusicFilePath = FilePath;
+ _SongID = -1;
+ }
+
+ public PlaylistElement()
+ {
+ MusicFilePath = string.Empty;
+ _SongID = -1;
}
}
diff --git a/Vocaluxe/Base/CConfig.cs b/Vocaluxe/Base/CConfig.cs
index c7ba4df4..6a481fc3 100644
--- a/Vocaluxe/Base/CConfig.cs
+++ b/Vocaluxe/Base/CConfig.cs
@@ -212,6 +212,7 @@ namespace Vocaluxe.Base
public static EOffOn VideoBackgrounds = EOffOn.TR_CONFIG_ON;
public static EOffOn VideoPreview = EOffOn.TR_CONFIG_ON;
public static EOffOn VideosInSongs = EOffOn.TR_CONFIG_ON;
+ public static EOffOn VideosToBackground = EOffOn.TR_CONFIG_OFF;
// Record
public static SMicConfig[] MicConfig;
@@ -377,6 +378,7 @@ namespace Vocaluxe.Base
CHelper.TryGetEnumValueFromXML("//root/Video/VideoBackgrounds", navigator, ref VideoBackgrounds);
CHelper.TryGetEnumValueFromXML("//root/Video/VideoPreview", navigator, ref VideoPreview);
CHelper.TryGetEnumValueFromXML("//root/Video/VideosInSongs", navigator, ref VideosInSongs);
+ CHelper.TryGetEnumValueFromXML("//root/Video/VideosToBackground", navigator, ref VideosToBackground);
#endregion Video
#region Record
@@ -595,6 +597,9 @@ namespace Vocaluxe.Base
writer.WriteComment("Show Videos while singing: " + ListStrings(Enum.GetNames(typeof(EOffOn))));
writer.WriteElementString("VideosInSongs", Enum.GetName(typeof(EOffOn), VideosInSongs));
+ writer.WriteComment("Show backgroundmusic videos as background: " + ListStrings(Enum.GetNames(typeof(EOffOn))));
+ writer.WriteElementString("VideosToBackground", Enum.GetName(typeof(EOffOn), VideosToBackground));
+
writer.WriteEndElement();
#endregion Video
diff --git a/Vocaluxe/Base/CDraw.cs b/Vocaluxe/Base/CDraw.cs
index 0f6d9e60..180ee03b 100644
--- a/Vocaluxe/Base/CDraw.cs
+++ b/Vocaluxe/Base/CDraw.cs
@@ -239,6 +239,19 @@ namespace Vocaluxe.Base
_Draw.DrawTexture(Texture, rect, color, begin, end);
}
+ public static void DrawTexture(CStatic StaticBounds, STexture Texture, EAspect Aspect)
+ {
+ RectangleF bounds = new RectangleF(StaticBounds.Rect.X, StaticBounds.Rect.Y, StaticBounds.Rect.W, StaticBounds.Rect.H);
+ RectangleF rect = new RectangleF(0f, 0f, Texture.width, Texture.height);
+
+ if (rect.Height <= 0f)
+ return;
+
+ CHelper.SetRect(bounds, ref rect, rect.Width / rect.Height, Aspect);
+ DrawTexture(Texture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, StaticBounds.Rect.Z),
+ Texture.color, new SRectF(bounds.X, bounds.Y, bounds.Width, bounds.Height, 0f), false);
+ }
+
public static void DrawTextureReflection(STexture Texture, SRectF rect, SColorF color, SRectF bounds, float space, float height)
{
_Draw.DrawTextureReflection(Texture, rect, color, bounds, space, height);
diff --git a/Vocaluxe/Base/CSettings.cs b/Vocaluxe/Base/CSettings.cs
index 826a019d..75b7e82c 100644
--- a/Vocaluxe/Base/CSettings.cs
+++ b/Vocaluxe/Base/CSettings.cs
@@ -115,6 +115,11 @@ namespace Vocaluxe.Base
public static bool TabNavigation = false;
public const float BackgroundMusicFadeTime = 0.5f;
+
+ public static List MusicFileTypes = new List()
+ {
+ "*.mp3","*.wma","*.ogg","*.wav"
+ };
public static string GetVersionText()
{
diff --git a/Vocaluxe/Lib/Song/CSong.cs b/Vocaluxe/Lib/Song/CSong.cs
index 60fb2049..dce672c1 100644
--- a/Vocaluxe/Lib/Song/CSong.cs
+++ b/Vocaluxe/Lib/Song/CSong.cs
@@ -121,6 +121,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/Menu/CBackground.cs b/Vocaluxe/Menu/CBackground.cs
index c6adfa33..cedc4eb5 100644
--- a/Vocaluxe/Menu/CBackground.cs
+++ b/Vocaluxe/Menu/CBackground.cs
@@ -137,8 +137,16 @@ namespace Vocaluxe.Menu
public bool Draw()
{
bool ok = false;
- if (_Theme.Type == EBackgroundTypes.Video && CConfig.VideoBackgrounds == EOffOn.TR_CONFIG_ON)
+ if (_Theme.Type == EBackgroundTypes.Video && CConfig.VideoBackgrounds == EOffOn.TR_CONFIG_ON && CConfig.VideosToBackground == EOffOn.TR_CONFIG_ON && CBackgroundMusic.Playing && CBackgroundMusic.SongHasVideo && CBackgroundMusic.VideoEnabled && !CBackgroundMusic.Disabled)
+ {
+ Pause();
+ ok = DrawBackgroundMusicVideo();
+ }
+ else if (_Theme.Type == EBackgroundTypes.Video && CConfig.VideoBackgrounds == EOffOn.TR_CONFIG_ON)
+ {
+ Resume();
ok = DrawVideo();
+ }
if (_Theme.TextureName != String.Empty &&
(_Theme.Type == EBackgroundTypes.Texture ||
@@ -206,6 +214,21 @@ namespace Vocaluxe.Menu
}
return false;
}
+
+ private bool DrawBackgroundMusicVideo()
+ {
+ STexture VideoTexture = CBackgroundMusic.GetVideoTexture();
+ if (VideoTexture.height > 0)
+ {
+ RectangleF bounds = new RectangleF(0f, 0f, CSettings.iRenderW, CSettings.iRenderH);
+ RectangleF rect = new RectangleF(0f, 0f, VideoTexture.width, VideoTexture.height);
+ CHelper.SetRect(bounds, ref rect, rect.Width / rect.Height, EAspect.Crop);
+
+ CDraw.DrawTexture(VideoTexture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CSettings.zFar / 4));
+ return true;
+ }
+ return false;
+ }
#endregion internal
#region ThemeEdit
diff --git a/Vocaluxe/Menu/CButton.cs b/Vocaluxe/Menu/CButton.cs
index 0341bf03..d4b5d231 100644
--- a/Vocaluxe/Menu/CButton.cs
+++ b/Vocaluxe/Menu/CButton.cs
@@ -41,6 +41,7 @@ namespace Vocaluxe.Menu
public float SReflectionHeight;
private bool _Selected;
+ public bool Pressed;
public bool Selected
{
get { return _Selected; }
@@ -234,7 +235,8 @@ namespace Vocaluxe.Menu
return;
STexture texture = new STexture(-1);
- if (!Selected)
+
+ if (!Selected && !Pressed)
{
texture = CTheme.GetSkinTexture(_Theme.TextureName);
CDraw.DrawTexture(texture, Rect, Color);
diff --git a/Vocaluxe/Menu/CGraphics.cs b/Vocaluxe/Menu/CGraphics.cs
index cd3148de..27ab24c5 100644
--- a/Vocaluxe/Menu/CGraphics.cs
+++ b/Vocaluxe/Menu/CGraphics.cs
@@ -36,6 +36,13 @@ namespace Vocaluxe.Menu
ScreenNull = -1
}
+ enum EPopupScreens
+ {
+ PopupPlayerControl = 0,
+
+ NoPopup = -1
+ }
+
class CCursor
{
private Stopwatch _CursorFadingTimer;
@@ -185,11 +192,12 @@ namespace Vocaluxe.Menu
private static float _GlobalAlpha;
private static float _ZOffset;
- private static EScreens ActualScreen;
- private static EScreens NextScreen;
+ private static EScreens _CurrentScreen;
+ private static EScreens _NextScreen;
+ private static EPopupScreens _CurrentPopupScreen;
- private static List ScreenList = new List();
- private static CMenu[] Screens;
+ private static List _Screens = new List();
+ private static List _PopupScreens = new List();
public static float GlobalAlpha
{
@@ -206,28 +214,31 @@ namespace Vocaluxe.Menu
{
// Add Screens, must be the same order as in EScreens!
CLog.StartBenchmark(1, "Build Screen List");
- ScreenList.Add(new CScreenTest());
- ScreenList.Add(new CScreenLoad());
- ScreenList.Add(new CScreenMain());
- ScreenList.Add(new CScreenSong());
- ScreenList.Add(new CScreenOptions());
- ScreenList.Add(new CScreenSing());
- ScreenList.Add(new CScreenProfiles());
- ScreenList.Add(new CScreenScore());
- ScreenList.Add(new CScreenHighscore());
- ScreenList.Add(new CScreenOptionsGame());
- ScreenList.Add(new CScreenOptionsSound());
- ScreenList.Add(new CScreenOptionsRecord());
- ScreenList.Add(new CScreenOptionsVideo());
- ScreenList.Add(new CScreenOptionsTheme());
- ScreenList.Add(new CScreenNames());
- ScreenList.Add(new CScreenCredits());
- CLog.StopBenchmark(1, "Build Screen List");
- Screens = ScreenList.ToArray();
+ _Screens.Add(new CScreenTest());
+ _Screens.Add(new CScreenLoad());
+ _Screens.Add(new CScreenMain());
+ _Screens.Add(new CScreenSong());
+ _Screens.Add(new CScreenOptions());
+ _Screens.Add(new CScreenSing());
+ _Screens.Add(new CScreenProfiles());
+ _Screens.Add(new CScreenScore());
+ _Screens.Add(new CScreenHighscore());
+ _Screens.Add(new CScreenOptionsGame());
+ _Screens.Add(new CScreenOptionsSound());
+ _Screens.Add(new CScreenOptionsRecord());
+ _Screens.Add(new CScreenOptionsVideo());
+ _Screens.Add(new CScreenOptionsTheme());
+ _Screens.Add(new CScreenNames());
+ _Screens.Add(new CScreenCredits());
+
+ _PopupScreens.Add(new CPopupScreenPlayerControl());
+
+ CLog.StopBenchmark(1, "Build Screen List");
- ActualScreen = EScreens.ScreenLoad;
- NextScreen = EScreens.ScreenNull;
+ _CurrentScreen = EScreens.ScreenLoad;
+ _NextScreen = EScreens.ScreenNull;
+ _CurrentPopupScreen = EPopupScreens.NoPopup;
_FadingTimer = new Stopwatch();
_GlobalAlpha = 1f;
@@ -247,50 +258,65 @@ namespace Vocaluxe.Menu
CTheme.Cursor.h,
CSettings.zNear);
- for (int i = 0; i < Screens.Length; i++)
+ for (int i = 0; i < _Screens.Count; i++)
{
CLog.StartBenchmark(1, "Load Theme " + Enum.GetNames(typeof(EScreens))[i]);
- Screens[i].LoadTheme();
+ _Screens[i].LoadTheme();
CLog.StopBenchmark(1, "Load Theme " + Enum.GetNames(typeof(EScreens))[i]);
}
+
+ for (int i = 0; i < _PopupScreens.Count; i++)
+ {
+ _PopupScreens[i].LoadTheme();
+ }
}
public static void ReloadTheme()
{
ReloadCursor();
- for (int i = 0; i < Screens.Length; i++)
+ for (int i = 0; i < _Screens.Count; i++)
{
- Screens[i].ReloadTheme();
+ _Screens[i].ReloadTheme();
}
+
+ for (int i = 0; i < _PopupScreens.Count; i++)
+ {
+ _PopupScreens[i].ReloadTheme();
+ }
}
public static void ReloadSkin()
{
ReloadCursor();
- for (int i = 0; i < Screens.Length; i++)
+ for (int i = 0; i < _Screens.Count; i++)
{
- Screens[i].ReloadTextures();
+ _Screens[i].ReloadTextures();
}
+
+ for (int i = 0; i < _PopupScreens.Count; i++)
+ {
+ _PopupScreens[i].ReloadTextures();
+ }
}
public static void SaveTheme()
{
CTheme.SaveTheme();
- for (int i = 0; i < Screens.Length; i++)
+ for (int i = 0; i < _Screens.Count; i++)
{
- Screens[i].SaveTheme();
+ _Screens[i].SaveTheme();
}
+
+ for (int i = 0; i < _PopupScreens.Count; i++)
+ {
+ _PopupScreens[i].SaveTheme();
+ }
}
public static void InitFirstScreen()
{
- Screens[(int)ActualScreen].OnShow();
- Screens[(int)ActualScreen].OnShowFinish();
- }
-
- public static CMenu GetScreen(int Index)
- {
- return Screens[Index];
+ _Screens[(int)_CurrentScreen].OnShow();
+ _Screens[(int)_CurrentScreen].OnShowFinish();
}
public static bool UpdateGameLogic(CKeys Keys, CMouse Mouse)
@@ -304,7 +330,7 @@ namespace Vocaluxe.Menu
CSound.Update();
CBackgroundMusic.Update();
- if (CConfig.CoverLoading == ECoverLoading.TR_CONFIG_COVERLOADING_DYNAMIC && ActualScreen != EScreens.ScreenSing)
+ if (CConfig.CoverLoading == ECoverLoading.TR_CONFIG_COVERLOADING_DYNAMIC && _CurrentScreen != EScreens.ScreenSing)
CSongs.LoadCover(30L, 1);
if (CSettings.GameState != EGameState.EditTheme)
@@ -323,12 +349,13 @@ namespace Vocaluxe.Menu
public static bool Draw()
{
- if ((NextScreen != EScreens.ScreenNull) && !_Fading)
+ if ((_NextScreen != EScreens.ScreenNull) && !_Fading)
{
_Fading = true;
_FadingTimer.Reset();
_FadingTimer.Start();
- Screens[(int)NextScreen].OnShow();
+ _Screens[(int)_NextScreen].OnShow();
+ HidePopup(EPopupScreens.PopupPlayerControl);
}
if (_Fading)
@@ -345,30 +372,37 @@ namespace Vocaluxe.Menu
_GlobalAlpha = 1f;// -factor / 100f;
_ZOffset = CSettings.zFar/2;
- Screens[(int)ActualScreen].Draw();
+ _Screens[(int)_CurrentScreen].Draw();
_GlobalAlpha = factor;
_ZOffset = 0f;
- Screens[(int)NextScreen].Draw();
+ _Screens[(int)_NextScreen].Draw();
_GlobalAlpha = 1f;
}
else
{
- Screens[(int)ActualScreen].OnClose();
- ActualScreen = NextScreen;
- NextScreen = EScreens.ScreenNull;
- Screens[(int)ActualScreen].OnShowFinish();
- Screens[(int)ActualScreen].ProcessMouseMove(_Cursor.X, _Cursor.Y);
- Screens[(int)ActualScreen].Draw();
+ _Screens[(int)_CurrentScreen].OnClose();
+ _CurrentScreen = _NextScreen;
+ _NextScreen = EScreens.ScreenNull;
+ CBackgroundMusic.Play();
+ _Screens[(int)_CurrentScreen].OnShowFinish();
+ _Screens[(int)_CurrentScreen].ProcessMouseMove(_Cursor.X, _Cursor.Y);
+ _Screens[(int)_CurrentScreen].Draw();
_Fading = false;
_FadingTimer.Stop();
}
}
else
{
- Screens[(int)ActualScreen].Draw();
+ _Screens[(int)_CurrentScreen].Draw();
}
+
+ for (int i = 0; i < _PopupScreens.Count; i++)
+ {
+ _PopupScreens[i].Draw();
+ }
+
_Cursor.Draw();
DrawDebugInfos();
@@ -377,7 +411,23 @@ namespace Vocaluxe.Menu
public static void FadeTo(EScreens Screen)
{
- NextScreen = Screen;
+ _NextScreen = Screen;
+ }
+
+ public static void ShowPopup(EPopupScreens PopupScreen)
+ {
+ _PopupScreens[(int)PopupScreen].OnShow();
+ _PopupScreens[(int)PopupScreen].OnShowFinish();
+ _CurrentPopupScreen = PopupScreen;
+ }
+
+ public static void HidePopup(EPopupScreens PopupScreen)
+ {
+ if (_CurrentPopupScreen != PopupScreen)
+ return;
+
+ _PopupScreens[(int)PopupScreen].OnClose();
+ _CurrentPopupScreen = EPopupScreens.NoPopup;
}
public static void HideCursor()
@@ -398,6 +448,9 @@ namespace Vocaluxe.Menu
KeyEvent KeyEvent = new KeyEvent();
MouseEvent MouseEvent = new MouseEvent();
+ bool PopupPlayerControlAllowed = _CurrentScreen != EScreens.ScreenOptionsRecord && _CurrentScreen != EScreens.ScreenSing && _CurrentScreen != EScreens.ScreenNames
+ && _CurrentScreen != EScreens.ScreenSong;
+
bool Resume = true;
while (keys.PollEvent(ref KeyEvent))
{
@@ -406,6 +459,14 @@ namespace Vocaluxe.Menu
CSettings.MouseInacive();
_Cursor.FadeOut();
}
+
+ if (PopupPlayerControlAllowed && KeyEvent.Key == Keys.Tab)
+ {
+ if (_CurrentPopupScreen == EPopupScreens.NoPopup)
+ ShowPopup(EPopupScreens.PopupPlayerControl);
+ else
+ HidePopup(EPopupScreens.PopupPlayerControl);
+ }
if (KeyEvent.ModSHIFT && (KeyEvent.Key == Keys.F1))
{
@@ -422,7 +483,14 @@ namespace Vocaluxe.Menu
else
{
if (!_Fading)
- Resume &= Screens[(int)ActualScreen].HandleInput(KeyEvent);
+ {
+ bool handled = false;
+ if (_CurrentPopupScreen != EPopupScreens.NoPopup)
+ handled = _PopupScreens[(int)_CurrentPopupScreen].HandleInput(KeyEvent);
+
+ if (!handled)
+ Resume &= _Screens[(int)_CurrentScreen].HandleInput(KeyEvent);
+ }
}
}
@@ -436,8 +504,22 @@ namespace Vocaluxe.Menu
UpdateMousePosition(MouseEvent.X, MouseEvent.Y);
- if (!_Fading && (_Cursor.IsActive || MouseEvent.LB || MouseEvent.RB))
- Resume &= Screens[(int)ActualScreen].HandleMouse(MouseEvent);
+ bool isOverPopupPlayerControl = CHelper.IsInBounds(_PopupScreens[(int)EPopupScreens.PopupPlayerControl].ScreenArea, MouseEvent);
+ if (PopupPlayerControlAllowed && isOverPopupPlayerControl)
+ {
+ if (_CurrentPopupScreen == EPopupScreens.NoPopup)
+ ShowPopup(EPopupScreens.PopupPlayerControl);
+ }
+
+ if (!isOverPopupPlayerControl && _CurrentPopupScreen == EPopupScreens.PopupPlayerControl)
+ HidePopup(EPopupScreens.PopupPlayerControl);
+
+ bool handled = false;
+ if (_CurrentPopupScreen != EPopupScreens.NoPopup)
+ handled = _PopupScreens[(int)_CurrentPopupScreen].HandleMouse(MouseEvent);
+
+ if (!handled && !_Fading && (_Cursor.IsActive || MouseEvent.LB || MouseEvent.RB))
+ Resume &= _Screens[(int)_CurrentScreen].HandleMouse(MouseEvent);
}
return Resume;
}
@@ -452,7 +534,7 @@ namespace Vocaluxe.Menu
if (KeyEvent.ModSHIFT && (KeyEvent.Key == Keys.F1))
{
CSettings.GameState = EGameState.Normal;
- Screens[(int)ActualScreen].NextInteraction();
+ _Screens[(int)_CurrentScreen].NextInteraction();
}
else if (KeyEvent.ModALT && (KeyEvent.Key == Keys.Enter))
{
@@ -465,14 +547,14 @@ namespace Vocaluxe.Menu
else
{
if (!_Fading)
- Screens[(int)ActualScreen].HandleInputThemeEditor(KeyEvent);
+ _Screens[(int)_CurrentScreen].HandleInputThemeEditor(KeyEvent);
}
}
while (Mouse.PollEvent(ref MouseEvent))
{
if (!_Fading)
- Screens[(int)ActualScreen].HandleMouseThemeEditor(MouseEvent);
+ _Screens[(int)_CurrentScreen].HandleMouseThemeEditor(MouseEvent);
UpdateMousePosition(MouseEvent.X, MouseEvent.Y);
}
@@ -486,7 +568,9 @@ namespace Vocaluxe.Menu
private static bool Update()
{
- return Screens[(int)ActualScreen].UpdateGame();
+ if (_CurrentPopupScreen != EPopupScreens.NoPopup)
+ _PopupScreens[(int)_CurrentPopupScreen].UpdateGame();
+ return _Screens[(int)_CurrentScreen].UpdateGame();
}
private static void DrawDebugInfos()
diff --git a/Vocaluxe/Menu/CMenu.cs b/Vocaluxe/Menu/CMenu.cs
index 282fb865..0e416da9 100644
--- a/Vocaluxe/Menu/CMenu.cs
+++ b/Vocaluxe/Menu/CMenu.cs
@@ -59,6 +59,13 @@ namespace Vocaluxe.Menu
protected string[] _ThemeSelectSlides;
protected string[] _ThemeSingNotes;
+ protected SRectF _ScreenArea;
+
+ public SRectF ScreenArea
+ {
+ get { return _ScreenArea; }
+ }
+
public int ThemeScreenVersion
{
get { return _ScreenVersion; }
@@ -99,6 +106,7 @@ namespace Vocaluxe.Menu
_MouseDY = 0;
_Active = false;
+ _ScreenArea = new SRectF(0f, 0f, CSettings.iRenderW, CSettings.iRenderH, 0f);
_ThemeName = String.Empty;
_ThemeBackgrounds = null;
@@ -862,13 +870,12 @@ namespace Vocaluxe.Menu
{
ResumeBG();
_Active = true;
- CBackgroundMusic.Play();
}
public virtual void OnClose()
{
PauseBG();
- CBackgroundMusic.Pause();
+ _Active = false;
}
#endregion MenuHandler
diff --git a/Vocaluxe/Screens/CPopupScreenPlayerControl.cs b/Vocaluxe/Screens/CPopupScreenPlayerControl.cs
new file mode 100644
index 00000000..3e383be6
--- /dev/null
+++ b/Vocaluxe/Screens/CPopupScreenPlayerControl.cs
@@ -0,0 +1,227 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Text;
+using System.Windows.Forms;
+
+using Vocaluxe.Base;
+using Vocaluxe.Lib.Draw;
+using Vocaluxe.Menu;
+using Vocaluxe.Lib.Song;
+
+namespace Vocaluxe.Screens
+{
+ class CPopupScreenPlayerControl : CMenu
+ {
+ // Version number for theme files. Increment it, if you've changed something on the theme files!
+ const int ScreenVersion = 1;
+
+ private const string StaticBG = "StaticBG";
+ 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 ButtonToBackgroundVideo = "ButtonToBackgroundVideo";
+
+ private const string TextCurrentSong = "TextCurrentSong";
+ private bool _VideoPreview = false;
+
+ private bool VideoPreview
+ {
+ get
+ {
+ return _VideoPreview;
+ }
+ set
+ {
+ _VideoPreview = value;
+ if (!_VideoPreview && !VideoBackground)
+ CBackgroundMusic.VideoEnabled = false;
+ else
+ CBackgroundMusic.VideoEnabled = true;
+ }
+ }
+ private bool VideoBackground
+ {
+ get
+ {
+ return CConfig.VideosToBackground == EOffOn.TR_CONFIG_ON;
+ }
+ set
+ {
+ if (!value)
+ {
+ if (CConfig.VideosToBackground == EOffOn.TR_CONFIG_ON)
+ {
+ CConfig.VideosToBackground = EOffOn.TR_CONFIG_OFF;
+ if (!_VideoPreview)
+ CBackgroundMusic.VideoEnabled = false;
+ }
+ }
+ else
+ {
+ CConfig.VideosToBackground = EOffOn.TR_CONFIG_ON;
+ CBackgroundMusic.VideoEnabled = true;
+ }
+ CConfig.SaveConfig();
+ }
+ }
+
+ public CPopupScreenPlayerControl()
+ {
+ Init();
+ }
+
+ protected override void Init()
+ {
+ base.Init();
+
+ _ThemeName = "PopupScreenPlayerControl";
+ _ScreenVersion = ScreenVersion;
+
+ _ThemeStatics = new string[] { StaticBG, StaticCover };
+ _ThemeTexts = new string[] { TextCurrentSong };
+
+ List buttons = new List();
+ buttons.Add(ButtonPlay);
+ buttons.Add(ButtonPause);
+ buttons.Add(ButtonPrevious);
+ buttons.Add(ButtonNext);
+ buttons.Add(ButtonRepeat);
+ buttons.Add(ButtonShowVideo);
+ buttons.Add(ButtonSing);
+ buttons.Add(ButtonToBackgroundVideo);
+ _ThemeButtons = buttons.ToArray();
+ }
+
+ public override void LoadTheme()
+ {
+ base.LoadTheme();
+
+ _ScreenArea = Statics[htStatics(StaticBG)].Rect;
+ }
+
+ public override bool HandleInput(KeyEvent KeyEvent)
+ {
+ base.HandleInput(KeyEvent);
+ if (KeyEvent.KeyPressed && !Char.IsControl(KeyEvent.Unicode))
+ {
+
+ }
+ else
+ {
+ switch (KeyEvent.Key)
+ {
+ case Keys.Escape:
+ case Keys.Back:
+ CGraphics.HidePopup(EPopupScreens.PopupPlayerControl);
+ return false;
+
+ 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();
+ if (Buttons[htButtons(ButtonShowVideo)].Selected)
+ VideoPreview = !VideoPreview;
+ if (Buttons[htButtons(ButtonSing)].Selected)
+ StartSong(CBackgroundMusic.SongID, CBackgroundMusic.Duet);
+ if (Buttons[htButtons(ButtonToBackgroundVideo)].Selected)
+ VideoBackground = !VideoBackground;
+ break;
+ }
+ }
+
+ return true;
+ }
+
+ 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();
+ if (Buttons[htButtons(ButtonShowVideo)].Selected)
+ VideoPreview = !VideoPreview;
+ if (Buttons[htButtons(ButtonSing)].Selected)
+ StartSong(CBackgroundMusic.SongID, CBackgroundMusic.Duet);
+ if (Buttons[htButtons(ButtonToBackgroundVideo)].Selected)
+ VideoBackground = !VideoBackground;
+ } else if (MouseEvent.LB)
+ {
+ //CGraphics.HidePopup(EPopupScreens.PopupPlayerControl);
+ return false;
+ } else if (MouseEvent.RB)
+ {
+ //CGraphics.HidePopup(EPopupScreens.PopupPlayerControl);
+ return false;
+ }
+ return true;
+ }
+
+ public override bool UpdateGame()
+ {
+
+ Statics[htStatics(StaticCover)].Visible = !_VideoPreview || !CBackgroundMusic.SongHasVideo;
+ Buttons[htButtons(ButtonToBackgroundVideo)].Pressed = VideoBackground;
+ Buttons[htButtons(ButtonShowVideo)].Pressed = _VideoPreview;
+ return true;
+ }
+
+ public override void OnShow()
+ {
+ base.OnShow();
+ }
+
+ public override bool Draw()
+ {
+ if (!_Active)
+ return false;
+ Statics[htStatics(StaticCover)].Texture = CBackgroundMusic.Cover;
+ if (CBackgroundMusic.VideoEnabled && VideoPreview && CBackgroundMusic.SongHasVideo)
+ CDraw.DrawTexture(Statics[htStatics(StaticCover)], CBackgroundMusic.GetVideoTexture(), EAspect.Crop);
+ Buttons[htButtons(ButtonPause)].Visible = CBackgroundMusic.Playing;
+ Buttons[htButtons(ButtonPlay)].Visible = !CBackgroundMusic.Playing;
+ Texts[htTexts(TextCurrentSong)].Text = CBackgroundMusic.ArtistAndTitle;
+
+ 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);
+ }
+ }
+ }
+}
diff --git a/Vocaluxe/Screens/CScreenLoad.cs b/Vocaluxe/Screens/CScreenLoad.cs
index a38f6810..4c803c5b 100644
--- a/Vocaluxe/Screens/CScreenLoad.cs
+++ b/Vocaluxe/Screens/CScreenLoad.cs
@@ -139,7 +139,7 @@ namespace Vocaluxe.Screens
_SongLoaderThread.Start();
_timer.Start();
- if (!CBackgroundMusic.IsPlaying())
+ if (!CBackgroundMusic.Playing)
CBackgroundMusic.Next();
}
@@ -173,7 +173,7 @@ namespace Vocaluxe.Screens
{
CBackgroundMusic.AddOwnMusic();
- if (!CBackgroundMusic.IsPlaying())
+ if (!CBackgroundMusic.Playing)
CBackgroundMusic.Next();
}
diff --git a/Vocaluxe/Screens/CScreenMain.cs b/Vocaluxe/Screens/CScreenMain.cs
index e558cf24..6f91a42e 100644
--- a/Vocaluxe/Screens/CScreenMain.cs
+++ b/Vocaluxe/Screens/CScreenMain.cs
@@ -65,10 +65,6 @@ namespace Vocaluxe.Screens
CGraphics.FadeTo(EScreens.ScreenSong);
break;
- case Keys.T:
- CGraphics.FadeTo(EScreens.ScreenTest);
- break;
-
case Keys.C:
CGraphics.FadeTo(EScreens.ScreenCredits);
break;
diff --git a/Vocaluxe/Screens/CScreenOptionsVideo.cs b/Vocaluxe/Screens/CScreenOptionsVideo.cs
index 04e9d4e1..fd693db6 100644
--- a/Vocaluxe/Screens/CScreenOptionsVideo.cs
+++ b/Vocaluxe/Screens/CScreenOptionsVideo.cs
@@ -12,11 +12,12 @@ namespace Vocaluxe.Screens
class CScreenOptionsVideo : CMenu
{
// Version number for theme files. Increment it, if you've changed something on the theme files!
- const int ScreenVersion = 1;
+ const int ScreenVersion = 2;
private const string SelectSlideVideoBackgrounds = "SelectSlideVideoBackgrounds";
private const string SelectSlideVideoPreview = "SelectSlideVideoPreview";
private const string SelectSlideVideosInSongs = "SelectSlideVideosInSongs";
+ private const string SelectSlideVideosToBackground = "SelectSlideVideosToBackground";
private const string ButtonExit = "ButtonExit";
@@ -33,7 +34,7 @@ namespace Vocaluxe.Screens
_ScreenVersion = ScreenVersion;
_ThemeButtons = new string[] { ButtonExit };
- _ThemeSelectSlides = new string[] { SelectSlideVideoBackgrounds, SelectSlideVideoPreview, SelectSlideVideosInSongs };
+ _ThemeSelectSlides = new string[] { SelectSlideVideoBackgrounds, SelectSlideVideoPreview, SelectSlideVideosInSongs, SelectSlideVideosToBackground };
}
public override void LoadTheme()
@@ -43,6 +44,7 @@ namespace Vocaluxe.Screens
SelectSlides[htSelectSlides(SelectSlideVideoBackgrounds)].SetValues((int)CConfig.VideoBackgrounds);
SelectSlides[htSelectSlides(SelectSlideVideoPreview)].SetValues((int)CConfig.VideoPreview);
SelectSlides[htSelectSlides(SelectSlideVideosInSongs)].SetValues((int)CConfig.VideosInSongs);
+ SelectSlides[htSelectSlides(SelectSlideVideosToBackground)].SetValues((int)CConfig.VideosToBackground);
}
public override bool HandleInput(KeyEvent KeyEvent)
@@ -110,6 +112,7 @@ namespace Vocaluxe.Screens
public override bool UpdateGame()
{
+ SelectSlides[htSelectSlides(SelectSlideVideosToBackground)].Selection = (int)CConfig.VideosToBackground;
return true;
}
@@ -124,6 +127,8 @@ namespace Vocaluxe.Screens
CConfig.VideoBackgrounds = (EOffOn)SelectSlides[htSelectSlides(SelectSlideVideoBackgrounds)].Selection;
CConfig.VideoPreview = (EOffOn)SelectSlides[htSelectSlides(SelectSlideVideoPreview)].Selection;
CConfig.VideosInSongs = (EOffOn)SelectSlides[htSelectSlides(SelectSlideVideosInSongs)].Selection;
+ CConfig.VideosToBackground = (EOffOn)SelectSlides[htSelectSlides(SelectSlideVideosToBackground)].Selection;
+ CBackgroundMusic.VideoEnabled = true;
CConfig.SaveConfig();
}
diff --git a/Vocaluxe/Screens/CScreenSing.cs b/Vocaluxe/Screens/CScreenSing.cs
index 415a7bd9..f1d4fe7e 100644
--- a/Vocaluxe/Screens/CScreenSing.cs
+++ b/Vocaluxe/Screens/CScreenSing.cs
@@ -326,7 +326,7 @@ namespace Vocaluxe.Screens
}
SetVisuability();
- CBackgroundMusic.Pause();
+ CBackgroundMusic.Disabled = true;
}
public override void OnShowFinish()
@@ -335,7 +335,7 @@ namespace Vocaluxe.Screens
CGame.Start();
LoadNextSong();
- CBackgroundMusic.Pause();
+ CBackgroundMusic.Disabled = true;
}
public override bool Draw()
@@ -418,6 +418,7 @@ namespace Vocaluxe.Screens
public override void OnClose()
{
base.OnClose();
+ CBackgroundMusic.Disabled = false;
CloseSong();
}
diff --git a/Vocaluxe/Screens/CScreenSong.cs b/Vocaluxe/Screens/CScreenSong.cs
index d0f72677..df176860 100644
--- a/Vocaluxe/Screens/CScreenSong.cs
+++ b/Vocaluxe/Screens/CScreenSong.cs
@@ -187,12 +187,12 @@ namespace Vocaluxe.Screens
if ((CSongs.Category >= 0 || CConfig.Tabs == EOffOn.TR_CONFIG_OFF) && song >= 0 && song < CSongs.VisibleSongs.Length)
{
Texts[htTexts(TextSelection)].Text = CSongs.VisibleSongs[song].Artist + " - " + CSongs.VisibleSongs[song].Title;
- CBackgroundMusic.Pause();
+ CBackgroundMusic.Disabled = true;
}
else if (CSongs.Category == -1 && song >= 0 && song < CSongs.Categories.Length)
{
Texts[htTexts(TextSelection)].Text = CSongs.Categories[song].Name;
- CBackgroundMusic.Play();
+ CBackgroundMusic.Disabled = false;
}
else
Texts[htTexts(TextSelection)].Text = String.Empty;
@@ -227,6 +227,7 @@ namespace Vocaluxe.Screens
public override void OnClose()
{
base.OnClose();
+ CBackgroundMusic.Disabled = false;
SongMenus[htSongMenus(SongMenu)].OnHide();
}
@@ -351,4 +352,4 @@ namespace Vocaluxe.Screens
SongMenus[htSongMenus(SongMenu)].OnShow();
}
}
-}
\ No newline at end of file
+}
diff --git a/Vocaluxe/Vocaluxe.csproj b/Vocaluxe/Vocaluxe.csproj
index 0c3b8104..6f08fdce 100644
--- a/Vocaluxe/Vocaluxe.csproj
+++ b/Vocaluxe/Vocaluxe.csproj
@@ -187,6 +187,7 @@
Form
+