Some changes to preview-start.

This commit is contained in:
Florian Küpper committed 2014-08-20 19:10:13 +02:00
1 parent c6e8854dda
commit d0958b69be
3 files changed
+14 -11

No files matched your search

+13
View File
@@ -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)
@@ -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()
+1
View File
@@ -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)