From 4420a11b08fd31242c20d029cf6a85cfd19ef86a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20K=C3=BCpper?= Date: Sat, 23 Feb 2013 14:03:57 +0100 Subject: [PATCH] Fixed video in bg-music with start-tag. --- Vocaluxe/Base/CBackgroundMusic.cs | 38 +++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/Vocaluxe/Base/CBackgroundMusic.cs b/Vocaluxe/Base/CBackgroundMusic.cs index c758b1c9..d214a442 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) + CSound.SetPosition(_CurrentMusicStream, _CurrentPlaylistElement.Start); + else + CSound.SetPosition(_CurrentMusicStream, 0); if (_VideoEnabled && _Video != -1) - CVideo.VdSkip(_Video, 0f, _CurrentPlaylistElement.VideoGap); + if (_CurrentPlaylistElement.Start != 0f) + CVideo.VdSkip(_Video, _CurrentPlaylistElement.Start, _CurrentPlaylistElement.VideoGap); + else + CVideo.VdSkip(_Video, 0f, _CurrentPlaylistElement.VideoGap); } else Next(); @@ -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) + CSound.SetPosition(_CurrentMusicStream, _CurrentPlaylistElement.Start); + else + CSound.SetPosition(_CurrentMusicStream, 0); if (_VideoEnabled && _Video != -1) - CVideo.VdSkip(_Video, 0f, _CurrentPlaylistElement.VideoGap); + if(_CurrentPlaylistElement.Start != 0f) + 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) + CSound.SetPosition(_CurrentMusicStream, _CurrentPlaylistElement.Start); + else + CSound.SetPosition(_CurrentMusicStream, 0); if (_VideoEnabled && _Video != -1) - CVideo.VdSkip(_Video, 0f, _CurrentPlaylistElement.VideoGap); + if (_CurrentPlaylistElement.Start != 0f) + CVideo.VdSkip(_Video, _CurrentPlaylistElement.Start, _CurrentPlaylistElement.VideoGap); + else + CVideo.VdSkip(_Video, 0f, _CurrentPlaylistElement.VideoGap); } } @@ -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) + CVideo.VdSkip(_Video, _CurrentPlaylistElement.Start, _CurrentPlaylistElement.VideoGap); + else + CVideo.VdSkip(_Video, 0f, _CurrentPlaylistElement.VideoGap); _VideoEnabled = true; _FadeTimer.Reset(); _FadeTimer.Start();