Added Mic delay in calculation of line breaks

Added config entry for minimal time before text is show
This commit is contained in:
Flamefire committed 2013-02-21 13:11:30 +01:00
1 parent 75451a0a17
commit 1a644ab22c
4 files changed
+61 -25

No files matched your search

+30
View File
@@ -0,0 +1,30 @@
obj
Output/Songs
*.mp4
*.pdb
/Output/Benchmark.log
/Output/CoverDB.sqlite
/Output/HighscoreDB.sqlite
/Output/PartyModes/*/Code/*
/Output/Vocaluxe.exe*
/Output/Vocaluxe.vshost.exe*
/Output/VocaluxeLib.dll
*.psess
/*.vsp
/*.ctl
/Output/Registration.xml
/Vocaluxe.suo
/Vocaluxe/Vocaluxe.csproj.user
/Output/Config.xml
+2
View File
@@ -80,6 +80,8 @@ namespace Vocaluxe.Base
public static string Language = "English";
public static EOffOn LyricsOnTop = EOffOn.TR_CONFIG_OFF;
public static string[] Players = new string[CSettings.MaxNumPlayer];
public static float MinLineBreakTime = 0.1f; //Minimum time to show the text before it is (to be) sung (if possible)
// Video
public static EVideoDecoder VideoDecoder = EVideoDecoder.FFmpeg;
+28 -24
View File
@@ -738,6 +738,30 @@ namespace Vocaluxe.Screens
CWebcam.Close();
}
private int FindCurrentLine(CLine[] line, CSong song)
{
float CurrentTime = _CurrentTime - song.Gap;
//We are only interested in the last matching line, so either do not check further after line[j].StartBeat > _CurrentBeat or go backwards!
for (int j = line.Length - 1; j >= 0; j--)
{
if (line[j].StartBeat <= _CurrentBeat)
{
float FirstNoteTime = CGame.GetTimeFromBeats(line[j].FirstNoteBeat, song.BPM);
//Earlist possible line break is 10s before first note
if (FirstNoteTime <= CurrentTime + 10f)
{
//First line has no predecessor or line has to be shown
if(j == 0 || FirstNoteTime - CConfig.MinLineBreakTime <= CurrentTime) return j;
float LastNoteTime = CGame.GetTimeFromBeats(line[j-1].LastNoteBeat, song.BPM);
//No line break if last line is not fully evaluated (with 50% tolerance -> tested so notes are drawn)
if(LastNoteTime + CConfig.MicDelay/1000f * 1.5f >= CurrentTime) return j-1;
return j;
}
}
}
return -1;
}
private void UpdateLyrics()
{
if (_FadeOut)
@@ -759,18 +783,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++)
{
if (line[j].StartBeat <= _CurrentBeat)
{
if (CGame.GetTimeFromBeats(line[j].FirstNoteBeat, song.BPM) <= _CurrentTime - song.Gap + 10f)
{
nr = j;
}
}
}
// find current line
int nr = FindCurrentLine(line, song);
if (nr != -1)
{
@@ -1048,18 +1062,8 @@ namespace Vocaluxe.Screens
lines[i] = Song.Notes.GetLines(i);
CLine[] line = lines[i].Line;
// find current line for lyric sub fading (it must be the same as in UpdateLyrics)
int CurrentLineSub = 0;
for (int j = 0; j < line.Length; j++)
{
if (line[j].StartBeat <= _CurrentBeat)
{
if (CGame.GetTimeFromBeats(line[j].FirstNoteBeat, Song.BPM) <= _CurrentTime - Song.Gap + 10f)
{
CurrentLineSub = j;
}
}
}
// find current line for lyric sub fading
int CurrentLineSub = FindCurrentLine(line, Song);
// find current line for lyric main fading
int CurrentLine = 0;
+1 -1
View File
@@ -636,7 +636,7 @@ namespace Vocaluxe.Menu.SingNotes
#region Methods
public void AddLine(CLine Line)
{
AddLine(Line, true);
AddLine(Line, false);
}
public void AddLine(CLine Line, bool updateTimings)
{