Applied time signature fix to SMALoader::ProcessBeatsPerMeasure()

This commit is contained in:
Michael Votaw
2023-12-19 18:03:54 -06:00
committed by teejusb
parent eeb2528612
commit c4d63052e2
+15 -1
View File
@@ -48,6 +48,7 @@ void SMALoader::ProcessMultipliers( TimingData &out, const int iRowsPerBeat, con
void SMALoader::ProcessBeatsPerMeasure( TimingData &out, const RString sParam )
{
std::vector<RString> vs1;
std::vector<TimeSignatureSegment> segments;
split( sParam, ",", vs1 );
for (RString const &s1 : vs1)
@@ -82,8 +83,21 @@ void SMALoader::ProcessBeatsPerMeasure( TimingData &out, const RString sParam )
fBeat, iNumerator );
continue;
}
segments.push_back( TimeSignatureSegment(BeatToNoteRow(fBeat), iNumerator) );
}
out.AddSegment( TimeSignatureSegment(BeatToNoteRow(fBeat), iNumerator) );
// If there are any time signatures defined, but there isn't one
// for the very first beat of the song, then add one.
// Without it, calls to functions like TimingData::NoteRowToMeasureAndBeat
// can fail for charts that are otherwise valid.
if ( segments.size() > 0 && segments[0].GetRow() > 0 )
{
out.AddSegment( TimeSignatureSegment(0, 4, 4) );
}
for( TimeSignatureSegment segment: segments )
{
out.AddSegment( segment );
}
}