From: Carl Sorensen Date: Sat, 17 Mar 2012 03:17:36 +0000 (-0600) Subject: Autobeaming works properly with tuplet recheck (Issue 2408) X-Git-Tag: release/2.15.35-1~17 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=1a4767cac76e0c1a11d5e28d5c7ec91872f57ddf;p=lilypond.git Autobeaming works properly with tuplet recheck (Issue 2408) When a new shortest duration is added to a beam, the beam is rechecked for desired division. Prior to this fix, the tuplet multiplication factor was ignored when calculating the duration of each note in the beam during the recheck. Fix potential memory leak in beaming-pattern::end_moment --- diff --git a/input/regression/autobeam-tuplet-recheck.ly b/input/regression/autobeam-tuplet-recheck.ly new file mode 100644 index 0000000000..024d467651 --- /dev/null +++ b/input/regression/autobeam-tuplet-recheck.ly @@ -0,0 +1,16 @@ +\version "2.15.34" + +\header { + + texidoc = "Autobeam rechecking works properly with tuplets. +In the example, the first beat should be beamed completely together." + +} + +\relative c' { + \time 2/4 + c16 c + \times 2/3 { c8 c16 } + \times 2/3 { c8 c16 } + c16 c +} diff --git a/lily/beaming-pattern.cc b/lily/beaming-pattern.cc index f1408497cd..8f27c23ef5 100644 --- a/lily/beaming-pattern.cc +++ b/lily/beaming-pattern.cc @@ -43,7 +43,7 @@ Beam_rhythmic_element::Beam_rhythmic_element () tuplet_start_ = false; } -Beam_rhythmic_element::Beam_rhythmic_element (Moment m, int i, bool inv, +Beam_rhythmic_element::Beam_rhythmic_element (Moment m, int i, bool inv, Rational factor, bool tuplet_start) { start_moment_ = m; @@ -352,11 +352,12 @@ Beaming_pattern::start_moment (int i) const Moment Beaming_pattern::end_moment (int i) const { - Duration *dur = new Duration (2 + max (beamlet_count (i, LEFT), - beamlet_count (i, RIGHT)), - 0); + Duration dur (2 + max (beamlet_count (i, LEFT), + beamlet_count (i, RIGHT)), + 0); - return infos_.at (i).start_moment_ + dur->get_length (); + return infos_.at (i).start_moment_ + + infos_.at(i).factor_ * dur.get_length (); } bool