diff --git a/importexport/musicxml/importmxmlpass2.cpp b/importexport/musicxml/importmxmlpass2.cpp index b840f843260c6..1b94856583c15 100644 --- a/importexport/musicxml/importmxmlpass2.cpp +++ b/importexport/musicxml/importmxmlpass2.cpp @@ -5641,19 +5641,16 @@ void MusicXMLParserPass2::divisions() // the type for all rests. // Sibelius calls all whole-measure rests "whole", even if the duration != 4/4 -static bool isWholeMeasureRest(const bool rest, const QString& type, const Fraction dura, const Fraction mDura) +static bool isWholeMeasureRest(const QString& type, const Fraction dura, const Fraction mDura) { - if (!rest) - return false; - if (!dura.isValid()) return false; if (!mDura.isValid()) return false; - return ((type.isEmpty() && dura == mDura) - || (type == "whole" && dura == mDura && dura != Fraction(1, 1))); + return (type.isEmpty() && dura == mDura) + || (type == "whole" && dura == mDura); } //--------------------------------------------------------- @@ -5665,14 +5662,14 @@ static bool isWholeMeasureRest(const bool rest, const QString& type, const Fract * This includes whole measure rest detection. */ -static TDuration determineDuration(const bool rest, const QString& type, const int dots, const Fraction dura, const Fraction mDura) +static TDuration determineDuration(const bool rest, const bool measureRest, const QString& type, const int dots, const Fraction dura, const Fraction mDura) { //qDebug("determineDuration rest %d type '%s' dots %d dura %s mDura %s", // rest, qPrintable(type), dots, qPrintable(dura.print()), qPrintable(mDura.print())); TDuration res; if (rest) { - if (isWholeMeasureRest(rest, type, dura, mDura)) + if (measureRest || isWholeMeasureRest(type, dura, mDura)) res.setType(TDuration::DurationType::V_MEASURE); else if (type.isEmpty()) { // If no type, set duration type based on duration. @@ -6098,6 +6095,7 @@ Note* MusicXMLParserPass2::note(const QString& partId, bool isSmall = false; bool grace = false; bool rest = false; + bool measureRest = false; int staff = 0; QString type; QString voice; @@ -6173,6 +6171,7 @@ Note* MusicXMLParserPass2::note(const QString& partId, } else if (_e.name() == "rest") { rest = true; + measureRest = _e.attributes().value("measure") == "yes"; mnp.displayStepOctave(_e); } else if (_e.name() == "staff") { @@ -6282,7 +6281,7 @@ Note* MusicXMLParserPass2::note(const QString& partId, ChordRest* cr { nullptr }; Note* note { nullptr }; - TDuration duration = determineDuration(rest, type, mnd.dots(), dura, measure->ticks()); + TDuration duration = determineDuration(rest, measureRest, type, mnd.dots(), dura, measure->ticks()); // begin allocation if (rest) { diff --git a/mtest/musicxml/io/testIncompleteTuplet_ref.xml b/mtest/musicxml/io/testIncompleteTuplet_ref.xml index 9761723701df4..6c9be31f3df41 100644 --- a/mtest/musicxml/io/testIncompleteTuplet_ref.xml +++ b/mtest/musicxml/io/testIncompleteTuplet_ref.xml @@ -54,20 +54,18 @@ - + 36 1 - whole 1 36 - + 36 5 - whole 2 @@ -243,10 +241,9 @@ 36 - + 36 5 - whole 2 diff --git a/mtest/musicxml/io/testNoteAttributes1.xml b/mtest/musicxml/io/testNoteAttributes1.xml index 34a8e3042fb44..02b1be853901b 100644 --- a/mtest/musicxml/io/testNoteAttributes1.xml +++ b/mtest/musicxml/io/testNoteAttributes1.xml @@ -169,10 +169,9 @@ - + 4 1 - whole diff --git a/mtest/musicxml/io/testNotesRests1.xml b/mtest/musicxml/io/testNotesRests1.xml index 9e2e5806124f8..ab2420f3b9c2a 100644 --- a/mtest/musicxml/io/testNotesRests1.xml +++ b/mtest/musicxml/io/testNotesRests1.xml @@ -232,10 +232,9 @@ - + 64 1 - whole 64 diff --git a/mtest/musicxml/io/testRestNotations_ref.xml b/mtest/musicxml/io/testRestNotations_ref.xml index 73a69ced44c7b..2d1c6774eaedc 100644 --- a/mtest/musicxml/io/testRestNotations_ref.xml +++ b/mtest/musicxml/io/testRestNotations_ref.xml @@ -49,26 +49,23 @@ - + 4 1 - whole - + 4 1 - whole - + 4 1 - whole @@ -87,10 +84,9 @@ - + 4 1 - whole light-heavy