Update SMA loader to put bpms/stops together

This commit is contained in:
Devin J. Pohly
2013-05-17 02:30:08 -04:00
parent 0ef9b81e02
commit 7df86bbf85
+15 -8
View File
@@ -164,6 +164,7 @@ bool SMALoader::LoadFromSimfile( const RString &sPath, Song &out, bool bFromCach
int state = SMA_GETTING_SONG_INFO; int state = SMA_GETTING_SONG_INFO;
Steps* pNewNotes = NULL; Steps* pNewNotes = NULL;
int iRowsPerBeat = -1; // Start with an invalid value: needed for checking. int iRowsPerBeat = -1; // Start with an invalid value: needed for checking.
vector< pair<float, float> > vBPMChanges, vStops;
for( unsigned i=0; i<msd.GetNumValues(); i++ ) for( unsigned i=0; i<msd.GetNumValues(); i++ )
{ {
@@ -300,6 +301,12 @@ bool SMALoader::LoadFromSimfile( const RString &sPath, Song &out, bool bFromCach
} }
else else
{ {
// This should generally return song timing
TimingData &timing = (state == SMA_GETTING_STEP_INFO
? pNewNotes->m_Timing : out.m_SongTiming);
ProcessBPMs( timing, vBPMChanges );
ProcessStops( timing, vStops );
state = SMA_GETTING_STEP_INFO; state = SMA_GETTING_STEP_INFO;
pNewNotes = new Steps(&out); pNewNotes = new Steps(&out);
} }
@@ -363,20 +370,14 @@ bool SMALoader::LoadFromSimfile( const RString &sPath, Song &out, bool bFromCach
else if( sValueName=="BPMS" ) else if( sValueName=="BPMS" )
{ {
TimingData &timing = (state == SMA_GETTING_STEP_INFO vBPMChanges.clear();
? pNewNotes->m_Timing : out.m_SongTiming);
vector< pair<float, float> > vBPMChanges;
ParseBPMs( vBPMChanges, sParams[1], iRowsPerBeat ); ParseBPMs( vBPMChanges, sParams[1], iRowsPerBeat );
ProcessBPMs( timing, vBPMChanges );
} }
else if( sValueName=="STOPS" || sValueName=="FREEZES" ) else if( sValueName=="STOPS" || sValueName=="FREEZES" )
{ {
TimingData &timing = (state == SMA_GETTING_STEP_INFO vStops.clear();
? pNewNotes->m_Timing : out.m_SongTiming);
vector< pair<float, float> > vStops;
ParseStops( vStops, sParams[1], iRowsPerBeat ); ParseStops( vStops, sParams[1], iRowsPerBeat );
ProcessStops( timing, vStops );
} }
else if( sValueName=="DELAYS" ) else if( sValueName=="DELAYS" )
@@ -454,6 +455,12 @@ bool SMALoader::LoadFromSimfile( const RString &sPath, Song &out, bool bFromCach
*pNewNotes ); *pNewNotes );
pNewNotes->SetFilename(sPath); pNewNotes->SetFilename(sPath);
out.AddSteps( pNewNotes ); out.AddSteps( pNewNotes );
// Handle timing changes and convert negative bpms/stops
TimingData &timing = (state == SMA_GETTING_STEP_INFO
? pNewNotes->m_Timing : out.m_SongTiming);
ProcessBPMs( timing, vBPMChanges );
ProcessStops( timing, vStops );
} }
else if( sValueName=="TIMESIGNATURES" || sValueName=="LEADTRACK" ) else if( sValueName=="TIMESIGNATURES" || sValueName=="LEADTRACK" )
; ;