]> git.donarmstrong.com Git - lilypond.git/commitdiff
Autobeaming works properly with tuplet recheck (Issue 2408)
authorCarl Sorensen <c_sorensen@byu.edu>
Sat, 17 Mar 2012 03:17:36 +0000 (21:17 -0600)
committerCarl Sorensen <c_sorensen@byu.edu>
Sat, 24 Mar 2012 15:40:25 +0000 (09:40 -0600)
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

input/regression/autobeam-tuplet-recheck.ly [new file with mode: 0644]
lily/beaming-pattern.cc

diff --git a/input/regression/autobeam-tuplet-recheck.ly b/input/regression/autobeam-tuplet-recheck.ly
new file mode 100644 (file)
index 0000000..024d467
--- /dev/null
@@ -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
+}
index f1408497cd3f0dafc5794faf8b838904caf38571..8f27c23ef57955f027151c4fd8e8b3d93a8fc9bc 100644 (file)
@@ -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