diff --git a/importexport/musicxml/importmxmlpass2.cpp b/importexport/musicxml/importmxmlpass2.cpp index fd3dc06226eb2..beba18e9021a8 100644 --- a/importexport/musicxml/importmxmlpass2.cpp +++ b/importexport/musicxml/importmxmlpass2.cpp @@ -3293,11 +3293,19 @@ void MusicXMLParserDirection::handleRepeats(Measure* measure, const int track, c _wordsText = ""; } else tb->setVisible(false); - // Some Markers and Jumps align to the right of a measure. - // These may be recorded in the XML as occurring at the beginning - // of the following measure. This fixes that. - if (tb->tid() == Tid::REPEAT_RIGHT && tick == measure->tick()) + + // Sometimes Jumps and Markers are exported on the incorrect side + // of the barline (i.e. end of mm. 29 vs. beginning of mm. 30). + // This fixes that. + bool closerToLeft = tick - measure->tick() < measure->endTick() - tick; + if (tb->tid() == Tid::REPEAT_RIGHT + && closerToLeft + && measure->prevMeasure()) measure = measure->prevMeasure(); + else if (tb->tid() == Tid::REPEAT_LEFT + && !closerToLeft + && measure->nextMeasure()) + measure = measure->nextMeasure(); measure->add(tb); } } diff --git a/mtest/musicxml/io/testDSalCodaMisplaced.xml b/mtest/musicxml/io/testDSalCodaMisplaced.xml new file mode 100644 index 0000000000000..f65eef2d54af6 --- /dev/null +++ b/mtest/musicxml/io/testDSalCodaMisplaced.xml @@ -0,0 +1,432 @@ + + + + + Codas + + + Henry Ives + + MuseScore 0.7.0 + 2007-09-10 + + + + + + + + + + 7 + 40 + + + 1697.14 + 1200 + + 85.7143 + 85.7143 + 85.7143 + 85.7143 + + + 85.7143 + 85.7143 + 85.7143 + 85.7143 + + + + + + + title + D.S al Codas + + + subtitle + MuseScore Testcase + + + composer + Henry Ives + + + + brace + + + Piano + Pno. + + Piano + + + + 1 + 1 + 78.7402 + 0 + + + + + + + + + 50.00 + 0.00 + + 170.00 + + + + 1 + + 0 + + + + G + 2 + + + + + B + 4 + + 1 + 1 + quarter + down + + + + 1 + 1 + quarter + + + + C + 4 + + 1 + 1 + quarter + up + + + + + F + 4 + + 1 + 1 + quarter + up + + + + 1 + 1 + quarter + + + + + + + + + + + + B + 4 + + 1 + 1 + quarter + down + + + + 1 + 1 + quarter + + + + E + 4 + + 1 + 1 + quarter + up + + + + B + 3 + + 1 + 1 + quarter + up + + + + + + 4 + 1 + + + + + + To Coda + + + + + + D + 4 + + 1 + 1 + quarter + up + + + + 1 + 1 + quarter + + + + D + 4 + + 1 + 1 + quarter + up + + + + 1 + 1 + quarter + + + + + + D + 4 + + 1 + 1 + quarter + up + + + + 1 + 1 + quarter + + + + 2 + 1 + half + + + + + + C + 4 + + 1 + 1 + quarter + up + + + + 1 + 1 + quarter + + + + 2 + 1 + half + + + + + + 4 + 1 + + + + + + G + 4 + + 1 + 1 + quarter + up + + + + 1 + 1 + quarter + + + + 2 + 1 + half + + + + + + E + 4 + + 1 + 1 + quarter + up + + + + 1 + 1 + quarter + + + + F + 4 + + 1 + 1 + quarter + up + + + + 1 + 1 + quarter + + + + + + F + 4 + + 1 + 1 + quarter + up + + + + 1 + 1 + quarter + + + + 2 + 1 + half + + + + D.S. al Coda + + + + + + + + + + + + + + 4 + 1 + + + + + + 4 + 1 + + + + + + 4 + 1 + + + + + + G + 4 + + 1 + 1 + quarter + up + + + + 1 + 1 + quarter + + + + 2 + 1 + half + + + light-heavy + + + + diff --git a/mtest/musicxml/io/testDSalCodaMisplaced_ref.mscx b/mtest/musicxml/io/testDSalCodaMisplaced_ref.mscx new file mode 100644 index 0000000000000..b068dbf40e023 --- /dev/null +++ b/mtest/musicxml/io/testDSalCodaMisplaced_ref.mscx @@ -0,0 +1,416 @@ + + + + + 0 + 480 + + 1 + 1 + 1 + 0 + + Henry Ives + + + + + + + + + Codas + + + + stdNormal + + 3 + + Piano + + Piano + Pno. + Piano + 21 + 108 + 21 + 108 + keyboard.piano + F + + 100 + 95 + + + 100 + 33 + + + 100 + 50 + + + 100 + 67 + + + 100 + 100 + + + 120 + 67 + + + 150 + 100 + + + 150 + 50 + + + 120 + 50 + + + 120 + 100 + + + + + + + + + + 12.5 + + + + D.S al Codas + + + + + MuseScore Testcase + + + + right,top + + Henry Ives + + + + + + G + G + + + 4 + 4 + + + quarter + down + + 71 + 19 + + + + quarter + + + quarter + up + + 60 + 14 + + + 65 + 13 + + + + quarter + + + + + + + segno + + + + + quarter + down + + 71 + 19 + + + + quarter + + + quarter + up + + 64 + 18 + + + + quarter + up + + 59 + 19 + + + + + + + + To Coda + + + + + measure + 1/1 + + + + + + + quarter + up + + 62 + 16 + + + + quarter + + + quarter + up + + 62 + 16 + + + + quarter + + + + + + + quarter + up + + 62 + 16 + + + + quarter + + + half + + + + + + + quarter + up + + 60 + 14 + + + + quarter + + + half + + + + + + + measure + 1/1 + + + + + + + quarter + up + + 67 + 15 + + + + quarter + + + half + + + + + + + quarter + up + + 64 + 18 + + + + quarter + + + quarter + up + + 65 + 13 + + + + quarter + + + + + + + D.S. al Coda + segno + end + + + + + quarter + up + + 65 + 13 + + + + quarter + + + half + + + + + + + coda + + + + + measure + 1/1 + + + + + + + measure + 1/1 + + + + + + + measure + 1/1 + + + + + + + quarter + up + + 67 + 15 + + + + quarter + + + half + + + end + + + + + + diff --git a/mtest/musicxml/io/testDSalCoda_ref.mscx b/mtest/musicxml/io/testDSalCoda_ref.mscx index 55fb2c4e2f112..b068dbf40e023 100644 --- a/mtest/musicxml/io/testDSalCoda_ref.mscx +++ b/mtest/musicxml/io/testDSalCoda_ref.mscx @@ -56,6 +56,7 @@ stdNormal + 3 Piano diff --git a/mtest/musicxml/io/tst_mxml_io.cpp b/mtest/musicxml/io/tst_mxml_io.cpp index aeb060e5c031d..1856baa5da0e4 100644 --- a/mtest/musicxml/io/tst_mxml_io.cpp +++ b/mtest/musicxml/io/tst_mxml_io.cpp @@ -104,6 +104,7 @@ private slots: void drumset1() { mxmlIoTest("testDrumset1"); } void drumset2() { mxmlIoTest("testDrumset2"); } void dsalCoda() { mxmlImportTestRef("testDSalCoda"); } + void dsalCodaMisplaced() { mxmlImportTestRef("testDSalCodaMisplaced"); } void durationRoundingError() { mxmlIoTestRef("testDurationRoundingError"); } void dynamics1() { mxmlIoTest("testDynamics1"); } void dynamics2() { mxmlIoTest("testDynamics2"); }