diff --git a/mtest/libmscore/repeat/repeat65.mscx b/mtest/libmscore/repeat/repeat65.mscx new file mode 100644 index 0000000000000..4f7adcdbbb2d7 --- /dev/null +++ b/mtest/libmscore/repeat/repeat65.mscx @@ -0,0 +1,241 @@ + + + + + 0 + 480 + + 1 + 1 + 1 + 0 + + + + + + + + + + + Repeat Test + + + + stdNormal + + + Piano + + Piano + Pno. + Piano + 21 + 108 + 21 + 108 + keyboard.piano + F + + 100 + 95 + + + 100 + 33 + + + 100 + 50 + + + 100 + 67 + + + 100 + 100 + + + 120 + 67 + + + 120 + 100 + + + + + + + + + 10 + 1 + 0 + + + repeat65 + + + + Jump at volta end with end repeat interpretation order + + + + 1 + 0 + 1 + 1 + 1 + 1 + + + 1,2,3,4 2,3,4 1,2 5 + + + + + + + 4 + 4 + + + 6.66667 + 1 + = 400 + + + whole + + 60 + 14 + + + + + + + + + whole + + 62 + 16 + + + + + + + + + + + 1 + 1, 2 + 1, 2 + + + + 2 + + + + + whole + + 64 + 18 + + + + + + 3 + + + + D.C. + start + end + + + + + + 0 + 3x + center,center + 1 + + + + 1 + + + + + whole + + 65 + 13 + + + + + + + + + + -2 + + + + + + + -1 + + + + + + 1 + 3. + 3 + + + + 1/1 + + + + + whole + + 67 + 15 + + + + + + -1/1 + + + + + + + + diff --git a/mtest/libmscore/repeat/repeat66.mscx b/mtest/libmscore/repeat/repeat66.mscx new file mode 100644 index 0000000000000..0da476bb4468b --- /dev/null +++ b/mtest/libmscore/repeat/repeat66.mscx @@ -0,0 +1,363 @@ + + + + + 0 + 480 + + 1 + 1 + 1 + 0 + + + + + + + + + + + Repeat Test + + + + stdNormal + + + Piano + + Piano + Pno. + Piano + 21 + 108 + 21 + 108 + keyboard.piano + F + + 100 + 95 + + + 100 + 33 + + + 100 + 50 + + + 100 + 67 + + + 100 + 100 + + + 120 + 67 + + + 120 + 100 + + + + + + + + + 10 + 1 + 0 + + + repeat66 + + + + Force Final Repeat should reset when crossing to next section. + + + + 1 + 0 + 1 + 1 + 1 + 1 + + + 1,2,3,4 2,3,4 1,2 5 | 1,2,3,4 2,3,4 2 5 + + + + + + + 4 + 4 + + + 6.66667 + 1 + = 400 + + + whole + + 60 + 14 + + + + + + + + + whole + + 62 + 16 + + + + + + + + + + + 1 + 1, 2 + 1, 2 + + + + 2 + + + + + whole + + 64 + 18 + + + + + + 3 + + + + D.C. + start + end + + + + + + 0 + 3x + center,center + 1 + + + + 1 + + + + + whole + + 65 + 13 + + + + + + + section + + + + + + -2 + + + + + + + -1 + + + + + + 1 + 3. + 3 + + + + 1 + + + + + whole + + 67 + 15 + + + + end + + + + + + + + + -1 + + + + + whole + + 67 + 15 + + + + + + + + + whole + + 65 + 13 + + + + + + + + + 1 + 1, 2 + 1, 2 + + + + 2 + + + + + whole + + 64 + 18 + + + + + + 3 + + + + 0 + 3x + center,center + 1 + + + + 1 + + + + + whole + + 62 + 16 + + + + + + + + + + -2 + + + + + + + -1 + + + + + + 1 + 3. + 3 + + + + 1/1 + + + + + whole + + 60 + 14 + + + + + + -1/1 + + + + + + + + diff --git a/mtest/libmscore/repeat/tst_repeat.cpp b/mtest/libmscore/repeat/tst_repeat.cpp index 7ed83c9048bfd..9bbfa35080ab7 100644 --- a/mtest/libmscore/repeat/tst_repeat.cpp +++ b/mtest/libmscore/repeat/tst_repeat.cpp @@ -122,6 +122,9 @@ private slots: void repeat62() { repeat("repeat62.mscx", "1;5;6;7; 1;2;3;4;5;6;7; 1;5;6;7; 1;7"); } // overlapping voltas - same start void repeat63() { repeat("repeat63.mscx", "1;2;3;7; 1;2;3;4;5;6;7; 1;2;3;7; 1;7"); } // overlapping voltas - same end void repeat64() { repeat("repeat64.mscx", "1;2;3;7; 1;2;3;4;5;6;7; 1;2;3;7; 1;7"); } // overlapping voltas + + void repeat65() { repeat("repeat65.mscx", "1;2;3;4; 2;3;4; 1;2; 5"); } // Jump at volta end with end repeat + void repeat66() { repeat("repeat66.mscx", "1;2;3;4; 2;3;4; 1;2; 5; 1;2;3;4; 2;3;4; 2; 5"); } // final repeat and new section }; //--------------------------------------------------------- diff --git a/src/libmscore/repeatlist.cpp b/src/libmscore/repeatlist.cpp index 86f80ddf933f9..90179c6eb9999 100644 --- a/src/libmscore/repeatlist.cpp +++ b/src/libmscore/repeatlist.cpp @@ -474,8 +474,13 @@ void RepeatList::collectRepeatListElements() sectionRLElements->push_back(new RepeatListElement(RepeatListElementType::JUMP, e, toMeasure(mb))); if (volta != nullptr) { - if (volta->endMeasure()->tick() <= mb->tick()) { - // The previous volta was supposed to end before us (open volta case) -> insert the end + if ((volta->endMeasure()->tick() < mb->tick()) + || ((volta->endMeasure()->tick() == mb->tick()) + && (volta->getProperty(Pid::END_HOOK_TYPE).value() == HookType::NONE) + ) + ) { + // The previous volta was supposed to end before us + // or open volta ends together with us -> insert the end sectionRLElements->push_back(new RepeatListElement(RepeatListElementType::VOLTA_END, volta, toMeasure(mb))); volta = nullptr; @@ -776,6 +781,7 @@ void RepeatList::unwind() activeVolta = nullptr; playUntil.first = _rlElements.cend(); continueAt.first = _rlElements.cend(); + forceFinalRepeat = false; rs = new RepeatSegment(playbackCount); rs->addMeasure((*repeatListElementIt)->measure);