Skip to content

Commit c33b00b

Browse files
committed
Merge pull request #31 from lvinken/17663-compound-simple-timesignature-import
fix #17663: [MusicXML import] 11c-TimeSignatures-CompoundSimple.xml: 3+2...
2 parents 16c2419 + a82cdae commit c33b00b

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

mscore/importxml.cpp

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -825,18 +825,7 @@ static bool determineTimeSig(const QString beats, const QString beatType, const
825825

826826
btp = beatType.toInt();
827827
QStringList list = beats.split("+");
828-
#if 0 // TODO TS
829-
for (int i = 0; i < 4; i++)
830-
bts[i] = 0;
831-
for (int i = 0; i < list.size() && i < 4; i++)
832-
bts[i] = list.at(i).toInt();
833-
// the beat type and at least one beat must be non-zero
834-
if (btp && (bts[0] || bts[1] || bts[2] || bts[3])) {
835-
TimeSig ts = TimeSig(score, btp, bts[0], bts[1], bts[2], bts[3]);
836-
st = ts.subtype();
837-
}
838-
#endif
839-
for (int i = 0; i < list.size() && i < 4; i++)
828+
for (int i = 0; i < list.size(); i++)
840829
bts += list.at(i).toInt();
841830
}
842831
return true;
@@ -3315,7 +3304,7 @@ void MusicXml::xmlAttributes(Measure* measure, int staff, QDomElement e)
33153304
if (beats != "" && beatType != "") {
33163305
// determine if timesig is valid
33173306
TimeSigType st = TSIG_NORMAL;
3318-
int bts = 0; // the beats (max 4 separated by "+") as integer
3307+
int bts = 0; // total beats as integer (beats may contain multiple numbers, separated by "+")
33193308
int btp = 0; // beat-type as integer
33203309
if (determineTimeSig(beats, beatType, timeSymbol, st, bts, btp)) {
33213310
// add timesig to all staves
@@ -3326,6 +3315,11 @@ void MusicXml::xmlAttributes(Measure* measure, int staff, QDomElement e)
33263315
TimeSig* timesig = new TimeSig(score);
33273316
timesig->setSubtype(st);
33283317
timesig->setSig(Fraction(bts, btp));
3318+
// handle simple compound time signature
3319+
if (beats.contains(QChar('+'))) {
3320+
timesig->setNumeratorString(beats);
3321+
timesig->setDenominatorString(beatType);
3322+
}
33293323
timesig->setTrack((staff + i) * VOICES);
33303324
Segment* s = measure->getSegment(timesig, tick);
33313325
s->add(timesig);

0 commit comments

Comments
 (0)