]> git.donarmstrong.com Git - lilypond.git/commitdiff
Some tweaks to beaming patterns over rests.
authorJoe Neeman <joeneeman@gmail.com>
Mon, 2 Jun 2008 22:33:12 +0000 (08:33 +1000)
committerJoe Neeman <joeneeman@gmail.com>
Mon, 2 Jun 2008 22:33:12 +0000 (08:33 +1000)
input/regression/beam-multiplicity-over-rests.ly [new file with mode: 0644]
lily/beaming-pattern.cc

diff --git a/input/regression/beam-multiplicity-over-rests.ly b/input/regression/beam-multiplicity-over-rests.ly
new file mode 100644 (file)
index 0000000..134acc8
--- /dev/null
@@ -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
index b87b863656047ae56358cb5b56901599e9344b35..2e611a8e32189225ba1ddeb9349c2a0efcc37c65 100644 (file)
@@ -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++)