This commit is contained in:
Stephan Sundermann committed 2012-02-21 21:30:04 +01:00
commit c3e35932f7
13 files changed
+163 -167

No files matched your search

@@ -29,33 +29,6 @@
<!-- <Space>: Reflection Space-->
<!-- <Height>: Reflection Height-->
</StaticMenuBar>
<Text1>
<!--<X>, <Y>: Text position-->
<X>58</X>
<Y>41</Y>
<!--<Z>: Text position-->
<Z>0,00</Z>
<!--<H>: Text height-->
<H>32</H>
<!--<MaxW>: Maximum text width (if exists)-->
<!--<Color>: Text color from ColorScheme (high priority)-->
<!--or <R>, <G>, <B>, <A> (lower priority)-->
<Color>Invisible</Color>
<!--<SColor>: Selected Text color from ColorScheme (high priority)-->
<!--or <SR>, <SG>, <SB>, <SA> (lower priority)-->
<Color>Invisible</Color>
<!--<Align>: Text align: Left, Center, Right-->
<Align>Left</Align>
<!--<Style>: Text style: Normal, Italic, Bold, BoldItalic-->
<Style>Bold</Style>
<!--<Font>: Text font name-->
<Font>Normal</Font>
<!--<Text>: Text or translation tag-->
<Text>TR_SCREENMAIN_MENU</Text>
<!--<Reflection> If exists:-->
<!-- <Space>: Reflection Space-->
<!-- <Height>: Reflection Height-->
</Text1>
<ButtonSing>
<!--<Skin>: Texture name-->
<Skin>Button</Skin>
@@ -142,8 +142,8 @@
<!--<Reflection> If exists:-->
<!-- <Space>: Reflection Space-->
<!-- <Height>: Reflection Height-->
</Text4>
<ButtonExit>
</Text4>
<ButtonExit>
<!--<Skin>: Texture name-->
<Skin>Button</Skin>
<!--<SkinSelected>: Texture name for selected button-->
@@ -198,8 +198,7 @@
<Height>26</Height>
</SReflection>
</ButtonExit>
<SelectSlideBackgroundMusic>
<SelectSlideBackgroundMusic>
<!--<Skin>: Texture name-->
<Skin>Invisible</Skin>
<!--<SkinArrowLeft>: Texture name of left arrow-->
@@ -264,7 +263,7 @@
<!--<NumVisible>: Number of visible elements in the slide-->
<NumVisible>3</NumVisible>
</SelectSlideBackgroundMusic>
<SelectSlideBackgroundMusicVolume>
<SelectSlideBackgroundMusicVolume>
<!--<Skin>: Texture name-->
<Skin>Invisible</Skin>
<!--<SkinArrowLeft>: Texture name of left arrow-->
@@ -329,7 +328,7 @@
<!--<NumVisible>: Number of visible elements in the slide-->
<NumVisible>3</NumVisible>
</SelectSlideBackgroundMusicVolume>
<SelectSlideBackgroundMusicSource>
<SelectSlideBackgroundMusicSource>
<!--<Skin>: Texture name-->
<Skin>Invisible</Skin>
<!--<SkinArrowLeft>: Texture name of left arrow-->
@@ -386,13 +385,13 @@
<!--<TextH>: Text height-->
<TextH>32,00</TextH>
<!--<TextMaxW>: Maximum text width (if exists)-->
<TextMaxW>205,33</TextMaxW>
<TextMaxW>500</TextMaxW>
<!--<TextFont>: Text font name-->
<TextFont>Normal</TextFont>
<!--<TextStyle>: Text style: Normal, Italic, Bold, BoldItalic-->
<TextStyle>Bold</TextStyle>
<!--<NumVisible>: Number of visible elements in the slide-->
<NumVisible>3</NumVisible>
<NumVisible>1</NumVisible>
</SelectSlideBackgroundMusicSource>
</ScreenOptionsSound>
</root>
+6 -4
View File
@@ -6,7 +6,9 @@
<!--<Type>: Background type: None, Color, Texture, Video-->
<Type>None</Type>
<!--<Video>: Background video name-->
<Video />
<!--<Skin>: Background Texture name-->
<Skin />
<!--<Color>: Background color for type "Color" from ColorScheme (high priority)-->
<!--or <R>, <G>, <B>, <A> (lower priority)-->
</Background1>
@@ -117,10 +119,10 @@
<H>9</H>
<!--<Color>: Static color from ColorScheme (high priority)-->
<!--or <R>, <G>, <B>, <A> (lower priority)-->
<R>0,675</R>
<G>0,890</G>
<B>0,969</B>
<A>0,400</A>
<R>0,68</R>
<G>0,89</G>
<B>0,97</B>
<A>0,40</A>
<!--<Reflection> If exists:-->
<!-- <Space>: Reflection Space-->
<!-- <Height>: Reflection Height-->
@@ -53,34 +53,6 @@
<Height>26</Height>
</Reflection>
</StaticSearchBar>
<Text1>
<!--<X>, <Y>: Text position-->
<X>50</X>
<Y>41</Y>
<!--<Z>: Text position-->
<Z>0,00</Z>
<!--<H>: Text height-->
<H>32</H>
<!--<MaxW>: Maximum text width (if exists)-->
<MaxW>180</MaxW>
<!--<Color>: Text color from ColorScheme (high priority)-->
<!--or <R>, <G>, <B>, <A> (lower priority)-->
<Color>StaticColor</Color>
<!--<SColor>: Selected Text color from ColorScheme (high priority)-->
<!--or <SR>, <SG>, <SB>, <SA> (lower priority)-->
<Color>TextSColor</Color>
<!--<Align>: Text align: Left, Center, Right-->
<Align>Left</Align>
<!--<Style>: Text style: Normal, Italic, Bold, BoldItalic-->
<Style>Bold</Style>
<!--<Font>: Text font name-->
<Font>Normal</Font>
<!--<Text>: Text or translation tag-->
<Text>TR_SCREENSONG_MENU</Text>
<!--<Reflection> If exists:-->
<!-- <Space>: Reflection Space-->
<!-- <Height>: Reflection Height-->
</Text1>
<TextCategory>
<!--<X>, <Y>: Text position-->
<X>220</X>
+3 -3
View File
@@ -219,8 +219,8 @@
</Skins>
<Videos>
<BG_Video>[Blue]BG_Video.mp4</BG_Video>
<IntroIn>[Blue]IntroIn.mp4</IntroIn>
<IntroMid>[Blue]IntroMid.mp4</IntroMid>
<IntroOut>[Blue]IntroOut.mp4</IntroOut>
<IntroIn>[Blue]IntroIn.mp4</IntroIn>
<IntroMid>[Blue]IntroMid.mp4</IntroMid>
<IntroOut>[Blue]IntroOut.mp4</IntroOut>
</Videos>
</root>
+3 -3
View File
@@ -219,8 +219,8 @@
</Skins>
<Videos>
<BG_Video>[Green]BG_Video.mp4</BG_Video>
<IntroIn>[Green]IntroIn.mp4</IntroIn>
<IntroMid>[Green]IntroMid.mp4</IntroMid>
<IntroOut>[Green]IntroOut.mp4</IntroOut>
<IntroIn>[Green]IntroIn.mp4</IntroIn>
<IntroMid>[Green]IntroMid.mp4</IntroMid>
<IntroOut>[Green]IntroOut.mp4</IntroOut>
</Videos>
</root>
+3 -3
View File
@@ -219,8 +219,8 @@
</Skins>
<Videos>
<BG_Video>[Red]BG_Video.mp4</BG_Video>
<IntroIn>[Red]IntroIn.mp4</IntroIn>
<IntroMid>[Red]IntroMid.mp4</IntroMid>
<IntroOut>[Red]IntroOut.mp4</IntroOut>
<IntroIn>[Red]IntroIn.mp4</IntroIn>
<IntroMid>[Red]IntroMid.mp4</IntroMid>
<IntroOut>[Red]IntroOut.mp4</IntroOut>
</Videos>
</root>
+3 -3
View File
@@ -219,8 +219,8 @@
</Skins>
<Videos>
<BG_Video>[Yellow]BG_Video.mp4</BG_Video>
<IntroIn>[Yellow]IntroIn.mp4</IntroIn>
<IntroMid>[Yellow]IntroMid.mp4</IntroMid>
<IntroOut>[Yellow]IntroOut.mp4</IntroOut>
<IntroIn>[Yellow]IntroIn.mp4</IntroIn>
<IntroMid>[Yellow]IntroMid.mp4</IntroMid>
<IntroOut>[Yellow]IntroOut.mp4</IntroOut>
</Videos>
</root>
+117 -56
View File
@@ -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<string> _BackgroundMusicFileNames = new List<string>();
private static int _CurrentBackgroundMusicFileNameIndex;
private static string _CurrentMusicFilePath = String.Empty;
private static List<string> _AllFileNames = new List<string>();
private static List<string> _BGMusicFileNames = new List<string>();
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<string> removeList = new List<string>();
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;
}
}
}
+2 -2
View File
@@ -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
+2
View File
@@ -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()
{
+13 -2
View File
@@ -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()
+4 -28
View File
@@ -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);
}
}
}