From e20bd7093f285b6c19360ece912267e67036ad57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20K=C3=BCpper?= Date: Sat, 23 Feb 2013 14:13:49 +0100 Subject: [PATCH] Added option to config.xml for switching bg-music start-tag behavior. --- Vocaluxe/Base/CBackgroundMusic.cs | 16 ++++++++-------- Vocaluxe/Base/CConfig.cs | 5 +++++ 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/Vocaluxe/Base/CBackgroundMusic.cs b/Vocaluxe/Base/CBackgroundMusic.cs index d214a442..3e11de56 100644 --- a/Vocaluxe/Base/CBackgroundMusic.cs +++ b/Vocaluxe/Base/CBackgroundMusic.cs @@ -247,12 +247,12 @@ namespace Vocaluxe.Base if (_RepeatSong) { //Seek to #Start-Tag, if found - if (_CurrentPlaylistElement.Start != 0f) + if (_CurrentPlaylistElement.Start != 0f && CConfig.BackgroundMusicUseStart == EOffOn.TR_CONFIG_ON) CSound.SetPosition(_CurrentMusicStream, _CurrentPlaylistElement.Start); else CSound.SetPosition(_CurrentMusicStream, 0); if (_VideoEnabled && _Video != -1) - if (_CurrentPlaylistElement.Start != 0f) + if (_CurrentPlaylistElement.Start != 0f && CConfig.BackgroundMusicUseStart == EOffOn.TR_CONFIG_ON) CVideo.VdSkip(_Video, _CurrentPlaylistElement.Start, _CurrentPlaylistElement.VideoGap); else CVideo.VdSkip(_Video, 0f, _CurrentPlaylistElement.VideoGap); @@ -290,7 +290,7 @@ namespace Vocaluxe.Base CSound.SetStreamVolumeMax(_CurrentMusicStream, CConfig.BackgroundMusicVolume); //Seek to #Start-Tag, if found - if (_CurrentPlaylistElement.Start != 0f) + if (_CurrentPlaylistElement.Start != 0f && CConfig.BackgroundMusicUseStart == EOffOn.TR_CONFIG_ON) CSound.SetPosition(_CurrentMusicStream, _CurrentPlaylistElement.Start); if (_VideoEnabled) @@ -310,12 +310,12 @@ namespace Vocaluxe.Base if (CSound.GetPosition(_CurrentMusicStream) >= 1.5f) { //Seek to #Start-Tag, if found - if (_CurrentPlaylistElement.Start != 0f) + if (_CurrentPlaylistElement.Start != 0f && CConfig.BackgroundMusicUseStart == EOffOn.TR_CONFIG_ON) CSound.SetPosition(_CurrentMusicStream, _CurrentPlaylistElement.Start); else CSound.SetPosition(_CurrentMusicStream, 0); if (_VideoEnabled && _Video != -1) - if(_CurrentPlaylistElement.Start != 0f) + if (_CurrentPlaylistElement.Start != 0f && CConfig.BackgroundMusicUseStart == EOffOn.TR_CONFIG_ON) CVideo.VdSkip(_Video, _CurrentPlaylistElement.Start, _CurrentPlaylistElement.VideoGap); else CVideo.VdSkip(_Video, 0f, _CurrentPlaylistElement.VideoGap); @@ -340,12 +340,12 @@ namespace Vocaluxe.Base else if (_CurrentMusicStream != -1) { //Seek to #Start-Tag, if found - if (_CurrentPlaylistElement.Start != 0f) + if (_CurrentPlaylistElement.Start != 0f && CConfig.BackgroundMusicUseStart == EOffOn.TR_CONFIG_ON) CSound.SetPosition(_CurrentMusicStream, _CurrentPlaylistElement.Start); else CSound.SetPosition(_CurrentMusicStream, 0); if (_VideoEnabled && _Video != -1) - if (_CurrentPlaylistElement.Start != 0f) + if (_CurrentPlaylistElement.Start != 0f && CConfig.BackgroundMusicUseStart == EOffOn.TR_CONFIG_ON) CVideo.VdSkip(_Video, _CurrentPlaylistElement.Start, _CurrentPlaylistElement.VideoGap); else CVideo.VdSkip(_Video, 0f, _CurrentPlaylistElement.VideoGap); @@ -519,7 +519,7 @@ namespace Vocaluxe.Base if (_Video == -1) { _Video = CVideo.VdLoad(_CurrentPlaylistElement.VideoFilePath); - if (_CurrentPlaylistElement.Start != 0f) + if (_CurrentPlaylistElement.Start != 0f && CConfig.BackgroundMusicUseStart == EOffOn.TR_CONFIG_ON) CVideo.VdSkip(_Video, _CurrentPlaylistElement.Start, _CurrentPlaylistElement.VideoGap); else CVideo.VdSkip(_Video, 0f, _CurrentPlaylistElement.VideoGap); diff --git a/Vocaluxe/Base/CConfig.cs b/Vocaluxe/Base/CConfig.cs index 624876ab..3a105d83 100644 --- a/Vocaluxe/Base/CConfig.cs +++ b/Vocaluxe/Base/CConfig.cs @@ -64,6 +64,7 @@ namespace Vocaluxe.Base public static int BackgroundMusicVolume = 30; public static EOffOn BackgroundMusic = EOffOn.TR_CONFIG_ON; public static EBackgroundMusicSource BackgroundMusicSource = EBackgroundMusicSource.TR_CONFIG_NO_OWN_MUSIC; + public static EOffOn BackgroundMusicUseStart = EOffOn.TR_CONFIG_ON; public static int PreviewMusicVolume = 50; public static int GameMusicVolume = 80; @@ -179,6 +180,7 @@ namespace Vocaluxe.Base xmlReader.TryGetEnumValue("//root/Sound/BackgroundMusic", ref BackgroundMusic); xmlReader.TryGetIntValueRange("//root/Sound/BackgroundMusicVolume", ref BackgroundMusicVolume); xmlReader.TryGetEnumValue("//root/Sound/BackgroundMusicSource", ref BackgroundMusicSource); + xmlReader.TryGetEnumValue("//root/Sound/BackgroundMusicUseStart", ref BackgroundMusicUseStart); xmlReader.TryGetIntValueRange("//root/Sound/PreviewMusicVolume", ref PreviewMusicVolume); xmlReader.TryGetIntValueRange("//root/Sound/GameMusicVolume", ref GameMusicVolume); #endregion Sound @@ -411,6 +413,9 @@ namespace Vocaluxe.Base writer.WriteComment("Background Music Source"); writer.WriteElementString("BackgroundMusicSource", Enum.GetName(typeof(EBackgroundMusicSource), BackgroundMusicSource)); + writer.WriteComment("Background Music use start-tag of songs"); + writer.WriteElementString("BackgroundMusicUseStart", Enum.GetName(typeof(EOffOn), BackgroundMusicUseStart)); + writer.WriteComment("Preview Volume from 0 to 100"); writer.WriteElementString("PreviewMusicVolume", PreviewMusicVolume.ToString());