Some changes to preview-start.
This commit is contained in:
1 parent
c6e8854dda
commit
d0958b69be
3 files changed
+14
-11
No files matched your search
@@ -310,6 +310,19 @@ namespace Vocaluxe.Base
|
|||||||
|
|
||||||
_PlaysPreview = true;
|
_PlaysPreview = true;
|
||||||
_PreviewPlayer.Load(song, start);
|
_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)
|
public static void PlayPreview(float start = -1f)
|
||||||
|
|||||||
@@ -507,17 +507,6 @@ namespace VocaluxeLib.Menu.SongMenu
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
CBase.BackgroundMusic.LoadPreview(song);
|
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()
|
protected void _ResetPreview()
|
||||||
|
|||||||
@@ -416,6 +416,7 @@ namespace VocaluxeLib.Songs
|
|||||||
{
|
{
|
||||||
//PreviewStart is not set or <=0
|
//PreviewStart is not set or <=0
|
||||||
_Song.Preview.StartTime = (headerFlags & EHeaderFlags.MedleyStartBeat) != 0 ? CBase.Game.GetTimeFromBeats(_Song.Medley.StartBeat, _Song.BPM) : 0f;
|
_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)
|
if ((headerFlags & EHeaderFlags.MedleyStartBeat) != 0 && (headerFlags & EHeaderFlags.MedleyEndBeat) != 0)
|
||||||
|
|||||||
Reference in new issue
Block a user