diff --git a/Output/Themes/Ambient/Screens/ScreenMain.xml b/Output/Themes/Ambient/Screens/ScreenMain.xml
index e19a42e5..63ed0825 100644
--- a/Output/Themes/Ambient/Screens/ScreenMain.xml
+++ b/Output/Themes/Ambient/Screens/ScreenMain.xml
@@ -29,33 +29,6 @@
-
-
- 58
- 41
-
- 0,00
-
- 32
-
-
-
- Invisible
-
-
- Invisible
-
- Left
-
-
-
- Normal
-
- TR_SCREENMAIN_MENU
-
-
-
-
Button
diff --git a/Output/Themes/Ambient/Screens/ScreenOptionsSound.xml b/Output/Themes/Ambient/Screens/ScreenOptionsSound.xml
index 018a2e36..5d3d0e9e 100644
--- a/Output/Themes/Ambient/Screens/ScreenOptionsSound.xml
+++ b/Output/Themes/Ambient/Screens/ScreenOptionsSound.xml
@@ -142,8 +142,8 @@
-
-
+
+
Button
@@ -198,8 +198,7 @@
26
-
-
+
Invisible
@@ -264,7 +263,7 @@
3
-
+
Invisible
@@ -329,7 +328,7 @@
3
-
+
Invisible
@@ -386,13 +385,13 @@
32,00
- 205,33
+ 500
Normal
Bold
- 3
+ 1
\ No newline at end of file
diff --git a/Output/Themes/Ambient/Screens/ScreenSing.xml b/Output/Themes/Ambient/Screens/ScreenSing.xml
index d860e883..935fb419 100644
--- a/Output/Themes/Ambient/Screens/ScreenSing.xml
+++ b/Output/Themes/Ambient/Screens/ScreenSing.xml
@@ -6,7 +6,9 @@
None
+
+
@@ -117,10 +119,10 @@
9
- 0,675
- 0,890
- 0,969
- 0,400
+ 0,68
+ 0,89
+ 0,97
+ 0,40
diff --git a/Output/Themes/Ambient/Screens/ScreenSong.xml b/Output/Themes/Ambient/Screens/ScreenSong.xml
index a6aa1ba0..2d0cfcfb 100644
--- a/Output/Themes/Ambient/Screens/ScreenSong.xml
+++ b/Output/Themes/Ambient/Screens/ScreenSong.xml
@@ -53,34 +53,6 @@
26
-
-
- 50
- 41
-
- 0,00
-
- 32
-
- 180
-
-
- StaticColor
-
-
- TextSColor
-
- Left
-
-
-
- Normal
-
- TR_SCREENSONG_MENU
-
-
-
-
220
diff --git a/Output/Themes/Ambient/Skin Blue.xml b/Output/Themes/Ambient/Skin Blue.xml
index 21f5418c..585aff80 100644
--- a/Output/Themes/Ambient/Skin Blue.xml
+++ b/Output/Themes/Ambient/Skin Blue.xml
@@ -219,8 +219,8 @@
[Blue]BG_Video.mp4
- [Blue]IntroIn.mp4
- [Blue]IntroMid.mp4
- [Blue]IntroOut.mp4
+ [Blue]IntroIn.mp4
+ [Blue]IntroMid.mp4
+ [Blue]IntroOut.mp4
\ No newline at end of file
diff --git a/Output/Themes/Ambient/Skin Green.xml b/Output/Themes/Ambient/Skin Green.xml
index 63a3bdb3..c1fb83b1 100644
--- a/Output/Themes/Ambient/Skin Green.xml
+++ b/Output/Themes/Ambient/Skin Green.xml
@@ -219,8 +219,8 @@
[Green]BG_Video.mp4
- [Green]IntroIn.mp4
- [Green]IntroMid.mp4
- [Green]IntroOut.mp4
+ [Green]IntroIn.mp4
+ [Green]IntroMid.mp4
+ [Green]IntroOut.mp4
\ No newline at end of file
diff --git a/Output/Themes/Ambient/Skin Red.xml b/Output/Themes/Ambient/Skin Red.xml
index 1e53d8d3..bf15aab2 100644
--- a/Output/Themes/Ambient/Skin Red.xml
+++ b/Output/Themes/Ambient/Skin Red.xml
@@ -219,8 +219,8 @@
[Red]BG_Video.mp4
- [Red]IntroIn.mp4
- [Red]IntroMid.mp4
- [Red]IntroOut.mp4
+ [Red]IntroIn.mp4
+ [Red]IntroMid.mp4
+ [Red]IntroOut.mp4
\ No newline at end of file
diff --git a/Output/Themes/Ambient/Skin Yellow.xml b/Output/Themes/Ambient/Skin Yellow.xml
index ff096567..a72e0825 100644
--- a/Output/Themes/Ambient/Skin Yellow.xml
+++ b/Output/Themes/Ambient/Skin Yellow.xml
@@ -219,8 +219,8 @@
[Yellow]BG_Video.mp4
- [Yellow]IntroIn.mp4
- [Yellow]IntroMid.mp4
- [Yellow]IntroOut.mp4
+ [Yellow]IntroIn.mp4
+ [Yellow]IntroMid.mp4
+ [Yellow]IntroOut.mp4
\ No newline at end of file
diff --git a/Vocaluxe/Base/CBackgroundMusic.cs b/Vocaluxe/Base/CBackgroundMusic.cs
index 374d8d5b..e67fe419 100644
--- a/Vocaluxe/Base/CBackgroundMusic.cs
+++ b/Vocaluxe/Base/CBackgroundMusic.cs
@@ -13,17 +13,22 @@ namespace Vocaluxe.Base
{
private static CHelper Helper = new CHelper();
private static int _CurrentMusicStream = -1;
- private static bool _Fading;
- private static Stopwatch _FadeTimer = new Stopwatch();
- private static Random _Random = new Random();
- private static List _BackgroundMusicFileNames = new List();
- private static int _CurrentBackgroundMusicFileNameIndex;
+ private static string _CurrentMusicFilePath = String.Empty;
+
+ private static List _AllFileNames = new List();
+ private static List _BGMusicFileNames = new List();
+
private static bool _OwnMusicAdded;
private static bool _BackgroundMusicAdded;
public static void Init()
{
- if(CConfig.BackgroundMusicSource == EBackgroundMusicSource.TR_CONFIG_NO_OWN_MUSIC || CConfig.BackgroundMusicSource == EBackgroundMusicSource.TR_CONFIG_OWN_MUSIC)
+ _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));
+
+ if(CConfig.BackgroundMusicSource != EBackgroundMusicSource.TR_CONFIG_ONLY_OWN_MUSIC)
AddBackgroundMusic();
}
@@ -31,65 +36,62 @@ namespace Vocaluxe.Base
{
if (CConfig.BackgroundMusic == EOffOn.TR_CONFIG_ON)
{
- if (_BackgroundMusicFileNames.Count > 0)
+ if (_AllFileNames.Count > 0)
{
- CSound.Fade(_CurrentMusicStream, CConfig.BackgroundMusicVolume, CConfig.FadeTime);
- CSound.Play(_CurrentMusicStream);
+ if (_CurrentMusicStream != -1)
+ {
+ CSound.Fade(_CurrentMusicStream, CConfig.BackgroundMusicVolume, CSettings.BackgroundMusicFadeTime);
+ CSound.Play(_CurrentMusicStream);
+ }
+ else
+ Next();
}
}
}
public static void Stop()
{
- if (_BackgroundMusicFileNames.Count > 0)
- CSound.FadeAndStop(_CurrentMusicStream, CConfig.BackgroundMusicVolume, CConfig.FadeTime);
+ if (_AllFileNames.Count > 0)
+ CSound.FadeAndStop(_CurrentMusicStream, CConfig.BackgroundMusicVolume, CSettings.BackgroundMusicFadeTime);
+
+ _CurrentMusicFilePath = String.Empty;
}
public static void Pause()
{
- if (_BackgroundMusicFileNames.Count > 0)
- CSound.FadeAndPause(_CurrentMusicStream, 0, CConfig.FadeTime);
+ if (_AllFileNames.Count > 0)
+ CSound.FadeAndPause(_CurrentMusicStream, 0f, CSettings.BackgroundMusicFadeTime);
}
public static void Update()
{
- if (_BackgroundMusicFileNames.Count > 0)
+ if (_AllFileNames.Count > 0 && _CurrentMusicStream != -1)
{
float timeToPlay = CSound.GetLength(_CurrentMusicStream) - CSound.GetPosition(_CurrentMusicStream);
- if (_FadeTimer.ElapsedMilliseconds >= CConfig.FadeTime * 1000)
- {
- _Fading = false;
- _FadeTimer.Reset();
- }
- if ((timeToPlay <= CConfig.FadeTime) && !_Fading)
- {
- _FadeTimer.Start();
+
+ if (timeToPlay <= CSettings.BackgroundMusicFadeTime)
Next();
- _Fading = true;
- }
}
}
public static void Next()
{
- if (_BackgroundMusicFileNames.Count > 0)
+ if (_AllFileNames.Count > 0)
{
- if (_CurrentMusicStream != -1)
- CSound.FadeAndStop(_CurrentMusicStream, 0, CConfig.FadeTime);
- _CurrentBackgroundMusicFileNameIndex = _Random.Next(_BackgroundMusicFileNames.Count);
- _CurrentMusicStream = CSound.Load(_BackgroundMusicFileNames[_CurrentBackgroundMusicFileNameIndex]);
+ Stop();
+
+ _CurrentMusicFilePath = _AllFileNames[CGame.Rand.Next(_AllFileNames.Count)];
+ _CurrentMusicStream = CSound.Load(_CurrentMusicFilePath);
+ CSound.SetStreamVolume(_CurrentMusicStream, 0f);
Play();
}
- else if (_BackgroundMusicAdded || _OwnMusicAdded)
- {
- if (_CurrentMusicStream != -1)
- CSound.FadeAndStop(_CurrentMusicStream, 0, CConfig.FadeTime);
- }
+ else
+ Stop();
}
public static void ApplyVolume()
{
- CSound.Fade(_CurrentMusicStream, CConfig.BackgroundMusicVolume, CConfig.FadeTime);
+ CSound.SetStreamVolume(_CurrentMusicStream, CConfig.BackgroundMusicVolume);
}
public static void AddOwnMusic()
@@ -98,19 +100,22 @@ namespace Vocaluxe.Base
{
foreach (CSong song in CSongs.AllSongs)
{
- _BackgroundMusicFileNames.Add(song.GetMP3());
+ _AllFileNames.Add(song.GetMP3());
}
}
_OwnMusicAdded = true;
- Next();
}
public static void RemoveOwnMusic()
{
- foreach (CSong song in CSongs.AllSongs)
- {
- _BackgroundMusicFileNames.Remove(song.GetMP3());
- }
+ _AllFileNames.Clear();
+
+ if (_BackgroundMusicAdded)
+ _AllFileNames.AddRange(_BGMusicFileNames);
+
+ if (IsPlaying() && !IsBackgroundFile(_CurrentMusicFilePath))
+ Next();
+
_OwnMusicAdded = false;
}
@@ -118,12 +123,8 @@ namespace Vocaluxe.Base
{
if (!_BackgroundMusicAdded)
{
- _BackgroundMusicFileNames.AddRange(Helper.ListFiles(CSettings.sFolderBackgroundMusic, "*.mp3", true, true));
- _BackgroundMusicFileNames.AddRange(Helper.ListFiles(CSettings.sFolderBackgroundMusic, "*.wav", true, true));
- _BackgroundMusicFileNames.AddRange(Helper.ListFiles(CSettings.sFolderBackgroundMusic, "*.ogg", true, true));
- _BackgroundMusicFileNames.AddRange(Helper.ListFiles(CSettings.sFolderBackgroundMusic, "*.wma", true, true));
+ _AllFileNames.AddRange(_BGMusicFileNames);
_BackgroundMusicAdded = true;
- Next();
}
}
@@ -131,18 +132,78 @@ namespace Vocaluxe.Base
{
if (_BackgroundMusicAdded)
{
- List removeList = new List();
- removeList.AddRange(Helper.ListFiles(CSettings.sFolderBackgroundMusic, "*.mp3", true, true));
- removeList.AddRange(Helper.ListFiles(CSettings.sFolderBackgroundMusic, "*.wav", true, true));
- removeList.AddRange(Helper.ListFiles(CSettings.sFolderBackgroundMusic, "*.ogg", true, true));
- removeList.AddRange(Helper.ListFiles(CSettings.sFolderBackgroundMusic, "*.wma", true, true));
-
- foreach (string s in removeList)
- {
- _BackgroundMusicFileNames.Remove(s);
- }
+ _AllFileNames.Clear();
+ _OwnMusicAdded = false;
+ AddOwnMusic();
_BackgroundMusicAdded = false;
+
+ if (IsPlaying() && IsBackgroundFile(_CurrentMusicFilePath))
+ Next();
}
}
+
+ public static void CheckAndApplyConfig(EOffOn NewOnOff, EBackgroundMusicSource NewSource, float NewVolume)
+ {
+ if (CConfig.BackgroundMusic != NewOnOff)
+ {
+ CConfig.BackgroundMusic = NewOnOff;
+ if (NewOnOff == EOffOn.TR_CONFIG_ON)
+ Play();
+ else
+ Pause();
+ }
+
+ if (CConfig.BackgroundMusicSource != NewSource)
+ {
+ CConfig.BackgroundMusicSource = NewSource;
+
+ switch (NewSource)
+ {
+ case EBackgroundMusicSource.TR_CONFIG_NO_OWN_MUSIC:
+ if (!_BackgroundMusicAdded)
+ AddBackgroundMusic();
+
+ RemoveOwnMusic();
+ break;
+
+ case EBackgroundMusicSource.TR_CONFIG_ONLY_OWN_MUSIC:
+ if (!_OwnMusicAdded)
+ AddOwnMusic();
+
+ RemoveBackgroundMusic();
+ break;
+ case EBackgroundMusicSource.TR_CONFIG_OWN_MUSIC:
+ if (!_BackgroundMusicAdded)
+ AddBackgroundMusic();
+
+ if (!_OwnMusicAdded)
+ AddOwnMusic();
+ break;
+ }
+ }
+
+ if (CConfig.BackgroundMusicVolume != NewVolume)
+ {
+ CConfig.BackgroundMusicVolume = (int)NewVolume;
+ ApplyVolume();
+ }
+
+ CConfig.SaveConfig();
+ }
+
+ public static bool IsPlaying()
+ {
+ return CSound.IsPlaying(_CurrentMusicStream);
+ }
+
+ private static bool IsBackgroundFile(string FilePath)
+ {
+ foreach (string file in _BGMusicFileNames)
+ {
+ if (file == FilePath)
+ return true;
+ }
+ return false;
+ }
}
}
diff --git a/Vocaluxe/Base/CConfig.cs b/Vocaluxe/Base/CConfig.cs
index 2854b90a..91e26b31 100644
--- a/Vocaluxe/Base/CConfig.cs
+++ b/Vocaluxe/Base/CConfig.cs
@@ -138,8 +138,8 @@ namespace Vocaluxe.Base
public enum EBackgroundMusicSource
{
TR_CONFIG_NO_OWN_MUSIC,
- TR_CONFIG_ONLY_OWN_MUSIC,
- TR_CONFIG_OWN_MUSIC
+ TR_CONFIG_OWN_MUSIC,
+ TR_CONFIG_ONLY_OWN_MUSIC
}
#endregion Enums
diff --git a/Vocaluxe/Base/CSettings.cs b/Vocaluxe/Base/CSettings.cs
index a209f1a7..7364c4fb 100644
--- a/Vocaluxe/Base/CSettings.cs
+++ b/Vocaluxe/Base/CSettings.cs
@@ -91,6 +91,8 @@ namespace Vocaluxe.Base
public const float LyricHelperMinTime = 0.2f;
public const bool TabNavigation = false;
+
+ public const float BackgroundMusicFadeTime = 1.5f;
public static string GetVersionText()
{
diff --git a/Vocaluxe/Screens/CScreenLoad.cs b/Vocaluxe/Screens/CScreenLoad.cs
index 5c1723e8..ee9e9eda 100644
--- a/Vocaluxe/Screens/CScreenLoad.cs
+++ b/Vocaluxe/Screens/CScreenLoad.cs
@@ -132,6 +132,9 @@ namespace Vocaluxe.Screens
CLog.StartBenchmark(3, "Load Cover");
_SongLoaderThread.Start();
_timer.Start();
+
+ if (!CBackgroundMusic.IsPlaying())
+ CBackgroundMusic.Next();
}
public override bool UpdateGame()
@@ -163,6 +166,16 @@ namespace Vocaluxe.Screens
CLanguage.Translate("TR_SCREENLOAD_TOTAL") + ": " + CSongs.NumAllSongs.ToString() + " " +
CLanguage.Translate("TR_SCREENLOAD_SONGS") + " (" + CSongs.NumSongsWithCoverLoaded + " " +
CLanguage.Translate("TR_SCREENLOAD_LOADED") + ")";
+
+ if (CSongs.SongsLoaded && CConfig.BackgroundMusic == EOffOn.TR_CONFIG_ON &&
+ CConfig.BackgroundMusicSource != EBackgroundMusicSource.TR_CONFIG_NO_OWN_MUSIC)
+ {
+ CBackgroundMusic.AddOwnMusic();
+
+ if (!CBackgroundMusic.IsPlaying())
+ CBackgroundMusic.Next();
+ }
+
return true;
}
@@ -190,8 +203,6 @@ namespace Vocaluxe.Screens
_Intros[2].Close();
CLog.StopBenchmark(3, "Load Cover");
- if(CConfig.BackgroundMusicSource == EBackgroundMusicSource.TR_CONFIG_ONLY_OWN_MUSIC || CConfig.BackgroundMusicSource == EBackgroundMusicSource.TR_CONFIG_OWN_MUSIC)
- CBackgroundMusic.AddOwnMusic();
}
private void CheckStartIntroVideos()
diff --git a/Vocaluxe/Screens/CScreenOptionsSound.cs b/Vocaluxe/Screens/CScreenOptionsSound.cs
index 919f4c40..a3fd049e 100644
--- a/Vocaluxe/Screens/CScreenOptionsSound.cs
+++ b/Vocaluxe/Screens/CScreenOptionsSound.cs
@@ -130,35 +130,11 @@ namespace Vocaluxe.Screens
}
private void SaveConfig()
{
- CConfig.BackgroundMusic = (EOffOn)SelectSlides[htSelectSlides(SelectSlideBackgroundMusic)].Selection;
+ EOffOn NewOffOn = (EOffOn)SelectSlides[htSelectSlides(SelectSlideBackgroundMusic)].Selection;
+ EBackgroundMusicSource NewSource = (EBackgroundMusicSource)SelectSlides[htSelectSlides(SelectSlideBackgroundMusicSource)].Selection;
+ float NewVolume = SelectSlides[htSelectSlides(SelectSlideBackgroundMusicVolume)].Selection * 5;
- if (CConfig.BackgroundMusic == EOffOn.TR_CONFIG_ON)
- CBackgroundMusic.Play();
- else
- CBackgroundMusic.Pause();
-
- CConfig.BackgroundMusicVolume = SelectSlides[htSelectSlides(SelectSlideBackgroundMusicVolume)].Selection * 5;
- CBackgroundMusic.ApplyVolume();
-
- if (CConfig.BackgroundMusicSource != (EBackgroundMusicSource)SelectSlides[htSelectSlides(SelectSlideBackgroundMusicSource)].Selection)
- {
- CConfig.BackgroundMusicSource = (EBackgroundMusicSource)SelectSlides[htSelectSlides(SelectSlideBackgroundMusicSource)].Selection;
- if (CConfig.BackgroundMusicSource == EBackgroundMusicSource.TR_CONFIG_NO_OWN_MUSIC)
- {
- CBackgroundMusic.RemoveOwnMusic();
- CBackgroundMusic.AddBackgroundMusic();
- }
- if (CConfig.BackgroundMusicSource == EBackgroundMusicSource.TR_CONFIG_ONLY_OWN_MUSIC)
- {
- CBackgroundMusic.RemoveBackgroundMusic();
- CBackgroundMusic.AddOwnMusic();
- }
- if (CConfig.BackgroundMusicSource == EBackgroundMusicSource.TR_CONFIG_OWN_MUSIC)
- CBackgroundMusic.AddOwnMusic();
-
- }
-
- CConfig.SaveConfig();
+ CBackgroundMusic.CheckAndApplyConfig(NewOffOn, NewSource, NewVolume);
}
}
}