From f2bd61937fb6900430b5e2501f2278685d26aac5 Mon Sep 17 00:00:00 2001 From: Flamefire Date: Fri, 1 Aug 2014 16:26:21 +0200 Subject: [PATCH] Loop preview song and video --- Vocaluxe/Base/CMain.cs | 5 +++++ VocaluxeLib/IBasic.cs | 9 +++++---- VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs | 3 ++- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Vocaluxe/Base/CMain.cs b/Vocaluxe/Base/CMain.cs index f8d0b073..a47c74a7 100644 --- a/Vocaluxe/Base/CMain.cs +++ b/Vocaluxe/Base/CMain.cs @@ -769,6 +769,11 @@ namespace Vocaluxe.Base { return CVideo.Close(videoStream); } + + public void SetLoop(int streamID, bool loop = true) + { + CVideo.SetLoop(streamID, loop); + } } class CBsound : ISound diff --git a/VocaluxeLib/IBasic.cs b/VocaluxeLib/IBasic.cs index 739bbdf7..9d84374d 100644 --- a/VocaluxeLib/IBasic.cs +++ b/VocaluxeLib/IBasic.cs @@ -248,10 +248,11 @@ namespace VocaluxeLib public interface IVideo { int Load(string videoFileName); - bool Skip(int videoStream, float startPosition, float videoGap); - bool GetFrame(int videoStream, ref CTexture videoTexture, float time, out float videoTime); - bool IsFinished(int videoStream); - bool Close(int videoStream); + bool Skip(int streamID, float startPosition, float videoGap); + bool GetFrame(int streamID, ref CTexture videoTexture, float time, out float videoTime); + bool IsFinished(int streamID); + bool Close(int streamID); + void SetLoop(int streamID, bool loop = true); } public interface ISound diff --git a/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs b/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs index 8677cc92..e7f260f9 100644 --- a/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs +++ b/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs @@ -524,7 +524,7 @@ namespace VocaluxeLib.Menu.SongMenu return; //TODO: Using prescan here causes Vocaluxe to hang a bit on loading the song but we need the length below - int stream = CBase.Sound.Load(Path.Combine(song.Folder, song.MP3FileName), false, true); + int stream = CBase.Sound.Load(Path.Combine(song.Folder, song.MP3FileName), true, true); float startposition = song.Preview.StartTime; float length = CBase.Sound.GetLength(stream); @@ -551,6 +551,7 @@ namespace VocaluxeLib.Menu.SongMenu _PreviewVideoStream = CBase.Video.Load(Path.Combine(song.Folder, song.VideoFileName)); if (_PreviewVideoStream == -1) return; + CBase.Video.SetLoop(_PreviewVideoStream); CBase.Video.Skip(_PreviewVideoStream, startposition, song.VideoGap); _VideoFading = new CFading(0f, 1f, 3f); }