Skip to content

Commit

Permalink
Merge pull request #15387 from asattely/break-beam-over-rest
Browse files Browse the repository at this point in the history
Fix #15229: Allow beam breaks on beam-inset rests
  • Loading branch information
RomanPudashkin committed Mar 20, 2023
2 parents d2be567 + 43327a5 commit 7a01cd6
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 398 deletions.
16 changes: 5 additions & 11 deletions src/engraving/libmscore/beam.cpp
Expand Up @@ -1066,17 +1066,11 @@ void Beam::createBeamSegments(const std::vector<ChordRest*>& chordRests)
bool breakBeam = false;
bool previousBreak32 = false;
bool previousBreak64 = false;
int prevRests = 0;

for (size_t i = 0; i < chordRests.size(); i++) {
ChordRest* chordRest = chordRests[i];
ChordRest* prevChordRest = i < 1 ? nullptr : chordRests[i - 1];
if (!chordRest->isChord()) {
if ((chordRest != chordRests.front() && chordRest != chordRests.back()) || level >= chordRest->beams()) {
prevRests++;
continue;
}
}

if (level < chordRest->beams()) {
levelHasBeam = true;
}
Expand All @@ -1095,19 +1089,19 @@ void Beam::createBeamSegments(const std::vector<ChordRest*>& chordRests)
if (startCr && endCr) {
if (startCr == endCr && startCr->isChord()) {
bool isBeamletBefore = calcIsBeamletBefore(toChord(
startCr), static_cast<int>(i) - 1 - prevRests, level, previousBreak32,
startCr), static_cast<int>(i) - 1, level, previousBreak32,
previousBreak64);
createBeamletSegment(toChord(startCr), isBeamletBefore, level);
} else {
createBeamSegment(startCr, endCr, level);
}
}
startCr = chordRest && breakBeam && level < chordRest->beams() ? chordRest : nullptr;
endCr = chordRest && breakBeam && level < chordRest->beams() ? chordRest : nullptr;
bool setCr = chordRest && chordRest->isChord() && breakBeam && level < chordRest->beams();
startCr = setCr ? chordRest : nullptr;
endCr = setCr ? chordRest : nullptr;
}
previousBreak32 = isBroken32;
previousBreak64 = isBroken64;
prevRests = 0;
}

// if the beam ends on the last chord
Expand Down
180 changes: 0 additions & 180 deletions vtest/scores/beams-1.mscx

This file was deleted.

Binary file added vtest/scores/beams-1.mscz
Binary file not shown.
Binary file modified vtest/scores/beams-19.mscz
Binary file not shown.

0 comments on commit 7a01cd6

Please sign in to comment.