Skip to content

Commit

Permalink
Merge pull request musescore#18965 from mike-spa/fix#16798AllowBeamsO…
Browse files Browse the repository at this point in the history
…verAnyRest

Fix musescore#16798: Allow beams over any rest
  • Loading branch information
RomanPudashkin authored Aug 14, 2023
2 parents 71bdda7 + 3835332 commit 8646d16
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/engraving/rendering/dev/beamlayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -737,12 +737,14 @@ void BeamLayout::createBeams(LayoutContext& ctx, Measure* measure)

// if chord has hooks and is 2nd element of a cross-measure value
// set beam mode to NONE (do not combine with following chord beam/hook, if any)

if (cr->durationType().hooks() > 0 && cr->crossMeasure() == CrossMeasure::SECOND) {
TDuration durationType = cr->durationType();
if (durationType.hooks() > 0 && cr->crossMeasure() == CrossMeasure::SECOND) {
bm = BeamMode::NONE;
}

if ((cr->durationType().type() <= DurationType::V_QUARTER) || (bm == BeamMode::NONE)) {
// Rests of any duration can be beamed over, if required
bool canBeBeamed = durationType.type() > DurationType::V_QUARTER || cr->isRest();
if (!canBeBeamed || (bm == BeamMode::NONE)) {
bool removeBeam = true;
if (beam) {
layout1(beam, ctx);
Expand Down Expand Up @@ -973,6 +975,10 @@ void BeamLayout::createBeamSegments(Beam* item, LayoutContext& ctx, const std::v
if (!startCr || (startCr->isRest() && startCr != item->elements().front())) {
startCr = chordRest;
}
} else if (level >= chordRest->beams() && chordRest->isRest() && !breakBeam) {
// This rest has duration longer than the beam value, but it may still go
// under the beam if the next chords or rests are beamed
continue;
} else {
size_t beamletIndex = static_cast<size_t>(i) - 1;
if (lastChordIndex < item->elements().size() && (chordRest->isRest() || (endCr && endCr->isRest()))) {
Expand Down
Binary file added vtest/scores/beams-24.mscz
Binary file not shown.

0 comments on commit 8646d16

Please sign in to comment.