fixed lyric sub fading
This commit is contained in:
1 parent
c377a583da
commit
bd36b3d1d4
1 file changed
+25
-5
@@ -581,7 +581,8 @@ namespace Vocaluxe.Screens
|
||||
|
||||
lines[i] = song.Notes.GetLines(i);
|
||||
CLine[] line = lines[i].Line;
|
||||
|
||||
|
||||
// find current line (it must be the same as in CalcFadingAlpha)
|
||||
int nr = -1;
|
||||
for (int j = 0; j < line.Length; j++)
|
||||
{
|
||||
@@ -850,12 +851,16 @@ namespace Vocaluxe.Screens
|
||||
lines[i] = Song.Notes.GetLines(i);
|
||||
CLine[] line = lines[i].Line;
|
||||
|
||||
// find current line (it must be the same as in UpdateLyrics)
|
||||
int CurrentLine = 0;
|
||||
for (int j = 0; j < line.Length; j++)
|
||||
{
|
||||
if (line[j].FirstBeat <= _CurrentBeat)
|
||||
if (line[j].StartBeat <= _CurrentBeat)
|
||||
{
|
||||
CurrentLine = j;
|
||||
if (CGame.GetTimeFromBeats(line[j].FirstBeat, Song.BPM) <= _CurrentTime - Song.Gap + 10f)
|
||||
{
|
||||
CurrentLine = j;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -863,9 +868,11 @@ namespace Vocaluxe.Screens
|
||||
Alpha[i * 2] = 1f;
|
||||
Alpha[i * 2 + 1] = 1f;
|
||||
|
||||
// main
|
||||
// main line alpha
|
||||
if (CurrentLine == 0 && CurrentTime < CGame.GetTimeFromBeats(line[CurrentLine].FirstBeat, Song.BPM))
|
||||
{
|
||||
// first main line and fist note is not reached
|
||||
// => fade in
|
||||
float diff = CGame.GetTimeFromBeats(line[CurrentLine].FirstBeat, Song.BPM) - CurrentTime;
|
||||
if (diff > dt)
|
||||
{
|
||||
@@ -875,20 +882,29 @@ namespace Vocaluxe.Screens
|
||||
else if (CurrentLine < line.Length - 1 && CGame.GetTimeFromBeats(line[CurrentLine].LastBeat, Song.BPM) < CurrentTime &&
|
||||
CGame.GetTimeFromBeats(line[CurrentLine + 1].FirstBeat, Song.BPM) > CurrentTime)
|
||||
{
|
||||
// current position is between two lines
|
||||
|
||||
// time between the to lines
|
||||
float diff = CGame.GetTimeFromBeats(line[CurrentLine + 1].FirstBeat, Song.BPM) -
|
||||
CGame.GetTimeFromBeats(line[CurrentLine].LastBeat, Song.BPM);
|
||||
|
||||
// fade only if there is enough time for fading
|
||||
if (diff > 3.3f * dt)
|
||||
{
|
||||
// time elapsed since last line
|
||||
float last = CurrentTime - CGame.GetTimeFromBeats(line[CurrentLine].LastBeat, Song.BPM);
|
||||
|
||||
// time to next line
|
||||
float next = CGame.GetTimeFromBeats(line[CurrentLine + 1].FirstBeat, Song.BPM) - CurrentTime;
|
||||
|
||||
if (last < next)
|
||||
{
|
||||
// fade out
|
||||
Alpha[i * 2] = 1f - last / rt;
|
||||
}
|
||||
else
|
||||
{
|
||||
// fade in if it is time for
|
||||
if (next > dt)
|
||||
Alpha[i * 2] = 1f - (next - dt) / rt;
|
||||
}
|
||||
@@ -896,6 +912,8 @@ namespace Vocaluxe.Screens
|
||||
}
|
||||
else if (CurrentLine == line.Length - 1 && CGame.GetTimeFromBeats(line[CurrentLine].LastBeat, Song.BPM) < CurrentTime)
|
||||
{
|
||||
// last main line and last note was reached
|
||||
// => fade out
|
||||
float diff = CurrentTime - CGame.GetTimeFromBeats(line[CurrentLine].LastBeat, Song.BPM);
|
||||
Alpha[i * 2] = 1f - diff / rt;
|
||||
}
|
||||
@@ -903,7 +921,9 @@ namespace Vocaluxe.Screens
|
||||
// sub
|
||||
if (CurrentLine < line.Length - 2)
|
||||
{
|
||||
float diff = CGame.GetTimeFromBeats(line[CurrentLine + 1].FirstBeat, Song.BPM) - CurrentTime;
|
||||
float diff = 0f;
|
||||
diff = CGame.GetTimeFromBeats(line[CurrentLine + 1].FirstBeat, Song.BPM) - CurrentTime;
|
||||
|
||||
if (diff > dt)
|
||||
{
|
||||
Alpha[i * 2 + 1] = 1f - (diff - dt) / rt;
|
||||
|
||||
Reference in new issue
Block a user