]> git.donarmstrong.com Git - lilypond.git/commitdiff
Fix issue 4355 -- broken beam subdivision
authorCarl Sorensen <carl.d.sorensen@gmail.com>
Sat, 25 Apr 2015 03:07:51 +0000 (21:07 -0600)
committerCarl Sorensen <carl.d.sorensen@gmail.com>
Sun, 3 May 2015 13:56:27 +0000 (07:56 -0600)
When beams are subdivided, the number of beams joining the subdivisions
should match the length of the subdivision.  Previously, the subdivisions
were joined by a single beam.

input/regression/beam-subdivision.ly [new file with mode: 0644]
lily/beaming-pattern.cc

diff --git a/input/regression/beam-subdivision.ly b/input/regression/beam-subdivision.ly
new file mode 100644 (file)
index 0000000..2aa8e2b
--- /dev/null
@@ -0,0 +1,24 @@
+\header {
+
+  texidoc = "Beam subdivisions should match the durations of the subdivided
+groups, as established by baseMoment."
+  }
+
+\version "2.19.19"
+
+\layout {
+  ragged-right = ##t
+}
+
+{  
+  \set subdivideBeams = ##t
+  \set baseMoment = #(ly:make-moment 1 4)
+  c''32[^\markup{"baseMoment 1/4"} c'' c'' c'' c'' c'' c'' c'']
+  \set baseMoment = #(ly:make-moment 1 8)
+  c''32[^\markup{"baseMoment 1/8"} c'' c'' c'' c'' c'' c'' c'']
+  \set baseMoment = #(ly:make-moment 1 16)
+  c''32^\markup{"baseMoment 1/16"}[ c'' c'' c'' c'' c'' c'' c'']
+  \set baseMoment = #(ly:make-moment 1 32)
+  c''64^\markup{"baseMoment 1/32"}[ \repeat unfold 14 {c''64} c''64]
+}
+
index 5ffbcfb9d9047ef558213bcc3293b117c9443c37..1dcb791a8d9ca6bc836a10a1276373a4ab47c6ed 100644 (file)
@@ -19,6 +19,7 @@
 
 #include "context.hh"
 #include "beaming-pattern.hh"
+#include "misc.hh"
 
 /*
   Represents a stem belonging to a beam. Sometimes (for example, if the stem
@@ -166,8 +167,10 @@ Beaming_pattern::beamify (Beaming_options const &options)
         if (non_flag_dir)
           {
             int importance = infos_[i + 1].rhythmic_importance_;
-            int count = (importance < 0 && options.subdivide_beams_)
-                        ? 1 : min (min (infos_[i].count (non_flag_dir),
+            int start_dur = intlog2(infos_[i+1].start_moment_.main_part_.den());
+            int count = (importance < 0 && options.subdivide_beams_) 
+                        ? max(start_dur,3)-2 // 1/8 note has one beam
+                        : min (min (infos_[i].count (non_flag_dir),
                                         infos_[i + non_flag_dir].count (-non_flag_dir)),
                                    infos_[i - non_flag_dir].count (non_flag_dir));