diff --git a/Vocaluxe/Base/CBackgroundMusic.cs b/Vocaluxe/Base/CBackgroundMusic.cs index 9284b73c..3e11de56 100644 --- a/Vocaluxe/Base/CBackgroundMusic.cs +++ b/Vocaluxe/Base/CBackgroundMusic.cs @@ -246,9 +246,16 @@ namespace Vocaluxe.Base { if (_RepeatSong) { - CSound.SetPosition(_CurrentMusicStream, 0); + //Seek to #Start-Tag, if found + if (_CurrentPlaylistElement.Start != 0f && CConfig.BackgroundMusicUseStart == EOffOn.TR_CONFIG_ON) + CSound.SetPosition(_CurrentMusicStream, _CurrentPlaylistElement.Start); + else + CSound.SetPosition(_CurrentMusicStream, 0); if (_VideoEnabled && _Video != -1) - CVideo.VdSkip(_Video, 0f, _CurrentPlaylistElement.VideoGap); + if (_CurrentPlaylistElement.Start != 0f && CConfig.BackgroundMusicUseStart == EOffOn.TR_CONFIG_ON) + CVideo.VdSkip(_Video, _CurrentPlaylistElement.Start, _CurrentPlaylistElement.VideoGap); + else + CVideo.VdSkip(_Video, 0f, _CurrentPlaylistElement.VideoGap); } else Next(); @@ -283,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) @@ -302,9 +309,16 @@ namespace Vocaluxe.Base float pos = CSound.GetPosition(_CurrentMusicStream); if (CSound.GetPosition(_CurrentMusicStream) >= 1.5f) { - CSound.SetPosition(_CurrentMusicStream, 0); + //Seek to #Start-Tag, if found + if (_CurrentPlaylistElement.Start != 0f && CConfig.BackgroundMusicUseStart == EOffOn.TR_CONFIG_ON) + CSound.SetPosition(_CurrentMusicStream, _CurrentPlaylistElement.Start); + else + CSound.SetPosition(_CurrentMusicStream, 0); if (_VideoEnabled && _Video != -1) - CVideo.VdSkip(_Video, 0f, _CurrentPlaylistElement.VideoGap); + if (_CurrentPlaylistElement.Start != 0f && CConfig.BackgroundMusicUseStart == EOffOn.TR_CONFIG_ON) + CVideo.VdSkip(_Video, _CurrentPlaylistElement.Start, _CurrentPlaylistElement.VideoGap); + else + CVideo.VdSkip(_Video, 0f, _CurrentPlaylistElement.VideoGap); } else { @@ -325,9 +339,16 @@ namespace Vocaluxe.Base } else if (_CurrentMusicStream != -1) { - CSound.SetPosition(_CurrentMusicStream, 0); + //Seek to #Start-Tag, if found + if (_CurrentPlaylistElement.Start != 0f && CConfig.BackgroundMusicUseStart == EOffOn.TR_CONFIG_ON) + CSound.SetPosition(_CurrentMusicStream, _CurrentPlaylistElement.Start); + else + CSound.SetPosition(_CurrentMusicStream, 0); if (_VideoEnabled && _Video != -1) - CVideo.VdSkip(_Video, 0f, _CurrentPlaylistElement.VideoGap); + if (_CurrentPlaylistElement.Start != 0f && CConfig.BackgroundMusicUseStart == EOffOn.TR_CONFIG_ON) + CVideo.VdSkip(_Video, _CurrentPlaylistElement.Start, _CurrentPlaylistElement.VideoGap); + else + CVideo.VdSkip(_Video, 0f, _CurrentPlaylistElement.VideoGap); } } @@ -392,16 +413,7 @@ namespace Vocaluxe.Base 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) + if (CConfig.BackgroundMusicSource != NewSource || (NewOnOff == EOffOn.TR_CONFIG_ON && !_OwnMusicAdded && !_BackgroundMusicAdded)) { CConfig.BackgroundMusicSource = NewSource; @@ -430,6 +442,15 @@ namespace Vocaluxe.Base } } + if (CConfig.BackgroundMusic != NewOnOff) + { + CConfig.BackgroundMusic = NewOnOff; + if (NewOnOff == EOffOn.TR_CONFIG_ON) + Play(); + else + Pause(); + } + if (CConfig.BackgroundMusicVolume != NewVolume) { CConfig.BackgroundMusicVolume = (int)NewVolume; @@ -498,7 +519,10 @@ namespace Vocaluxe.Base if (_Video == -1) { _Video = CVideo.VdLoad(_CurrentPlaylistElement.VideoFilePath); - CVideo.VdSkip(_Video, 0f, _CurrentPlaylistElement.VideoGap); + if (_CurrentPlaylistElement.Start != 0f && CConfig.BackgroundMusicUseStart == EOffOn.TR_CONFIG_ON) + CVideo.VdSkip(_Video, _CurrentPlaylistElement.Start, _CurrentPlaylistElement.VideoGap); + else + CVideo.VdSkip(_Video, 0f, _CurrentPlaylistElement.VideoGap); _VideoEnabled = true; _FadeTimer.Reset(); _FadeTimer.Start(); 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()); diff --git a/Vocaluxe/Base/CGraphics.cs b/Vocaluxe/Base/CGraphics.cs index 72239bf7..d28a4abd 100644 --- a/Vocaluxe/Base/CGraphics.cs +++ b/Vocaluxe/Base/CGraphics.cs @@ -508,6 +508,11 @@ namespace Vocaluxe.Base && _CurrentScreen != EScreens.ScreenCredits && !CBackgroundMusic.Disabled; bool PopupVolumeControlAllowed = _CurrentScreen != EScreens.ScreenCredits && _CurrentScreen != EScreens.ScreenOptionsRecord; + //Hide volume control for bg-music if bg-music is disabled + if (PopupVolumeControlAllowed && (_CurrentScreen != EScreens.ScreenSong || (_CurrentScreen == EScreens.ScreenSong && CSongs.Category == -1)) + && _CurrentScreen != EScreens.ScreenSing && CConfig.BackgroundMusic == EOffOn.TR_CONFIG_OFF) + PopupVolumeControlAllowed = false; + bool Resume = true; bool EventsAvailable = false; @@ -532,14 +537,9 @@ namespace Vocaluxe.Base HidePopup(EPopupScreens.PopupPlayerControl); } - if (PopupVolumeControlAllowed && CConfig.BackgroundMusic == EOffOn.TR_CONFIG_ON) + if (PopupPlayerControlAllowed && CConfig.BackgroundMusic == EOffOn.TR_CONFIG_ON) { - int Diff = 0; - if ((KeyEvent.ModSHIFT && (KeyEvent.Key == Keys.Add || KeyEvent.Key == Keys.PageUp)) || (KeyEvent.Sender == ESender.WiiMote && KeyEvent.Key == Keys.Add)) - Diff = 5; - else if ((KeyEvent.ModSHIFT && (KeyEvent.Key == Keys.Subtract || KeyEvent.Key == Keys.PageDown)) || (KeyEvent.Sender == ESender.WiiMote && KeyEvent.Key == Keys.Subtract)) - Diff = -5; - else if (KeyEvent.Key == Keys.MediaNextTrack) + if (KeyEvent.Key == Keys.MediaNextTrack) CMain.BackgroundMusic.Next(); else if (KeyEvent.Key == Keys.MediaPreviousTrack) CMain.BackgroundMusic.Previous(); @@ -550,6 +550,15 @@ namespace Vocaluxe.Base else CMain.BackgroundMusic.Play(); } + } + + if (PopupVolumeControlAllowed) + { + int Diff = 0; + if ((KeyEvent.ModSHIFT && (KeyEvent.Key == Keys.Add || KeyEvent.Key == Keys.PageUp)) || (KeyEvent.Sender == ESender.WiiMote && KeyEvent.Key == Keys.Add)) + Diff = 5; + else if ((KeyEvent.ModSHIFT && (KeyEvent.Key == Keys.Subtract || KeyEvent.Key == Keys.PageDown)) || (KeyEvent.Sender == ESender.WiiMote && KeyEvent.Key == Keys.Subtract)) + Diff = -5; if (Diff != 0) {