diff --git a/Vocaluxe/Base/CBackgroundMusic.cs b/Vocaluxe/Base/CBackgroundMusic.cs index d4cf5f60..e65d5c78 100644 --- a/Vocaluxe/Base/CBackgroundMusic.cs +++ b/Vocaluxe/Base/CBackgroundMusic.cs @@ -310,6 +310,19 @@ namespace Vocaluxe.Base _PlaysPreview = true; _PreviewPlayer.Load(song, start); + + float startposition = song.Preview.StartTime; + + float length = _PreviewPlayer.Length; + + if (song.Preview.Source == EDataSource.None) + startposition = length / 4f; + else if (startposition > length - 5f) + startposition = Math.Max(0f, Math.Min(length / 4f, length - 5f)); + + _PreviewPlayer.Position = startposition; + + Play(); } public static void PlayPreview(float start = -1f) diff --git a/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs b/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs index b2cd1f92..e2ad5ae6 100644 --- a/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs +++ b/VocaluxeLib/Menu/SongMenu/CSongMenuFramework.cs @@ -507,17 +507,6 @@ namespace VocaluxeLib.Menu.SongMenu return; CBase.BackgroundMusic.LoadPreview(song); - - float startposition = song.Preview.StartTime; - - float length = CBase.BackgroundMusic.GetLength(); - - if (song.Preview.Source == EDataSource.None) - startposition = length / 4f; - else if (startposition > length - 5f) - startposition = Math.Max(0f, Math.Min(length / 4f, length - 5f)); - - CBase.BackgroundMusic.PlayPreview(startposition); } protected void _ResetPreview() diff --git a/VocaluxeLib/Songs/CSongLoader.cs b/VocaluxeLib/Songs/CSongLoader.cs index 334089d2..0e06ab45 100644 --- a/VocaluxeLib/Songs/CSongLoader.cs +++ b/VocaluxeLib/Songs/CSongLoader.cs @@ -416,6 +416,7 @@ namespace VocaluxeLib.Songs { //PreviewStart is not set or <=0 _Song.Preview.StartTime = (headerFlags & EHeaderFlags.MedleyStartBeat) != 0 ? CBase.Game.GetTimeFromBeats(_Song.Medley.StartBeat, _Song.BPM) : 0f; + _Song.Preview.Source = EDataSource.Calculated; } if ((headerFlags & EHeaderFlags.MedleyStartBeat) != 0 && (headerFlags & EHeaderFlags.MedleyEndBeat) != 0)