From 8fa2d858e492fabbe966cc6a3a4daa7533dfd193 Mon Sep 17 00:00:00 2001 From: Carl Sorensen Date: Fri, 24 Apr 2015 21:07:51 -0600 Subject: [PATCH] Fix issue 4355 -- broken beam subdivision 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 | 24 ++++++++++++++++++++++++ lily/beaming-pattern.cc | 7 +++++-- 2 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 input/regression/beam-subdivision.ly diff --git a/input/regression/beam-subdivision.ly b/input/regression/beam-subdivision.ly new file mode 100644 index 0000000000..2aa8e2be62 --- /dev/null +++ b/input/regression/beam-subdivision.ly @@ -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] +} + diff --git a/lily/beaming-pattern.cc b/lily/beaming-pattern.cc index 5ffbcfb9d9..1dcb791a8d 100644 --- a/lily/beaming-pattern.cc +++ b/lily/beaming-pattern.cc @@ -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)); -- 2.39.2