[splittiming] Few things with NotesLoader/Writer:

1) Start to accept FakeSegments.
2) Start the transition to relative points for Warps.
3) Again, song timings don't get FakeSegments.
This commit is contained in:
Jason Felds
2011-05-16 10:02:57 -04:00
parent ba8791b4f9
commit 329798e0d6
5 changed files with 105 additions and 10 deletions
+36
View File
@@ -355,6 +355,35 @@ void SMALoader::ProcessSpeeds( TimingData &out, const int iRowsPerBeat, const RS
}
}
void SMALoader::ProcessFakes( TimingData &out, const int iRowsPerBeat, const RString sParam )
{
vector<RString> arrayFakeExpressions;
split( sParam, ",", arrayFakeExpressions );
for( unsigned b=0; b<arrayFakeExpressions.size(); b++ )
{
vector<RString> arrayFakeValues;
split( arrayFakeExpressions[b], "=", arrayFakeValues );
// XXX: Hard to tell which file caused this.
if( arrayFakeValues.size() != 2 )
{
LOG->UserLog( "Song file", "(UNKNOWN)", "has an invalid #FAKES value \"%s\" (must have exactly one '='), ignored.",
arrayFakeExpressions[b].c_str() );
continue;
}
const float fBeat = RowToBeat( arrayFakeValues[0], iRowsPerBeat );
const float fNewBeat = StringToFloat( arrayFakeValues[1] );
if(fNewBeat > 0)
out.AddFakeSegment( FakeSegment(fBeat, fNewBeat) );
else
{
LOG->UserLog( "Song file", "(UNKNOWN)", "has an invalid Fake at beat %f, BPM %f.", fBeat, fNewBeat );
}
}
}
void SMALoader::LoadFromSMATokens(
RString sStepsType,
@@ -685,6 +714,13 @@ bool SMALoader::LoadFromSMAFile( const RString &sPath, Song &out )
ProcessMultipliers( pNewNotes->m_Timing, iRowsPerBeat, sParams[1] );
}
else if( sValueName=="FAKES" )
{
TimingData &timing = (state == SMA_GETTING_STEP_INFO
? pNewNotes->m_Timing : out.m_SongTiming);
ProcessFakes( timing, iRowsPerBeat, sParams[1] );
}
else if( sValueName=="METERTYPE" )
{
; // We don't use this...yet.