From: Joe Neeman Date: Mon, 2 Jun 2008 22:33:12 +0000 (+1000) Subject: Some tweaks to beaming patterns over rests. X-Git-Tag: release/2.11.49-1~1^2~17 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=ef50234ee882f503989910a1d64fdedab394e968;p=lilypond.git Some tweaks to beaming patterns over rests. --- diff --git a/input/regression/beam-multiplicity-over-rests.ly b/input/regression/beam-multiplicity-over-rests.ly new file mode 100644 index 0000000000..134acc8c56 --- /dev/null +++ b/input/regression/beam-multiplicity-over-rests.ly @@ -0,0 +1,14 @@ +\version "2.11.46" + +\header { + texidoc = "When a beam goes over a rest, there should not be any +beamlets pointing towards the rest unless absolutely necessary." +} + +\relative c' { + c8[ r16 c32 c32] + c32[ r16 c32 c8] + c32[ c32 r16 c8] + c16[ r32 c32 r16 c16] + c16[ r16 c32 r32 c16] +} \ No newline at end of file diff --git a/lily/beaming-pattern.cc b/lily/beaming-pattern.cc index b87b863656..2e611a8e32 100644 --- a/lily/beaming-pattern.cc +++ b/lily/beaming-pattern.cc @@ -57,11 +57,23 @@ count_factor_twos (int x) return c; } +/* + Returns true if splitting at the given index will result in a gap + between an invisible stem and a visible stem whose number of beams + is larger than the number of beams of the invisible stem. +*/ bool Beaming_pattern::is_next_to_invisible_stem (vsize i) const { - return infos_[i].invisible_ - || (i > 0 && infos_[i-1].invisible_); + if (i == 0) + return false; + + // In fact, we don't need to check that the visible stem has more beams + // than the invisible stem. unbeam_invisible_stems() ensures that the + // visible stem has at least as many stems as the invisible stem, so + // we only need to check that they are not equal. + return infos_[i].invisible_ != infos_[i-1].invisible_ + && infos_[i].beam_count_drul_[LEFT] != infos_[i-1].beam_count_drul_[RIGHT]; } /* @@ -86,7 +98,7 @@ Beaming_pattern::best_splitpoint_index (bool *at_boundary) const { bool require_invisible = false; for (vsize i = 0; i < infos_.size (); i++) - require_invisible |= infos_[i].invisible_; + require_invisible |= is_next_to_invisible_stem (i); *at_boundary = true; for (vsize i = 1; i < infos_.size (); i++)