segment renovation stage 2: redefine TimingSegments as simple structs, standardize names and functions, use only rows for constructors (we'll limit allocation through TimingData::AddSegment in the near future)

This commit is contained in:
Mark Cannon
2011-09-11 17:13:10 +00:00
parent a8f22ef178
commit df9c4d8142
13 changed files with 538 additions and 1247 deletions
+17 -17
View File
@@ -39,7 +39,7 @@ void SMALoader::ProcessMultipliers( TimingData &out, const int iRowsPerBeat, con
iCombos :
StringToInt(arrayMultiplierValues[2]));
out.AddSegment(SEGMENT_COMBO,
new ComboSegment( fComboBeat, iCombos, iMisses ));
new ComboSegment( BeatToNoteRow(fComboBeat), iCombos, iMisses ));
}
}
@@ -52,7 +52,7 @@ void SMALoader::ProcessBeatsPerMeasure( TimingData &out, const RString sParam )
{
vector<RString> vs2;
split( *s1, "=", vs2 );
if( vs2.size() < 2 )
{
LOG->UserLog("Song file",
@@ -61,13 +61,13 @@ void SMALoader::ProcessBeatsPerMeasure( TimingData &out, const RString sParam )
static_cast<int>(vs2.size()) );
continue;
}
const float fBeat = StringToFloat( vs2[0] );
TimeSignatureSegment * seg = new TimeSignatureSegment(fBeat,
StringToInt(vs2[1]),
4 );
TimeSignatureSegment * seg = new TimeSignatureSegment(
BeatToNoteRow(fBeat),
StringToInt(vs2[1]),
4 );
if( fBeat < 0 )
{
LOG->UserLog("Song file",
@@ -122,14 +122,14 @@ void SMALoader::ProcessSpeeds( TimingData &out, const RString line, const int ro
RString backup = vs2[2];
Trim(vs2[2], "s");
Trim(vs2[2], "S");
unsigned short tmp = ((backup != vs2[2]) ? 1 : 0);
SpeedSegment * seg = new SpeedSegment(fBeat,
StringToFloat( vs2[1] ),
StringToFloat(vs2[2]),
tmp);
SpeedSegment::BaseUnit unit = ((backup != vs2[2]) ?
SpeedSegment::UNIT_SECONDS : SpeedSegment::UNIT_BEATS);
SpeedSegment * seg = new SpeedSegment( BeatToNoteRow(fBeat),
StringToFloat( vs2[1] ), StringToFloat(vs2[2]), unit);
if( fBeat < 0 )
{
LOG->UserLog("Song file",
@@ -139,12 +139,12 @@ void SMALoader::ProcessSpeeds( TimingData &out, const RString line, const int ro
continue;
}
if( seg->GetLength() < 0 )
if( seg->GetDelay() < 0 )
{
LOG->UserLog("Song file",
this->GetSongTitle(),
"has an speed change with beat %f, length %f.",
fBeat, seg->GetLength() );
fBeat, seg->GetDelay() );
continue;
}