diff --git a/Output/Themes/Ambient/Screens/PopupScreenPlayerControl.xml b/Output/Themes/Ambient/Screens/PopupScreenPlayerControl.xml index ea900e44..6affc5e0 100644 --- a/Output/Themes/Ambient/Screens/PopupScreenPlayerControl.xml +++ b/Output/Themes/Ambient/Screens/PopupScreenPlayerControl.xml @@ -316,13 +316,60 @@ + + + VideoIcon + + VideoIcon + + 480 + 0 + 0,00 + 50 + 50 + + + ButtonColor + + + ButtonSColor + + + 315 + 0 + + 32 + + 142 + + + ButtonTextColor + + + ButtonTextSColor + + Center + + + + Normal + + + + + + + + + + DuetIcon DuetIcon - 480 + 555 0 0,00 50 @@ -365,14 +412,14 @@ - 555 + 630 0 0,00 50 - 725 + 650 StaticColor diff --git a/Vocaluxe/Base/CBackgroundMusic.cs b/Vocaluxe/Base/CBackgroundMusic.cs index b4f2179e..7f8098fc 100644 --- a/Vocaluxe/Base/CBackgroundMusic.cs +++ b/Vocaluxe/Base/CBackgroundMusic.cs @@ -28,6 +28,7 @@ namespace Vocaluxe.Base private static bool _BackgroundMusicAdded; private static bool _Playing; private static bool _VideoEnabled; + private static bool _VideoToBackground; private static int _Video = -1; private static STexture _CurrentVideoTexture = new STexture(-1); @@ -314,7 +315,7 @@ namespace Vocaluxe.Base LoadVideo(); } - public static bool UploadNewFrame(CStatic bounds) + public static STexture GetVideoTexture() { if (_Video != -1) { @@ -329,10 +330,9 @@ namespace Vocaluxe.Base _CurrentVideoTexture.color.A = 1f; _FadeTimer.Stop(); } - CDraw.DrawTexture(bounds, _CurrentVideoTexture, EAspect.Crop); - return true; + return _CurrentVideoTexture; } - return false; + return new STexture(-1); } public static int GetSongNr() @@ -350,6 +350,11 @@ namespace Vocaluxe.Base return _VideoEnabled; } + public static bool VideoToBackgroundIsEnabled() + { + return _VideoToBackground; + } + public static bool HasVideo() { return File.Exists(_CurrentPlaylistElement.GetVideoFilePath()); @@ -376,6 +381,12 @@ namespace Vocaluxe.Base _FadeTimer.Start(); } } + + public static void ToggleVideoToBackground() + { + ToggleVideo(); + _VideoToBackground = !_VideoToBackground; + } } } diff --git a/Vocaluxe/Menu/CBackground.cs b/Vocaluxe/Menu/CBackground.cs index c6adfa33..e1be78ce 100644 --- a/Vocaluxe/Menu/CBackground.cs +++ b/Vocaluxe/Menu/CBackground.cs @@ -140,6 +140,9 @@ namespace Vocaluxe.Menu if (_Theme.Type == EBackgroundTypes.Video && CConfig.VideoBackgrounds == EOffOn.TR_CONFIG_ON) ok = DrawVideo(); + if (_Theme.Type == EBackgroundTypes.Video && CConfig.VideoBackgrounds == EOffOn.TR_CONFIG_ON && CBackgroundMusic.VideoToBackgroundIsEnabled() && CBackgroundMusic.IsPlaying() && CBackgroundMusic.HasVideo()) + ok = DrawBackgroundMusicVideo(); + if (_Theme.TextureName != String.Empty && (_Theme.Type == EBackgroundTypes.Texture || (_Theme.Type == EBackgroundTypes.Video && (CConfig.VideoBackgrounds == EOffOn.TR_CONFIG_OFF || !ok)))) @@ -206,6 +209,21 @@ namespace Vocaluxe.Menu } return false; } + + private bool DrawBackgroundMusicVideo() + { + STexture VideoTexture = CBackgroundMusic.GetVideoTexture(); + if (VideoTexture.height > 0) + { + RectangleF bounds = new RectangleF(0f, 0f, CSettings.iRenderW, CSettings.iRenderH); + RectangleF rect = new RectangleF(0f, 0f, VideoTexture.width, VideoTexture.height); + CHelper.SetRect(bounds, ref rect, rect.Width / rect.Height, EAspect.Crop); + + CDraw.DrawTexture(VideoTexture, new SRectF(rect.X, rect.Y, rect.Width, rect.Height, CSettings.zFar / 4)); + return true; + } + return false; + } #endregion internal #region ThemeEdit diff --git a/Vocaluxe/Screens/CPopupScreenPlayerControl.cs b/Vocaluxe/Screens/CPopupScreenPlayerControl.cs index 18cc6690..79188bbe 100644 --- a/Vocaluxe/Screens/CPopupScreenPlayerControl.cs +++ b/Vocaluxe/Screens/CPopupScreenPlayerControl.cs @@ -26,6 +26,7 @@ namespace Vocaluxe.Screens private const string ButtonRepeat = "ButtonRepeat"; private const string ButtonShowVideo = "ButtonShowVideo"; private const string ButtonSing = "ButtonSing"; + private const string ButtonToBackgroundVideo = "ButtonToBackgroundVideo"; private const string TextCurrentSong = "TextCurrentSong"; @@ -52,6 +53,7 @@ namespace Vocaluxe.Screens buttons.Add(ButtonRepeat); buttons.Add(ButtonShowVideo); buttons.Add(ButtonSing); + buttons.Add(ButtonToBackgroundVideo); _ThemeButtons = buttons.ToArray(); } @@ -93,6 +95,8 @@ namespace Vocaluxe.Screens CBackgroundMusic.ToggleVideo(); if (Buttons[htButtons(ButtonSing)].Selected) StartSong(CBackgroundMusic.GetSongNr(), CBackgroundMusic.IsDuet()); + if (Buttons[htButtons(ButtonToBackgroundVideo)].Selected) + CBackgroundMusic.ToggleVideoToBackground(); break; } } @@ -119,6 +123,8 @@ namespace Vocaluxe.Screens CBackgroundMusic.ToggleVideo(); if (Buttons[htButtons(ButtonSing)].Selected) StartSong(CBackgroundMusic.GetSongNr(), CBackgroundMusic.IsDuet()); + if (Buttons[htButtons(ButtonToBackgroundVideo)].Selected) + CBackgroundMusic.ToggleVideoToBackground(); } else if (MouseEvent.LB) { CGraphics.HidePopup(EPopupScreens.PopupPlayerControl); @@ -149,8 +155,8 @@ namespace Vocaluxe.Screens if (CBackgroundMusic.IsVideoEnabled() && CBackgroundMusic.HasVideo()) { Statics[htStatics(StaticCover)].Texture = CBackgroundMusic.GetCover(); - CBackgroundMusic.UploadNewFrame(Statics[htStatics(StaticCover)]); - Statics[htStatics(StaticCover)].Visible = false; + Statics[htStatics(StaticCover)].Visible = true; + CDraw.DrawTexture(Statics[htStatics(StaticCover)], CBackgroundMusic.GetVideoTexture(), EAspect.Crop); } else {