From 6ab9d112bb3ef60bcf04255f39d10dc6a4ad8ed0 Mon Sep 17 00:00:00 2001 From: Dan Eble Date: Sun, 31 May 2015 16:23:20 -0400 Subject: [PATCH 1/1] Issue 4429: fix timekeeping in Auto_change_iterator and Part_combine_iterator Issue 4430: add start-callback to UnrelativableMusic --- input/regression/autochange-inside-grace.ly | 18 ++++++++++++++++++ input/regression/autochange-with-grace.ly | 17 +++++++++++++++++ input/regression/part-combine-inside-grace.ly | 15 +++++++++++++++ input/regression/part-combine-with-grace.ly | 14 ++++++++++++++ lily/auto-change-iterator.cc | 7 +------ lily/part-combine-iterator.cc | 10 +--------- scm/define-music-types.scm | 1 + 7 files changed, 67 insertions(+), 15 deletions(-) create mode 100644 input/regression/autochange-inside-grace.ly create mode 100644 input/regression/autochange-with-grace.ly create mode 100644 input/regression/part-combine-inside-grace.ly create mode 100644 input/regression/part-combine-with-grace.ly diff --git a/input/regression/autochange-inside-grace.ly b/input/regression/autochange-inside-grace.ly new file mode 100644 index 0000000000..ac1079a62f --- /dev/null +++ b/input/regression/autochange-inside-grace.ly @@ -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 index 0000000000..262f42754a --- /dev/null +++ b/input/regression/autochange-with-grace.ly @@ -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 index 0000000000..b2ac560b08 --- /dev/null +++ b/input/regression/part-combine-inside-grace.ly @@ -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 index 0000000000..379a3504a5 --- /dev/null +++ b/input/regression/part-combine-with-grace.ly @@ -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 } + } +} diff --git a/lily/auto-change-iterator.cc b/lily/auto-change-iterator.cc index 4a34540de9..e72b53d9be 100644 --- a/lily/auto-change-iterator.cc +++ b/lily/auto-change-iterator.cc @@ -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 (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"), diff --git a/lily/part-combine-iterator.cc b/lily/part-combine-iterator.cc index 61bb19ed16..beffa45135 100644 --- a/lily/part-combine-iterator.cc +++ b/lily/part-combine-iterator.cc @@ -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 (scm_caar (split_list_)); - if (splitm && *splitm + start_moment_ > now) + if (splitm && *splitm > m) break; SCM tag = scm_cdar (split_list_); diff --git a/scm/define-music-types.scm b/scm/define-music-types.scm index cb6af4538b..e381fa2713 100644 --- a/scm/define-music-types.scm +++ b/scm/define-music-types.scm @@ -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)) )) -- 2.39.2