]> git.donarmstrong.com Git - lilypond.git/commitdiff
Issue 4429: fix timekeeping in Auto_change_iterator and Part_combine_iterator
authorDan Eble <nine.fierce.ballads@gmail.com>
Sun, 31 May 2015 20:23:20 +0000 (16:23 -0400)
committerDan Eble <nine.fierce.ballads@gmail.com>
Thu, 11 Jun 2015 23:39:58 +0000 (19:39 -0400)
Issue 4430: add start-callback to UnrelativableMusic

input/regression/autochange-inside-grace.ly [new file with mode: 0644]
input/regression/autochange-with-grace.ly [new file with mode: 0644]
input/regression/part-combine-inside-grace.ly [new file with mode: 0644]
input/regression/part-combine-with-grace.ly [new file with mode: 0644]
lily/auto-change-iterator.cc
lily/part-combine-iterator.cc
scm/define-music-types.scm

diff --git a/input/regression/autochange-inside-grace.ly b/input/regression/autochange-inside-grace.ly
new file mode 100644 (file)
index 0000000..ac1079a
--- /dev/null
@@ -0,0 +1,18 @@
+\header {
+    texidoc = "Grace notes are placed on the appropriate staff."
+}
+
+\version "2.19.22"
+\layout { ragged-right = ##t }
+
+\score {
+  <<
+    \context Staff = "up" { s1 }
+    \context Staff = "down" {
+      \clef "bass"
+      r2
+      \grace { \autochange { e16 e'' } }
+      c'2
+    }
+  >>
+}
diff --git a/input/regression/autochange-with-grace.ly b/input/regression/autochange-with-grace.ly
new file mode 100644 (file)
index 0000000..262f427
--- /dev/null
@@ -0,0 +1,17 @@
+\header {
+    texidoc = "Grace notes are placed on the appropriate staff."
+}
+
+\version "2.19.22"
+\layout { ragged-right = ##t }
+
+\score {
+  <<
+    \context Staff = "up" { s1 }
+    \context Staff = "down" {
+      \clef "bass"
+      r2
+      \autochange { \grace { g8 g' } e'4 e }
+    }
+  >>
+}
diff --git a/input/regression/part-combine-inside-grace.ly b/input/regression/part-combine-inside-grace.ly
new file mode 100644 (file)
index 0000000..b2ac560
--- /dev/null
@@ -0,0 +1,15 @@
+\header {
+    texidoc = "The notes of the first chord share a stem but the notes of the second chord do not."
+}
+
+\version "2.19.22"
+\layout { ragged-right = ##t }
+
+\score {
+  \context Voice = "v" {
+    r2
+    \grace { \partcombine \relative { e'16 e }
+                          \relative { c'16 f } }
+    c'2
+  }
+}
diff --git a/input/regression/part-combine-with-grace.ly b/input/regression/part-combine-with-grace.ly
new file mode 100644 (file)
index 0000000..379a350
--- /dev/null
@@ -0,0 +1,14 @@
+\header {
+    texidoc = "Grace notes in parts are combined."
+}
+
+\version "2.19.22"
+\layout { ragged-right = ##t }
+
+\score {
+  \new Voice = "v" {
+    r2
+    \partcombine { \grace g'8 e'4 \grace g'8 e'4 }
+                 { \grace e'8 c'4 \grace e'8 c'4 }
+  }
+}
index 4a34540de96dfb6cc67735ed0a484f406ce13945..e72b53d9bed764c6338607dadb52382864ce1850 100644 (file)
@@ -39,7 +39,6 @@ protected:
 private:
   SCM split_list_;
   Direction where_dir_;
-  Moment start_moment_;
 
   Context_handle up_;
   Context_handle down_;
@@ -50,15 +49,12 @@ Auto_change_iterator::process (Moment m)
 {
   Music_wrapper_iterator::process (m);
 
-  Moment now = get_outlet ()->now_mom ();
   Moment *splitm = 0;
-  if (start_moment_.main_part_.is_infinity () && start_moment_ < 0)
-    start_moment_ = now;
 
   for (; scm_is_pair (split_list_); split_list_ = scm_cdr (split_list_))
     {
       splitm = unsmob<Moment> (scm_caar (split_list_));
-      if ((*splitm + start_moment_) > now)
+      if (*splitm > m)
         break;
 
       SCM tag = scm_cdar (split_list_);
@@ -87,7 +83,6 @@ void
 Auto_change_iterator::construct_children ()
 {
   split_list_ = get_music ()->get_property ("split-list");
-  start_moment_ = get_outlet ()->now_mom ();
 
   SCM props = get_outlet ()->get_property ("trebleStaffProperties");
   Context *up = get_outlet ()->find_create_context (ly_symbol2scm ("Staff"),
index 61bb19ed165a15a6d66566196853135902f3debd..beffa45135acc941b9825c2e6c5551045fce12a7 100644 (file)
@@ -51,7 +51,6 @@ protected:
 private:
   static const size_t NUM_PARTS = 2;
   Music_iterator *iterators_[NUM_PARTS];
-  Moment start_moment_;
 
   SCM split_list_;
 
@@ -283,7 +282,6 @@ Part_combine_iterator::apart ()
 void
 Part_combine_iterator::construct_children ()
 {
-  start_moment_ = get_outlet ()->now_mom ();
   split_list_ = get_music ()->get_property ("split-list");
 
   SCM lst = get_music ()->get_property ("elements");
@@ -294,14 +292,8 @@ Part_combine_iterator::construct_children ()
 void
 Part_combine_iterator::process (Moment m)
 {
-  Moment now = get_outlet ()->now_mom ();
   Moment *splitm = 0;
 
-  /* This is needed if construct_children was called before iteration
-     started */
-  if (start_moment_.main_part_.is_infinity () && start_moment_ < 0)
-    start_moment_ = now;
-
   Context *prev_active_outlets[NUM_PARTS];
   for (size_t i = 0; i < NUM_PARTS; i++)
     prev_active_outlets[i] = iterators_[i]->get_outlet ();
@@ -309,7 +301,7 @@ Part_combine_iterator::process (Moment m)
   for (; scm_is_pair (split_list_); split_list_ = scm_cdr (split_list_))
     {
       splitm = unsmob<Moment> (scm_caar (split_list_));
-      if (splitm && *splitm + start_moment_ > now)
+      if (splitm && *splitm > m)
         break;
 
       SCM tag = scm_cdar (split_list_);
index cb6af4538b33daec3ad8b1d532c9b3a459d4987c..e381fa2713398f41ec452bd302efe260110be881 100644 (file)
@@ -733,6 +733,7 @@ to absolute notation.  For example, transposed music.")
         (to-relative-callback . ,ly:relative-octave-music::no-relative-callback)
         (iterator-ctor . ,ly:music-wrapper-iterator::constructor)
         (length-callback . ,ly:music-wrapper::length-callback)
+        (start-callback . ,ly:music-wrapper::start-callback)
         (types . (music-wrapper-music unrelativable-music))
         ))