Skip to content

Commit

Permalink
fix #38731: Beams connected to irregular tuplets in a 4/4 time signat…
Browse files Browse the repository at this point in the history
…ure and on beats one and three are incorrect
  • Loading branch information
lasconic committed Nov 10, 2014
1 parent c8fff2d commit 5199474
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 11 deletions.
8 changes: 0 additions & 8 deletions libmscore/groups.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,6 @@ Beam::Mode Groups::endBeam(ChordRest* cr)
return cr->beamMode();
Q_ASSERT(cr->staff());

if (cr->tuplet() && !cr->tuplet()->elements().isEmpty()) {
if (cr->tuplet()->elements().front() == cr) // end beam at new tuplet
return Beam::Mode::BEGIN;
if (cr->tuplet()->elements().back() == cr) // end beam at tuplet end
return Beam::Mode::END;
return Beam::Mode::AUTO;
}

TDuration d = cr->durationType();
const Groups& g = cr->staff()->group(cr->tick());
Fraction stretch = cr->staff()->timeStretch(cr->tick());
Expand Down
14 changes: 13 additions & 1 deletion libmscore/layout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1164,6 +1164,7 @@ void Score::layoutStage2()

Beam::Mode bm = Beam::Mode::AUTO;
Segment::Type st = Segment::Type::ChordRest;
ChordRest* prev = 0;
for (Segment* segment = firstSegment(st); segment; segment = segment->next1(st)) {
ChordRest* cr = static_cast<ChordRest*>(segment->element(track));
if (cr == 0)
Expand All @@ -1180,6 +1181,17 @@ void Score::layoutStage2()

bm = Groups::endBeam(cr);

// end beam at new tuplet or end tuplet, if the next/prev duration type is different
if (cr->tuplet()
&& !cr->tuplet()->elements().isEmpty()
&& cr->tuplet()->elements().front() == cr
&& prev && prev->durationType() == cr->durationType())
bm = Beam::Mode::BEGIN;
else if (prev && prev->tuplet() && !prev->tuplet()->elements().isEmpty()
&& prev->tuplet()->elements().last() == prev && prev->durationType() == cr->durationType())
bm = Beam::Mode::BEGIN;
prev = cr;

// 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)

Expand Down Expand Up @@ -1216,7 +1228,7 @@ void Score::layoutStage2()
}

if (beam) {
bool beamEnd = bm == Beam::Mode::BEGIN;
bool beamEnd = (bm == Beam::Mode::BEGIN);
if (!beamEnd) {
cr->removeDeleteBeam(true);
beam->add(cr);
Expand Down
Binary file added vtest/beams-3-ref.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added vtest/beams-3.mscz
Binary file not shown.
3 changes: 2 additions & 1 deletion vtest/gen
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ else
chord-layout-11 chord-layout-12 chord-layout-13 chord-layout-14 cross-1\
accidental-1 accidental-2 accidental-3 accidental-4 accidental-5\
accidental-6 accidental-7 accidental-8 accidental-9\
tie-1 tie-2 tie-3 grace-1 grace-2 grace-3 harmony-1 harmony-2 harmony-3 harmony-4 beams-1 beams-2\
tie-1 tie-2 tie-3 grace-1 grace-2 grace-3 harmony-1 harmony-2 harmony-3 harmony-4\
beams-1 beams-2 beams-3\
user-offset-1 user-offset-2 chord-space-1 tablature-1 image-1\
lyrics-1 lyrics-2 lyrics-3 voice-1"
fi
Expand Down
3 changes: 2 additions & 1 deletion vtest/gen.bat
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ set SRC=mmrest-1,bravura-mmrest,gonville-mmrest,mmrest-2,mmrest-4,mmrest-5,mmres
chord-layout-11,chord-layout-12,chord-layout-13,chord-layout-14,cross-1, ^
accidental-1,accidental-2,accidental-3,accidental-4,accidental-5, ^
accidental-6,accidental-7,accidental-8,accidental-9, ^
tie-1,tie-2,tie-3,grace-1,grace-2,grace-3,harmony-1,harmony-2,harmony-3,harmony-4,beams-1,beams-2, ^
tie-1,tie-2,tie-3,grace-1,grace-2,grace-3,harmony-1,harmony-2,harmony-3,harmony-4, ^
beams-1,beams-2,beams-3, ^
user-offset-1,user-offset-2,chord-space-1,tablature-1,image-1, ^
lyrics-1,lyrics-2,lyrics-3,voice-1

Expand Down

0 comments on commit 5199474

Please sign in to comment.