Background music is now using #Start and #End tags, if found
This commit is contained in:
1 parent
fefd81c506
commit
e624792490
1 file changed
+33
-1
@@ -217,7 +217,12 @@ namespace Vocaluxe.Base
|
||||
{
|
||||
if (_AllFileNames.Count > 0 && _CurrentMusicStream != -1)
|
||||
{
|
||||
float timeToPlay = CSound.GetLength(_CurrentMusicStream) - CSound.GetPosition(_CurrentMusicStream);
|
||||
float timeToPlay;
|
||||
if(_CurrentPlaylistElement.Finish == 0f) //No End-Tag defined
|
||||
timeToPlay = CSound.GetLength(_CurrentMusicStream) - CSound.GetPosition(_CurrentMusicStream);
|
||||
else //End-Tag found
|
||||
timeToPlay = _CurrentPlaylistElement.Finish - CSound.GetPosition(_CurrentMusicStream);
|
||||
|
||||
bool finished = CSound.IsFinished(_CurrentMusicStream);
|
||||
if (_Playing && (timeToPlay <= CSettings.BackgroundMusicFadeTime || finished))
|
||||
Next();
|
||||
@@ -248,6 +253,11 @@ namespace Vocaluxe.Base
|
||||
_CurrentPlaylistElement = _PreviousFileNames[_PreviousMusicIndex];
|
||||
}
|
||||
_CurrentMusicStream = CSound.Load(_CurrentPlaylistElement.MusicFilePath);
|
||||
|
||||
//Seek to #Start-Tag, if found
|
||||
if (_CurrentPlaylistElement.Start != 0f)
|
||||
CSound.SetPosition(_CurrentMusicStream, _CurrentPlaylistElement.Start);
|
||||
|
||||
if (_VideoEnabled)
|
||||
LoadVideo();
|
||||
CSound.SetStreamVolume(_CurrentMusicStream, 0f);
|
||||
@@ -524,6 +534,28 @@ class PlaylistElement
|
||||
}
|
||||
}
|
||||
|
||||
public float Start
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_Song != null)
|
||||
return _Song.Start;
|
||||
|
||||
return 0f;
|
||||
}
|
||||
}
|
||||
|
||||
public float Finish
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_Song != null)
|
||||
return _Song.Finish;
|
||||
|
||||
return 0f;
|
||||
}
|
||||
}
|
||||
|
||||
public STexture Cover
|
||||
{
|
||||
get
|
||||
|
||||
Reference in new issue
Block a user