From 21f6213c1a7164862fe434fc3931e8f0e61a73df Mon Sep 17 00:00:00 2001 From: Flamefire Date: Sat, 19 Oct 2013 02:04:58 +0200 Subject: [PATCH] Fix preview start after song end --- VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs b/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs index 4f84bfae..ee760202 100644 --- a/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs +++ b/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs @@ -537,9 +537,12 @@ namespace VocaluxeLib.Menu.SongMenu CBase.Sound.SetStreamVolume(stream, 0f); float startposition = song.PreviewStart; + float length = CBase.Sound.GetLength(stream); if (startposition < 0.001) - startposition = CBase.Sound.GetLength(stream) / 4f; + startposition = length / 4f; + else if (startposition > length - 5f) + startposition = Math.Max(0f, Math.Min(length / 4f, length - 5f)); if (startposition >= 0.5f) startposition -= 0.5f;