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;
Steps* pNewNotes = NULL;
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++ )
{
@@ -300,6 +301,12 @@ bool SMALoader::LoadFromSimfile( const RString &sPath, Song &out, bool bFromCach
}
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;
pNewNotes = new Steps(&out);
}
@@ -363,20 +370,14 @@ bool SMALoader::LoadFromSimfile( const RString &sPath, Song &out, bool bFromCach
else if( sValueName=="BPMS" )
{
TimingData &timing = (state == SMA_GETTING_STEP_INFO
? pNewNotes->m_Timing : out.m_SongTiming);
vector< pair<float, float> > vBPMChanges;
vBPMChanges.clear();
ParseBPMs( vBPMChanges, sParams[1], iRowsPerBeat );
ProcessBPMs( timing, vBPMChanges );
}
else if( sValueName=="STOPS" || sValueName=="FREEZES" )
{
TimingData &timing = (state == SMA_GETTING_STEP_INFO
? pNewNotes->m_Timing : out.m_SongTiming);
vector< pair<float, float> > vStops;
vStops.clear();
ParseStops( vStops, sParams[1], iRowsPerBeat );
ProcessStops( timing, vStops );
}
else if( sValueName=="DELAYS" )
@@ -454,6 +455,12 @@ bool SMALoader::LoadFromSimfile( const RString &sPath, Song &out, bool bFromCach
*pNewNotes );
pNewNotes->SetFilename(sPath);
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" )
;