Backgroundmusic is now played randomly instead of a fixed playlist and added the possibility to use own music as backgroundmusic

This commit is contained in:
Stephan Sundermann committed 2012-02-21 12:12:41 +01:00
1 parent 4b36ceb779
commit e6ee64931e
9 files changed
+240 -50

No files matched your search

+7 -3
View File
@@ -84,6 +84,10 @@
<!--Config: Timer-Look-->
<TR_CONFIG_TIMERLOOK_NORMAL>Normal</TR_CONFIG_TIMERLOOK_NORMAL>
<TR_CONFIG_TIMERLOOK_EXPANDED>Erweitert</TR_CONFIG_TIMERLOOK_EXPANDED>
<!--Config: Background-Music-Source-->
<TR_CONFIG_OWN_MUSIC>Eigene Musik und Hintergrundmusik</TR_CONFIG_OWN_MUSIC>
<TR_CONFIG_NO_OWN_MUSIC>Keine eigene Musik</TR_CONFIG_NO_OWN_MUSIC>
<TR_CONFIG_ONLY_OWN_MUSIC>Nur eigene Musik</TR_CONFIG_ONLY_OWN_MUSIC>
<!--Screens-->
<!--ScreenLoad-->
<TR_SCREENLOAD_LOADING>Laden</TR_SCREENLOAD_LOADING>
@@ -148,9 +152,6 @@
<TR_SCREENOGAME_TABS>Kategorieren anzeigen</TR_SCREENOGAME_TABS>
<TR_SCREENOGAME_DIFFICULTY>Schwierigkeit</TR_SCREENOGAME_DIFFICULTY>
<TR_SCREENOGAME_TIMERMODE>Timer-Modus</TR_SCREENOGAME_TIMERMODE>
<!--ScreenOptionsSound-->
<TR_SCREENOSOUND_BACKGROUNDMUSIC>Hintergrundmusik</TR_SCREENOSOUND_BACKGROUNDMUSIC>
<TR_SCREENOSOUND_BACKGROUNDMUSICVOLUME>Hintergrundmusiklautstärke</TR_SCREENOSOUND_BACKGROUNDMUSICVOLUME>
<!--ScreenOptionsRecord-->
<TR_SCREENORECORD_OPTIONS>Aufnahmeeinstellungen</TR_SCREENORECORD_OPTIONS>
<TR_SCREENORECORD_DEVICE>Soundkarte</TR_SCREENORECORD_DEVICE>
@@ -162,6 +163,9 @@
<TR_SCREENORECORD_BUTTON_DELAYTEST>Verzögerungs-Test</TR_SCREENORECORD_BUTTON_DELAYTEST>
<!--ScreenOptionsSound-->
<TR_SCREENOSOUND_OPTIONS>Soundeinstellungen</TR_SCREENOSOUND_OPTIONS>
<TR_SCREENOSOUND_BACKGROUNDMUSIC>Hintergrundmusik</TR_SCREENOSOUND_BACKGROUNDMUSIC>
<TR_SCREENOSOUND_BACKGROUNDMUSICVOLUME>Hintergrundmusiklautstärke</TR_SCREENOSOUND_BACKGROUNDMUSICVOLUME>
<TR_SCREENOSOUND_BACKGROUNDMUSICSOURCE>Hintergrundmusikquelle</TR_SCREENOSOUND_BACKGROUNDMUSICSOURCE>
<!--ScreenOptionsTheme-->
<TR_SCREENOTHEME_OPTIONS>Designeinstellungen</TR_SCREENOTHEME_OPTIONS>
<TR_SCREENOTHEME_THEME>Design</TR_SCREENOTHEME_THEME>
+7 -3
View File
@@ -84,6 +84,10 @@
<!--Config: Timer-Look-->
<TR_CONFIG_TIMERLOOK_NORMAL>Normal</TR_CONFIG_TIMERLOOK_NORMAL>
<TR_CONFIG_TIMERLOOK_EXPANDED>Expanded</TR_CONFIG_TIMERLOOK_EXPANDED>
<!--Config: Background-Music-Source-->
<TR_CONFIG_OWN_MUSIC>Own Music and Background Music</TR_CONFIG_OWN_MUSIC>
<TR_CONFIG_NO_OWN_MUSIC>No own Musik</TR_CONFIG_NO_OWN_MUSIC>
<TR_CONFIG_ONLY_OWN_MUSIC>Only own Musik</TR_CONFIG_ONLY_OWN_MUSIC>
<!--Screens-->
<!--ScreenLoad-->
<TR_SCREENLOAD_LOADING>Loading</TR_SCREENLOAD_LOADING>
@@ -148,9 +152,6 @@
<TR_SCREENOGAME_TABS>Tabs</TR_SCREENOGAME_TABS>
<TR_SCREENOGAME_DIFFICULTY>Game Difficulty</TR_SCREENOGAME_DIFFICULTY>
<TR_SCREENOGAME_TIMERMODE>Timer-Mode</TR_SCREENOGAME_TIMERMODE>
<!--ScreenOptionsSound-->
<TR_SCREENOSOUND_BACKGROUNDMUSIC>Backgroundmusic</TR_SCREENOSOUND_BACKGROUNDMUSIC>
<TR_SCREENOSOUND_BACKGROUNDMUSICVOLUME>Backgroundmusic Volume</TR_SCREENOSOUND_BACKGROUNDMUSICVOLUME>
<!--ScreenOptionsRecord-->
<TR_SCREENORECORD_OPTIONS>Record Options</TR_SCREENORECORD_OPTIONS>
<TR_SCREENORECORD_DEVICE>Device</TR_SCREENORECORD_DEVICE>
@@ -162,6 +163,9 @@
<TR_SCREENORECORD_BUTTON_DELAYTEST>Delay Test</TR_SCREENORECORD_BUTTON_DELAYTEST>
<!--ScreenOptionsSound-->
<TR_SCREENOSOUND_OPTIONS>Options Sound</TR_SCREENOSOUND_OPTIONS>
<TR_SCREENOSOUND_BACKGROUNDMUSIC>Backgroundmusic</TR_SCREENOSOUND_BACKGROUNDMUSIC>
<TR_SCREENOSOUND_BACKGROUNDMUSICVOLUME>Backgroundmusic Volume</TR_SCREENOSOUND_BACKGROUNDMUSICVOLUME>
<TR_SCREENOSOUND_BACKGROUNDMUSICSOURCE>Backgroundmusic Source</TR_SCREENOSOUND_BACKGROUNDMUSICSOURCE>
<!--ScreenOptionsTheme-->
<TR_SCREENOTHEME_OPTIONS>Theme Options</TR_SCREENOTHEME_OPTIONS>
<TR_SCREENOTHEME_THEME>Theme</TR_SCREENOTHEME_THEME>
+7 -3
View File
@@ -84,6 +84,10 @@
<!--Config: Timer-Look-->
<TR_CONFIG_TIMERLOOK_NORMAL>Normal</TR_CONFIG_TIMERLOOK_NORMAL>
<TR_CONFIG_TIMERLOOK_EXPANDED>Développé</TR_CONFIG_TIMERLOOK_EXPANDED>
<!--Config: Background-Music-Source-->
<TR_CONFIG_OWN_MUSIC>TODO: Own Music and Background Music</TR_CONFIG_OWN_MUSIC>
<TR_CONFIG_NO_OWN_MUSIC>TODO: No own Musik</TR_CONFIG_NO_OWN_MUSIC>
<TR_CONFIG_ONLY_OWN_MUSIC>TODO: Only own Musik</TR_CONFIG_ONLY_OWN_MUSIC>
<!--Screens-->
<!--ScreenLoad-->
<TR_SCREENLOAD_LOADING>Chargement</TR_SCREENLOAD_LOADING>
@@ -148,9 +152,6 @@
<TR_SCREENOGAME_TABS>Dossiers</TR_SCREENOGAME_TABS>
<TR_SCREENOGAME_DIFFICULTY>Difficulté du Jeu</TR_SCREENOGAME_DIFFICULTY>
<TR_SCREENOGAME_TIMERMODE>Mode du Minuteur</TR_SCREENOGAME_TIMERMODE>
<!--ScreenOptionsSound-->
<TR_SCREENOSOUND_BACKGROUNDMUSIC>TODO: Backgroundmusic</TR_SCREENOSOUND_BACKGROUNDMUSIC>
<TR_SCREENOSOUND_BACKGROUNDMUSICVOLUME>TODO: Backgroundmusic Volume</TR_SCREENOSOUND_BACKGROUNDMUSICVOLUME>
<!--ScreenOptionsRecord-->
<TR_SCREENORECORD_OPTIONS>Options d'Enregistrement</TR_SCREENORECORD_OPTIONS>
<TR_SCREENORECORD_DEVICE>Appareil</TR_SCREENORECORD_DEVICE>
@@ -162,6 +163,9 @@
<TR_SCREENORECORD_BUTTON_DELAYTEST>Test du Retard</TR_SCREENORECORD_BUTTON_DELAYTEST>
<!--ScreenOptionsSound-->
<TR_SCREENOSOUND_OPTIONS>Options du Son</TR_SCREENOSOUND_OPTIONS>
<TR_SCREENOSOUND_BACKGROUNDMUSIC>TODO: Backgroundmusic</TR_SCREENOSOUND_BACKGROUNDMUSIC>
<TR_SCREENOSOUND_BACKGROUNDMUSICVOLUME>TODO: Backgroundmusic Volume</TR_SCREENOSOUND_BACKGROUNDMUSICVOLUME>
<TR_SCREENOSOUND_BACKGROUNDMUSICSOURCE>TODO: Backgroundmusic Source</TR_SCREENOSOUND_BACKGROUNDMUSICSOURCE>
<!--ScreenOptionsTheme-->
<TR_SCREENOTHEME_OPTIONS>Options du Thème</TR_SCREENOTHEME_OPTIONS>
<TR_SCREENOTHEME_THEME>Thème</TR_SCREENOTHEME_THEME>
@@ -115,7 +115,34 @@
<!--<Reflection> If exists:-->
<!-- <Space>: Reflection Space-->
<!-- <Height>: Reflection Height-->
</Text3>
</Text3>
<Text4>
<!--<X>, <Y>: Text position-->
<X>75</X>
<Y>225</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>StaticColor</Color>
<!--<SColor>: Selected Text color from ColorScheme (high priority)-->
<!--or <SR>, <SG>, <SB>, <SA> (lower priority)-->
<SColor>TextSColor</SColor>
<!--<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_SCREENOSOUND_BACKGROUNDMUSICSOURCE</Text>
<!--<Reflection> If exists:-->
<!-- <Space>: Reflection Space-->
<!-- <Height>: Reflection Height-->
</Text4>
<ButtonExit>
<!--<Skin>: Texture name-->
<Skin>Button</Skin>
@@ -302,5 +329,70 @@
<!--<NumVisible>: Number of visible elements in the slide-->
<NumVisible>3</NumVisible>
</SelectSlideBackgroundMusicVolume>
<SelectSlideBackgroundMusicSource>
<!--<Skin>: Texture name-->
<Skin>Invisible</Skin>
<!--<SkinArrowLeft>: Texture name of left arrow-->
<SkinArrowLeft>SelectSlideArrowLeft</SkinArrowLeft>
<!--<SkinArrowRight>: Texture name of right arrow-->
<SkinArrowRight>SelectSlideArrowRight</SkinArrowRight>
<!--<SkinSelected>: Texture name for selected SelectSlide-->
<SkinSelected>SelectSlide</SkinSelected>
<!--<SkinArrowLeftSelected>: Texture name of selected left arrow-->
<SkinArrowLeftSelected>SelectSlideArrowLeft</SkinArrowLeftSelected>
<!--<SkinArrowRightSelected>: Texture name of selected right arrow-->
<SkinArrowRightSelected>SelectSlideArrowRight</SkinArrowRightSelected>
<!--<SkinHighlighted>: Texture name for highlighted SelectSlide-->
<SkinHighlighted>SelectSlide</SkinHighlighted>
<!--<X>, <Y>, <Z>, <W>, <H>: SelectSlide position, width and height-->
<X>500</X>
<Y>220</Y>
<Z>0,00</Z>
<W>700</W>
<H>50</H>
<!--<ArrowLeftX>, <ArrowLeftY>, <ArrowLeftZ>, <ArrowLeftW>, <ArrowLeftH>: Left arrow position, width and height-->
<ArrowLeftX>505</ArrowLeftX>
<ArrowLeftY>225</ArrowLeftY>
<ArrowLeftZ>0,00</ArrowLeftZ>
<ArrowLeftW>40</ArrowLeftW>
<ArrowLeftH>40</ArrowLeftH>
<!--<ArrowRightX>, <ArrowRightY>, <ArrowRightZ>, <ArrowRightW>, <ArrowRightH>: Right arrow position, width and height-->
<ArrowRightX>1170</ArrowRightX>
<ArrowRightY>225</ArrowRightY>
<ArrowRightZ>0,00</ArrowRightZ>
<ArrowRightW>40</ArrowRightW>
<ArrowRightH>40</ArrowRightH>
<!--<Color>: SelectSlide color from ColorScheme (high priority)-->
<!--or <R>, <G>, <B>, <A> (lower priority)-->
<Color>SelectSlideColor</Color>
<!--<SColor>: Selected SelectSlide color from ColorScheme (high priority)-->
<!--or <SR>, <SG>, <SB>, <SA> (lower priority)-->
<SColor>SelectSlideSColor</SColor>
<!--<HColor>: Highlighted SelectSlide color from ColorScheme (high priority)-->
<!--or <HR>, <HG>, <HB>, <HA> (lower priority)-->
<HColor>SelectSlideHColor</HColor>
<!--<ArrowColor>: Arrow color from ColorScheme (high priority)-->
<!--or <ArrowR>, <ArrowG>, <ArrowB>, <ArrowA> (lower priority)-->
<ArrowColor>ArrowColor</ArrowColor>
<!--<ArrowSColor>: Selected arrow color from ColorScheme (high priority)-->
<!--or <ArrowSR>, <ArrowSG>, <ArrowSB>, <ArrowSA> (lower priority)-->
<ArrowSColor>ArrowSColor</ArrowSColor>
<!--<TextColor>: Text color from ColorScheme (high priority)-->
<!--or <TextR>, <TextG>, <TextB>, <TextA> (lower priority)-->
<TextColor>TextColor</TextColor>
<!--<TextSColor>: Selected text color from ColorScheme (high priority)-->
<!--or <TextSR>, <TextSG>, <TextSB>, <TextSA> (lower priority)-->
<TextSColor>TextSColor</TextSColor>
<!--<TextH>: Text height-->
<TextH>32,00</TextH>
<!--<TextMaxW>: Maximum text width (if exists)-->
<TextMaxW>205,33</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>
</SelectSlideBackgroundMusicSource>
</ScreenOptionsSound>
</root>
+87 -39
View File
@@ -5,45 +5,33 @@ using System.IO;
using Vocaluxe.Base;
using System.Diagnostics;
using Vocaluxe.Lib.Song;
namespace Vocaluxe.Base
{
static class CBackgroundMusic
{
private static CHelper Helper = new CHelper();
private static List<int> _BackgroundMusicStreams = new List<int>();
private static int _CurrentMusicStream;
private static int _CurrentStreamListIndex = 0;
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 bool _OwnMusicAdded;
private static bool _BackgroundMusicAdded;
public static void Init()
{
List<string> files = new List<string>();
files.AddRange(Helper.ListFiles(CSettings.sFolderBackgroundMusic, "*.mp3", true, true));
files.AddRange(Helper.ListFiles(CSettings.sFolderBackgroundMusic, "*.wav", true, true));
files.AddRange(Helper.ListFiles(CSettings.sFolderBackgroundMusic, "*.ogg", true, true));
files.AddRange(Helper.ListFiles(CSettings.sFolderBackgroundMusic, "*.wma", true, true));
foreach (string file in files)
{
_BackgroundMusicStreams.Add(CSound.Load(file));
}
if(_BackgroundMusicStreams.Count > 0)
_CurrentMusicStream = _BackgroundMusicStreams[0];
if(CConfig.BackgroundMusicSource == EBackgroundMusicSource.TR_CONFIG_NO_OWN_MUSIC || CConfig.BackgroundMusicSource == EBackgroundMusicSource.TR_CONFIG_OWN_MUSIC)
AddBackgroundMusic();
}
public static void Play()
{
if (CConfig.BackgroundMusic == EOffOn.TR_CONFIG_ON)
{
if(_BackgroundMusicStreams.Count == 1)
{
CSound.Fade(_BackgroundMusicStreams[0], CConfig.BackgroundMusicVolume, CConfig.FadeTime);
CSound.Play(_BackgroundMusicStreams[0], true);
}
else if (_BackgroundMusicStreams.Count > 1)
if (_BackgroundMusicFileNames.Count > 0)
{
CSound.Fade(_CurrentMusicStream, CConfig.BackgroundMusicVolume, CConfig.FadeTime);
CSound.Play(_CurrentMusicStream);
@@ -53,19 +41,19 @@ namespace Vocaluxe.Base
public static void Stop()
{
if(_BackgroundMusicStreams.Count > 0)
CSound.FadeAndStop(_BackgroundMusicStreams[_CurrentStreamListIndex], CConfig.BackgroundMusicVolume, CConfig.FadeTime);
if (_BackgroundMusicFileNames.Count > 0)
CSound.FadeAndStop(_CurrentMusicStream, CConfig.BackgroundMusicVolume, CConfig.FadeTime);
}
public static void Pause()
{
if (_BackgroundMusicStreams.Count > 0)
CSound.FadeAndPause(_BackgroundMusicStreams[_CurrentStreamListIndex], 0, CConfig.FadeTime);
if (_BackgroundMusicFileNames.Count > 0)
CSound.FadeAndPause(_CurrentMusicStream, 0, CConfig.FadeTime);
}
public static void Update()
{
if (_BackgroundMusicStreams.Count > 1)
if (_BackgroundMusicFileNames.Count > 0)
{
float timeToPlay = CSound.GetLength(_CurrentMusicStream) - CSound.GetPosition(_CurrentMusicStream);
if (_FadeTimer.ElapsedMilliseconds >= CConfig.FadeTime * 1000)
@@ -76,25 +64,85 @@ namespace Vocaluxe.Base
if ((timeToPlay <= CConfig.FadeTime) && !_Fading)
{
_FadeTimer.Start();
CSound.Fade(_CurrentMusicStream, 0, CConfig.FadeTime);
_CurrentStreamListIndex++;
if (_CurrentStreamListIndex + 1 > _BackgroundMusicStreams.Count)
{
_CurrentStreamListIndex = 0;
_CurrentMusicStream = _BackgroundMusicStreams[_CurrentStreamListIndex];
}
else
_CurrentMusicStream = _BackgroundMusicStreams[_CurrentStreamListIndex];
CSound.SetPosition(_CurrentMusicStream, 0);
Play();
Next();
_Fading = true;
}
}
}
public static void Next()
{
if (_BackgroundMusicFileNames.Count > 0)
{
if (_CurrentMusicStream != -1)
CSound.FadeAndStop(_CurrentMusicStream, 0, CConfig.FadeTime);
_CurrentBackgroundMusicFileNameIndex = _Random.Next(_BackgroundMusicFileNames.Count);
_CurrentMusicStream = CSound.Load(_BackgroundMusicFileNames[_CurrentBackgroundMusicFileNameIndex]);
Play();
}
else if (_BackgroundMusicAdded || _OwnMusicAdded)
{
if (_CurrentMusicStream != -1)
CSound.FadeAndStop(_CurrentMusicStream, 0, CConfig.FadeTime);
}
}
public static void ApplyVolume()
{
CSound.SetStreamVolume(_BackgroundMusicStreams[_CurrentStreamListIndex], CConfig.BackgroundMusicVolume);
CSound.Fade(_CurrentMusicStream, CConfig.BackgroundMusicVolume, CConfig.FadeTime);
}
public static void AddOwnMusic()
{
if (!_OwnMusicAdded)
{
foreach (CSong song in CSongs.AllSongs)
{
_BackgroundMusicFileNames.Add(song.GetMP3());
}
}
_OwnMusicAdded = true;
Next();
}
public static void RemoveOwnMusic()
{
foreach (CSong song in CSongs.AllSongs)
{
_BackgroundMusicFileNames.Remove(song.GetMP3());
}
_OwnMusicAdded = false;
}
public static void AddBackgroundMusic()
{
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));
_BackgroundMusicAdded = true;
Next();
}
}
public static void RemoveBackgroundMusic()
{
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);
}
_BackgroundMusicAdded = false;
}
}
}
}
+13
View File
@@ -134,6 +134,14 @@ namespace Vocaluxe.Base
TR_CONFIG_TIMERLOOK_NORMAL,
TR_CONFIG_TIMERLOOK_EXPANDED
}
public enum EBackgroundMusicSource
{
TR_CONFIG_NO_OWN_MUSIC,
TR_CONFIG_ONLY_OWN_MUSIC,
TR_CONFIG_OWN_MUSIC
}
#endregion Enums
static class CConfig
@@ -175,6 +183,7 @@ namespace Vocaluxe.Base
public static uint PortAudioBufferSize = 1024;
public static int BackgroundMusicVolume = 50;
public static EOffOn BackgroundMusic = EOffOn.TR_CONFIG_ON;
public static EBackgroundMusicSource BackgroundMusicSource = EBackgroundMusicSource.TR_CONFIG_NO_OWN_MUSIC;
// Game
public static List<string> SongFolder = new List<string>();
@@ -286,6 +295,7 @@ namespace Vocaluxe.Base
CHelper.TryGetEnumValueFromXML<ERecordLib>("//root/Sound/RecordLib", navigator, ref RecordLib);
CHelper.TryGetEnumValueFromXML("//root/Sound/BackgroundMusic", navigator, ref BackgroundMusic);
CHelper.TryGetIntValueFromXML("//root/Sound/BackgroundMusicVolume", navigator, ref BackgroundMusicVolume);
CHelper.TryGetEnumValueFromXML("//root/Sound/BackgroundMusicSource", navigator, ref BackgroundMusicSource);
#endregion Sound
#region Game
@@ -483,6 +493,9 @@ namespace Vocaluxe.Base
writer.WriteComment("Background Music Volume from 0 to 100");
writer.WriteElementString("BackgroundMusicVolume", BackgroundMusicVolume.ToString());
writer.WriteComment("Background Music Source");
writer.WriteElementString("BackgroundMusicSource", Enum.GetName(typeof(EBackgroundMusicSource), BackgroundMusicSource));
writer.WriteEndElement();
#endregion Sound
+2
View File
@@ -87,6 +87,8 @@ namespace Vocaluxe
CBackgroundMusic.Init();
CLog.StopBenchmark(0, "Init Background Music");
Application.DoEvents();
// Init Profiles
CLog.StartBenchmark(0, "Init Profiles");
CProfiles.Init();
+2
View File
@@ -190,6 +190,8 @@ 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()
+22 -1
View File
@@ -16,6 +16,7 @@ namespace Vocaluxe.Screens
private const string SelectSlideBackgroundMusic = "SelectSlideBackgroundMusic";
private const string SelectSlideBackgroundMusicVolume = "SelectSlideBackgroundMusicVolume";
private const string SelectSlideBackgroundMusicSource = "SelectSlideBackgroundMusicSource";
private const string ButtonExit = "ButtonExit";
@@ -35,7 +36,7 @@ namespace Vocaluxe.Screens
_ScreenVersion = ScreenVersion;
_ThemeButtons = new string[] { ButtonExit };
_ThemeSelectSlides = new string[] { SelectSlideBackgroundMusic, SelectSlideBackgroundMusicVolume };
_ThemeSelectSlides = new string[] { SelectSlideBackgroundMusic, SelectSlideBackgroundMusicVolume, SelectSlideBackgroundMusicSource };
}
public override void LoadTheme()
@@ -44,6 +45,8 @@ namespace Vocaluxe.Screens
SelectSlides[htSelectSlides(SelectSlideBackgroundMusic)].SetValues<EOffOn>((int)CConfig.BackgroundMusic);
SelectSlides[htSelectSlides(SelectSlideBackgroundMusicVolume)].AddValues(new string[] { "0", "5", "10", "15", "20", "25", "30", "35", "40", "45", "50", "55", "60", "65", "70", "75", "80", "85", "90", "95", "100"});
SelectSlides[htSelectSlides(SelectSlideBackgroundMusicVolume)].Selection = CConfig.BackgroundMusicVolume / 5;
SelectSlides[htSelectSlides(SelectSlideBackgroundMusicSource)].SetValues<EBackgroundMusicSource>((int)CConfig.BackgroundMusicSource);
SelectSlides[htSelectSlides(SelectSlideBackgroundMusicSource)].Selection = (int)CConfig.BackgroundMusicSource;
}
public override bool HandleInput(KeyEvent KeyEvent)
@@ -137,6 +140,24 @@ namespace Vocaluxe.Screens
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();
}
}