Add an "Autosync Tempo" feature. This uses a linear Least Squares

Regression to figure out a line through the user's step errors to minimize
that error.  It then uses the slope of that line to fix the tempo and the
intercept to fix the offset.  Stops are adjusted as if they were originally
calculated as a number of beats, ie the slope is also used to change
the stops.

Also fixed is a bug where the user doesn't get a chance to keep or
reject the sync changes when ESCing (ZZing) from a song.

R=glenn
This commit is contained in:
John Bauer
2006-10-26 22:41:40 +00:00
parent ce94e14f03
commit 37f9178f61
19 changed files with 338 additions and 59 deletions
+7 -4
View File
@@ -441,6 +441,7 @@ static LocalizedString SLOW ( "ScreenDebugOverlay", "Slow" );
static LocalizedString CPU ( "ScreenDebugOverlay", "CPU" );
static LocalizedString SONG ( "ScreenDebugOverlay", "Song" );
static LocalizedString MACHINE ( "ScreenDebugOverlay", "Machine" );
static LocalizedString SYNC_TEMPO ( "ScreenDebugOverlay", "Tempo" );
class DebugLineAutoplay : public IDebugLine
@@ -497,9 +498,10 @@ class DebugLineAutosync : public IDebugLine
{
switch( GAMESTATE->m_SongOptions.GetSong().m_AutosyncType )
{
case SongOptions::AUTOSYNC_OFF: return OFF.GetValue(); break;
case SongOptions::AUTOSYNC_SONG: return SONG.GetValue(); break;
case SongOptions::AUTOSYNC_MACHINE: return MACHINE.GetValue(); break;
case SongOptions::AUTOSYNC_OFF: return OFF.GetValue(); break;
case SongOptions::AUTOSYNC_SONG: return SONG.GetValue(); break;
case SongOptions::AUTOSYNC_MACHINE: return MACHINE.GetValue(); break;
case SongOptions::AUTOSYNC_TEMPO: return SYNC_TEMPO.GetValue(); break;
default: ASSERT(0);
}
}
@@ -509,7 +511,8 @@ class DebugLineAutosync : public IDebugLine
{
int as = GAMESTATE->m_SongOptions.GetSong().m_AutosyncType + 1;
bool bAllowSongAutosync = !GAMESTATE->IsCourseMode();
if( !bAllowSongAutosync && as == SongOptions::AUTOSYNC_SONG )
if( !bAllowSongAutosync &&
( as == SongOptions::AUTOSYNC_SONG || as == SongOptions::AUTOSYNC_TEMPO ) )
as = SongOptions::AUTOSYNC_MACHINE;
wrap( as, SongOptions::NUM_AUTOSYNC_TYPES );
SO_GROUP_ASSIGN( GAMESTATE->m_SongOptions, ModsLevel_Song, m_AutosyncType, SongOptions::AutosyncType(as) );