From: Jan Nieuwenhuizen Date: Wed, 20 Sep 2000 21:32:31 +0000 (+0200) Subject: patch::: 1.3.88.jcn1 X-Git-Tag: release/1.3.89~3 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=d8368ce94bf128266f7019c470ea6a208194fac2;p=lilypond.git patch::: 1.3.88.jcn1 1.3.88.jcn1 =========== * Added feature to part combiner that should allow part-switching only for entire measures. Currently, it is controlled by a new property changeMoments (A . B): - only switch when !(A mod now), - decide whether to switch based on music during time period B. * Made bugfix: Sequential_iterator::get_music (M): mustn't return music later than M. * Added skip (M) to some iterators. 1.3.88 ====== --- diff --git a/CHANGES b/CHANGES index 0ceb0ebc13..ee4762dde3 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,20 @@ +1.3.88.jcn1 +=========== + +* Added feature to part combiner that should allow part-switching only + for entire measures. Currently, it is controlled by a new + property changeMoments (A . B): + - only switch when !(A mod now), + - decide whether to switch based on music during time period B. + +* Made bugfix: Sequential_iterator::get_music (M): mustn't return music + later than M. + +* Added skip (M) to some iterators. + +1.3.88 +====== + 1.3.87.hwn1 =========== diff --git a/VERSION b/VERSION index b283fed4ca..75f47b1b5c 100644 --- a/VERSION +++ b/VERSION @@ -2,7 +2,7 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=1 MINOR_VERSION=3 PATCH_LEVEL=88 -MY_PATCH_LEVEL= +MY_PATCH_LEVEL=jcn1 # use the above to send patches: MY_PATCH_LEVEL is always empty for a # released version. diff --git a/input/test/part-combine-moments.ly b/input/test/part-combine-moments.ly new file mode 100644 index 0000000000..79c8ff46d9 --- /dev/null +++ b/input/test/part-combine-moments.ly @@ -0,0 +1,99 @@ +\score{ + \context PianoStaff < + \context StaffCombineStaff=one \skip 1*2; + \context StaffCombineStaff=two \skip 1*2; + \context StaffCombineStaff=one \partcombine StaffCombineStaff + \context StaffCombineVoice=one \notes\relative c'' + { + c4 d e f\break + c2 e4 f\break + } + \context StaffCombineVoice=two \notes\relative c'' + { + c4 d e f + c2 e2 + } + > + \paper { + + textheight = 295.0\mm; + linewidth = 180.0\mm; + + \translator{ \HaraKiriStaffContext } + % + % The Voice combine hierarchy + % + \translator{ + \ThreadContext + \name "VoiceCombineThread"; + \consists "Rest_engraver"; + } + \translator{ + \VoiceContext + \name "VoiceCombineVoice"; + soloText = #"I." + soloIIText = #"II." + \remove "Rest_engraver"; + \accepts "VoiceCombineThread"; + } + \translator{ + \HaraKiriStaffContext + \consists "Mark_engraver"; + \name "VoiceCombineStaff"; + \accepts "VoiceCombineVoice"; + } + + % + % The Staff combine hierarchy + % + \translator{ + \ThreadContext + \name "StaffCombineThread"; + } + \translator{ + \VoiceContext + \name "StaffCombineVoice"; + \accepts "StaffCombineThread"; + \consists "Thread_devnull_engraver"; + } + \translator { + \HaraKiriStaffContext + \name "StaffCombineStaff"; + \accepts "StaffCombineVoice"; + + soloADue = ##t + soloText = #"" + soloIIText = #"" + aDueText = #"" + splitInterval = #'(1 . 0) + changeMoment = #`(,(make-moment 1 1) . ,(make-moment 1 1)) + + } + \translator { + \StaffGroupContext + \accepts "VoiceCombineStaff"; + \accepts "StaffCombineStaff"; + } + \translator{ \HaraKiriStaffContext } + + \translator { + \ScoreContext + \accepts "VoiceCombineStaff"; + \accepts "StaffCombineStaff"; + skipBars = ##t + + barScriptPadding = #2.0 % dimension \pt + markScriptPadding = #4.0 + + %% urg: in pt? + barNumberScriptPadding = #15 + %% URG: this changes dynamics too + %%textStyle = #"italic" + timeSignatureStyle = #"C" + instrumentScriptPadding = #60 %% urg, this is in pt + instrScriptPadding = #40 %% urg, this is in pt + marginScriptHorizontalAlignment = #1 + maximumRestCount = #1 + } + } +} diff --git a/input/test/part-combine-staff.ly b/input/test/part-combine-staff.ly index 0446b20bd0..7590a333e0 100644 --- a/input/test/part-combine-staff.ly +++ b/input/test/part-combine-staff.ly @@ -1,7 +1,7 @@ \score{ \context PianoStaff < - \context StaffCombineStaff=one \skip 1*6; - \context StaffCombineStaff=two \skip 1*6; + \context StaffCombineStaff=one \skip 1*7; + \context StaffCombineStaff=two \skip 1*7; \context StaffCombineStaff=one \partcombine StaffCombineStaff \context StaffCombineVoice=one \notes\relative c'' { @@ -10,7 +10,8 @@ c d e f c4 d e f\break a8 a a a b b b b - a,4 a a a + a,4 a a a\break + c2 e4 f\break } \context StaffCombineVoice=two \notes\relative c'' { @@ -20,6 +21,7 @@ c,4 d e f a8 a a a b b b b a4 a a a + c2 e2 } > \paper { @@ -74,6 +76,7 @@ soloIIText = #"" aDueText = #"" splitInterval = #'(1 . 0) + changeMoment = #`(,(make-moment 1 1) . ,(make-moment 1 1)) } \translator { diff --git a/lily/grace-iterator.cc b/lily/grace-iterator.cc index ddcd3a401b..c2459b310e 100644 --- a/lily/grace-iterator.cc +++ b/lily/grace-iterator.cc @@ -27,7 +27,7 @@ Grace_iterator::construct_children () } void -Grace_iterator::process (Moment m) +Grace_iterator::process (Moment) { Global_translator * t = dynamic_cast(report_to_l ()); if (t) diff --git a/lily/include/music-iterator.hh b/lily/include/music-iterator.hh index 2f9c6cf7cc..25d099eccc 100644 --- a/lily/include/music-iterator.hh +++ b/lily/include/music-iterator.hh @@ -35,13 +35,10 @@ thus changing the state of the interpretation context. get_music (M) -- return all events starting at M (pre: no events - before M). Side effects: + before M). - * This removes all events at M from the pending queue. + skip (M) -- remove all events at M from the pending queue. - Because next (M) is rolled into process () as a side effect, - we need to roll next (M) into get_music too. Urg. - */ class Music_iterator { @@ -75,6 +72,7 @@ public: virtual bool ok () const; virtual SCM get_music (Moment until)const; virtual void process (Moment until); + virtual void skip (Moment until); /** Construct sub-iterators, and set the translator to diff --git a/lily/include/music-wrapper-iterator.hh b/lily/include/music-wrapper-iterator.hh index cbe4fa3827..d7a346a566 100644 --- a/lily/include/music-wrapper-iterator.hh +++ b/lily/include/music-wrapper-iterator.hh @@ -30,6 +30,7 @@ public: virtual Moment pending_moment () const; virtual bool ok () const; virtual SCM get_music (Moment)const; + virtual void skip (Moment); protected: virtual void process (Moment); diff --git a/lily/include/part-combine-music-iterator.hh b/lily/include/part-combine-music-iterator.hh index 4400e458ee..12ffb1aa12 100644 --- a/lily/include/part-combine-music-iterator.hh +++ b/lily/include/part-combine-music-iterator.hh @@ -18,6 +18,8 @@ public: VIRTUAL_COPY_CONS (Music_iterator); Part_combine_music_iterator (); + enum State { UNKNOWN, UNRELATED=1, SOLO1=2, SOLO2=4, UNIRHYTHM=8, UNISON=16, UNISILENCE=32, SPLIT_INTERVAL=64 }; + protected: virtual ~Part_combine_music_iterator (); @@ -30,11 +32,13 @@ protected: private: void change_to (Music_iterator*, String, String); + int get_state (Moment m); Music_iterator * first_iter_p_; Music_iterator * second_iter_p_; Moment first_until_; Moment second_until_; + int state_; }; #endif /* PART_COMBINE_MUSIC_ITERATOR_HH */ diff --git a/lily/include/sequential-music-iterator.hh b/lily/include/sequential-music-iterator.hh index 5661f260bd..92f0ecea5c 100644 --- a/lily/include/sequential-music-iterator.hh +++ b/lily/include/sequential-music-iterator.hh @@ -27,6 +27,7 @@ public: virtual Moment pending_moment () const; virtual bool ok () const; virtual SCM get_music (Moment)const; + virtual void skip (Moment); protected: virtual void process (Moment); diff --git a/lily/include/simple-music-iterator.hh b/lily/include/simple-music-iterator.hh index 6d86c1c35c..c9b861dce3 100644 --- a/lily/include/simple-music-iterator.hh +++ b/lily/include/simple-music-iterator.hh @@ -21,7 +21,8 @@ public: Simple_music_iterator (); Simple_music_iterator (Simple_music_iterator const &); virtual void process (Moment); - virtual bool ok()const; + virtual bool ok ()const; + virtual void skip (Moment); virtual Moment pending_moment ()const; virtual void construct_children (); }; diff --git a/lily/music-iterator.cc b/lily/music-iterator.cc index 51ae61f1ce..3806c4e7f7 100644 --- a/lily/music-iterator.cc +++ b/lily/music-iterator.cc @@ -85,6 +85,12 @@ Music_iterator::pending_moment () const } +void +Music_iterator::skip (Moment) +{ + assert (0); +} + void Music_iterator::process (Moment) { diff --git a/lily/music-wrapper-iterator.cc b/lily/music-wrapper-iterator.cc index 834494c88d..c052d14ff5 100644 --- a/lily/music-wrapper-iterator.cc +++ b/lily/music-wrapper-iterator.cc @@ -40,6 +40,12 @@ Music_wrapper_iterator::ok () const return child_iter_p_ && child_iter_p_->ok (); } +void +Music_wrapper_iterator::skip (Moment m) +{ + child_iter_p_->skip (m); +} + void Music_wrapper_iterator::process (Moment m) { diff --git a/lily/part-combine-music-iterator.cc b/lily/part-combine-music-iterator.cc index 9fa9bd7fe3..695331e35b 100644 --- a/lily/part-combine-music-iterator.cc +++ b/lily/part-combine-music-iterator.cc @@ -43,7 +43,6 @@ Part_combine_music_iterator::pending_moment () const bool Part_combine_music_iterator::ok () const { - //hmm return first_iter_p_->ok () || second_iter_p_->ok (); } @@ -107,170 +106,252 @@ Part_combine_music_iterator::change_to (Music_iterator *it, String to_type, error (_f ("none of these in my family: `%s'", to_id.ch_C ())); } -void -Part_combine_music_iterator::process (Moment m) -{ - /* - TODO: - - Use three named contexts (be it Thread or Voice): one, two, solo. - Let user pre-set (pushproperty) stem direction, remove - dynamic-engraver, and such. - - staff-combiner must switch only on per-measure basis (maybe even on - per-line-basis, but that's not feasible). Maybe set minimum lengths - of matching rhythm for combine/split? - */ - - Part_combine_music const * p = dynamic_cast (music_l_); - - Moment now = pending_moment (); - - Array first_pitches; - Array first_durations; - if (first_iter_p_->ok ()) +static void +get_music_info (Moment m, Music_iterator* iter, Array *pitches, Array *durations) +{ + if (iter->ok ()) { - /* get_music () also performs next, modifying iterator */ - Music_iterator *mi = first_iter_p_->clone (); - for (SCM i = mi->get_music (now); gh_pair_p (i); i = gh_cdr (i)) + for (SCM i = iter->get_music (m); gh_pair_p (i); i = gh_cdr (i)) { Music *m = unsmob_music (gh_car (i)); if (Melodic_req *r = dynamic_cast (m)) - first_pitches.push (r->pitch_); + pitches->push (r->pitch_); if (Rhythmic_req *r = dynamic_cast (m)) - first_durations.push (r->duration_); + durations->push (r->duration_); } - delete mi; } +} - Array second_pitches; - Array second_durations; - if (second_iter_p_->ok ()) - { - Music_iterator *mi = second_iter_p_->clone (); - for (SCM i = mi->get_music (now); gh_pair_p (i); i = gh_cdr (i)) - { - Music *m = unsmob_music (gh_car (i)); - if (Melodic_req *r = dynamic_cast (m)) - second_pitches.push (r->pitch_); - if (Rhythmic_req *r = dynamic_cast (m)) - second_durations.push (r->duration_); - } - delete mi; - } +int +Part_combine_music_iterator::get_state (Moment) +{ + int state = UNKNOWN; + Part_combine_music const *p = dynamic_cast (music_l_); + Translator_group *first_translator = first_iter_p_->report_to_l ()->find_create_translator_l (p->what_str_, "one"); + + SCM s = first_translator->get_property (ly_symbol2scm ("changeMoment")); + Moment change_mom = *unsmob_moment (gh_car (s)); + Moment diff_mom = *unsmob_moment (gh_cdr (s)); - SCM interval = SCM_BOOL_F; - if (first_pitches.size () && second_pitches.size ()) - { - first_pitches.sort (Musical_pitch::compare); - second_pitches.sort (Musical_pitch::compare); - interval = gh_int2scm (first_pitches.top ().steps () - - second_pitches[0].steps ()); - } - if (first_durations.size ()) - { - first_durations.sort (Duration::compare); - Moment new_until = now + first_durations.top ().length_mom (); - if (new_until > first_until_) - first_until_ = new_until; - } + Moment now = pending_moment (); - if (second_durations.size ()) + if (!now.mod_rat (change_mom)) { - second_durations.sort (Duration::compare); - Moment new_until = now + second_durations.top ().length_mom (); - if (new_until > second_until_) - second_until_ = new_until; - } + SCM interval = SCM_BOOL_F; + Moment first_mom = first_until_ - now; + Moment second_mom = second_until_ - now; + + bool first = true; + Music_iterator *first_iter = first_iter_p_->clone (); + Music_iterator *second_iter = second_iter_p_->clone (); + while ((first_mom ok () || second_iter->ok ())) + { + Moment m; + if (!second_iter->ok ()) + m = first_iter->pending_moment (); + else if (!first_iter->ok ()) + m = second_iter->pending_moment (); + else + m = first_iter->pending_moment () pending_moment (); + + Array first_pitches; + Array first_durations; + get_music_info (m, first_iter, &first_pitches, &first_durations); + + Array second_pitches; + Array second_durations; + get_music_info (m, second_iter, &second_pitches, &second_durations); + + if (first_pitches.size () && second_pitches.size ()) + { + first_pitches.sort (Musical_pitch::compare); + second_pitches.sort (Musical_pitch::compare); + interval = gh_int2scm (first_pitches.top ().steps () + - second_pitches[0].steps ()); + } + if (first_durations.size ()) + { + first_durations.sort (Duration::compare); + first_mom += first_durations.top ().length_mom (); + if (first) + first_until_ = first_mom + now; + } + + if (second_durations.size ()) + { + second_durations.sort (Duration::compare); + second_mom += second_durations.top ().length_mom (); + if (first) + second_until_ = second_mom + now; + } + first = false; #if 0 /* DEBUG */ - printf ("now: %s\n", now.str ().ch_C ()); - printf ("first: "); - for (int i = 0; i < first_pitches.size (); i++) - { - printf ("%s, ", first_pitches[i].str ().ch_C ()); - } - printf ("\nsecond: "); - for (int i = 0; i < second_pitches.size (); i++) - { - printf ("%s, ", second_pitches[i].str ().ch_C ()); - } - printf ("\n"); + printf ("now: %s\n", now.str ().ch_C ()); + printf ("first: "); + for (int i = 0; i < first_pitches.size (); i++) + { + printf ("%s, ", first_pitches[i].str ().ch_C ()); + } + printf ("\nsecond: "); + for (int i = 0; i < second_pitches.size (); i++) + { + printf ("%s, ", second_pitches[i].str ().ch_C ()); + } + printf ("\n"); #endif - Translator_group * fir = first_iter_p_->report_to_l (); - Translator_group * sir = second_iter_p_->report_to_l (); - - bool solo_b = (first_pitches.empty () != second_pitches.empty ()) - && !(first_until_ > now && second_until_ > now); - - bool unirhythm_b = !solo_b && !compare (&first_durations, &second_durations); - bool unison_b = unirhythm_b && !first_pitches.empty () - &&!compare (&first_pitches, &second_pitches); - bool unisilence_b = unirhythm_b && first_pitches.empty (); + if (!first_pitches.empty () && second_pitches.empty () + && !(second_until_ > now)) + { + state |= UNRELATED; + state &= ~UNISILENCE; + if (!(state & ~(UNRELATED | SOLO1 | UNISILENCE))) + state |= SOLO1; + } + else + state &= ~SOLO1; + + if (first_pitches.empty () && !second_pitches.empty () + && !(first_until_ > now)) + { + state |= UNRELATED; + state &= ~UNISILENCE; + if (!(state & ~(UNRELATED | SOLO2 | UNISILENCE))) + state |= SOLO2; + } + else + state &= ~SOLO2; + + if (!compare (&first_durations, &second_durations)) + { + state &= ~UNISILENCE; + if (!(state & ~(UNIRHYTHM | UNISON))) + state |= UNIRHYTHM; + } + else + state &= ~(UNIRHYTHM | UNISILENCE); + + if (!first_pitches.empty () + &&!compare (&first_pitches, &second_pitches)) + { + state &= ~UNISILENCE; + if (!(state & ~(UNIRHYTHM | UNISON))) + state |= UNISON; + } + else + state &= ~(UNISON); + + if (first_pitches.empty () && second_pitches.empty ()) + { + if (!(state & ~(UNIRHYTHM | UNISILENCE))) + state |= UNISILENCE; + } + else + state &= ~(UNISILENCE); + + if (gh_number_p (interval)) + { + SCM s = first_translator->get_property (ly_symbol2scm ("splitInterval")); + int i = gh_scm2int (interval); + if (gh_pair_p (s) + && gh_number_p (gh_car (s)) + && gh_number_p (gh_cdr (s)) + && i >= gh_scm2int (gh_car (s)) + && i <= gh_scm2int (gh_cdr (s))) + { + if (!(state & ~(SPLIT_INTERVAL | UNIRHYTHM | UNISON))) + state |= SPLIT_INTERVAL; + } + else + state &= ~(SPLIT_INTERVAL); + } + +#if 0 + Moment next = (first_mom ok ()) + first_iter->skip (next); + if (second_iter->ok ()) + second_iter->skip (next); +#else + if (first_iter->ok ()) + first_iter->skip (first_mom + now); + if (second_iter->ok ()) + second_iter->skip (second_mom + now); +#endif + } + delete first_iter; + delete second_iter; + } + return state; +} - Translator_group * fd = fir->find_create_translator_l (p->what_str_, "one"); - Translator_group * sd = sir->find_create_translator_l (p->what_str_, "two"); +void +Part_combine_music_iterator::process (Moment m) +{ - bool split_interval_b = false; - if (gh_number_p (interval)) - { - SCM s = fd->get_property (ly_symbol2scm ("splitInterval")); - int i = gh_scm2int (interval); - if (gh_pair_p (s) - && gh_number_p (gh_car (s)) - && gh_number_p (gh_cdr (s)) - && i >= gh_scm2int (gh_car (s)) - && i <= gh_scm2int (gh_cdr (s))) - split_interval_b = true; - } + /* + TODO: + - Use three named contexts (be it Thread or Voice): one, two, solo. + Let user pre-set (pushproperty) stem direction, remove + dynamic-engraver, and such. + */ + + int state = get_state (m); + if (state) + state_ = state; + else + state = state_; + + Part_combine_music const *p = dynamic_cast (music_l_); bool combined_b = first_iter_p_->report_to_l ()->daddy_trans_l_ == second_iter_p_->report_to_l ()->daddy_trans_l_; String to_id = combined_b ? "one" : "two"; - if ((!unirhythm_b && combined_b) - || (split_interval_b && combined_b) - || (solo_b && combined_b) - /*|| (unisilence_b && combined_b) */ - || ((unirhythm_b || unison_b || unisilence_b) - && !combined_b && !split_interval_b && !solo_b)) + if ((!(state & UNIRHYTHM) && combined_b) + || ((state & SPLIT_INTERVAL) && combined_b) + || ((state & (SOLO1 | SOLO2)) && combined_b) + || (((state & (UNIRHYTHM | UNISILENCE)) + && !combined_b && !(state & SPLIT_INTERVAL) + && !(state & (SOLO1 | SOLO2))))) { combined_b = !combined_b; to_id = combined_b ? "one" : "two"; change_to (second_iter_p_, p->what_str_, to_id); } - if (!combined_b) - sir = second_iter_p_->report_to_l (); - - SCM b = unirhythm_b ? SCM_BOOL_T : SCM_BOOL_F; - fd->set_property ("unirhythm", b); - sd->set_property ("unirhythm", b); - - b = split_interval_b ? SCM_BOOL_T : SCM_BOOL_F; - fd->set_property ("split-interval", b); - sd->set_property ("split-interval", b); - b = unisilence_b ? SCM_BOOL_T : SCM_BOOL_F; - fd->set_property ("unisilence", b); - sd->set_property ("unisilence", b); + Translator_group *first_translator = first_iter_p_->report_to_l ()->find_create_translator_l (p->what_str_, "one"); + Translator_group *second_translator = second_iter_p_->report_to_l ()->find_create_translator_l (p->what_str_, "two"); - b = unison_b ? SCM_BOOL_T : SCM_BOOL_F; - fd->set_property ("unison", b); - sd->set_property ("unison", b); - - b = solo_b ? SCM_BOOL_T : SCM_BOOL_F; - if (first_pitches.size ()) - { - fd->set_property ("solo", b); - sd->set_property ("solo", SCM_BOOL_F); - } - - if (second_pitches.size ()) - { - fd->set_property ("solo", SCM_BOOL_F); - sd->set_property ("solo", b); - } + /* + hmm + */ + SCM b = (state & UNIRHYTHM) ? SCM_BOOL_T : SCM_BOOL_F; + first_translator->set_property ("unirhythm", b); + second_translator->set_property ("unirhythm", b); + + b = (state & SPLIT_INTERVAL) ? SCM_BOOL_T : SCM_BOOL_F; + first_translator->set_property ("split-interval", b); + second_translator->set_property ("split-interval", b); + + b = (state & UNISILENCE) ? SCM_BOOL_T : SCM_BOOL_F; + first_translator->set_property ("unisilence", b); + second_translator->set_property ("unisilence", b); + + // difference in definition... + //b = ((state & UNISON) ? SCM_BOOL_T : SCM_BOOL_F; + b = ((state & UNISON) && (state & UNIRHYTHM)) ? SCM_BOOL_T : SCM_BOOL_F; + first_translator->set_property ("unison", b); + second_translator->set_property ("unison", b); + + SCM b1 = (state & SOLO1) ? SCM_BOOL_T : SCM_BOOL_F; + SCM b2 = (state & SOLO1) ? SCM_BOOL_T : SCM_BOOL_F; + first_translator->set_property ("solo", b1); + second_translator->set_property ("solo", b2); if (first_iter_p_->ok ()) first_iter_p_->process (m); diff --git a/lily/request-chord-iterator.cc b/lily/request-chord-iterator.cc index f463190a34..080240a8b5 100644 --- a/lily/request-chord-iterator.cc +++ b/lily/request-chord-iterator.cc @@ -45,9 +45,8 @@ Request_chord_iterator::elt_l () const return (Request_chord*) music_l_; } - SCM -Request_chord_iterator::get_music (Moment)const +Request_chord_iterator::get_music (Moment) const { SCM s = SCM_EOL; if (music_l_) @@ -65,7 +64,6 @@ Request_chord_iterator::get_music (Moment)const void Request_chord_iterator::process (Moment m) { - last_processed_mom_ = m; if (music_l_) { for (SCM s = dynamic_cast (music_l_)->music_list (); @@ -83,7 +81,6 @@ Request_chord_iterator::process (Moment m) mus->origin ()->warning (_f ("Huh? Not a Request: `%s'", classname (mus))); } - - music_l_ =0; } + skip (m); } diff --git a/lily/sequential-music-iterator.cc b/lily/sequential-music-iterator.cc index 975f460187..8e78b281e9 100644 --- a/lily/sequential-music-iterator.cc +++ b/lily/sequential-music-iterator.cc @@ -88,6 +88,32 @@ Sequential_music_iterator::set_sequential_music_translator() set_translator (child_report); } +void +Sequential_music_iterator::skip (Moment until) +{ + while (1) + { + SCM nm = iter_p_->get_music (until - here_mom_); + + Moment m = 0; + for (SCM i = nm; gh_pair_p(i); i = gh_cdr (i)) + m = m >? unsmob_music (gh_car (i))->length_mom (); + + delete iter_p_; + + cursor_ = gh_cdr (cursor_); + + iter_p_ = 0; + if (gh_pair_p (cursor_)) + iter_p_ = get_iterator_p (unsmob_music (gh_car (cursor_))); + else + return; + + if (m > Moment (0)) + return; + } +} + /* [todo: translate] @@ -110,9 +136,12 @@ Sequential_music_iterator::set_sequential_music_translator() redenering helderder is. */ +#if 1 SCM Sequential_music_iterator::get_music (Moment until)const { + if (until < pending_moment ()) + return SCM_EOL; SCM s = SCM_EOL; SCM curs = cursor_; Music_iterator * iter = iter_p_->clone (); @@ -138,6 +167,41 @@ Sequential_music_iterator::get_music (Moment until)const } return s; } +#else +SCM +Sequential_music_iterator::get_music (Moment until) const +{ + Sequential_music_iterator* i = dynamic_cast (this->clone ()); + SCM s = SCM_EOL; + while (1) + { + Moment local_until = until - i->here_mom_; + while (i->iter_p_->ok ()) + { + Moment here = i->iter_p_->pending_moment (); + if (here != local_until) + goto finalise; + + s = gh_append2 (i->iter_p_->get_music (local_until), s); + i->iter_p_->skip (local_until); + } + + if (!i->iter_p_->ok ()) + { + i->leave_element (); + + if (gh_pair_p (i->cursor_)) + i->start_next_element (); + else + goto finalise; + } + } + finalise: + delete i; + return s; +} +#endif + void Sequential_music_iterator::process (Moment until) diff --git a/lily/simple-music-iterator.cc b/lily/simple-music-iterator.cc index a25147d4e9..b185f8ac24 100644 --- a/lily/simple-music-iterator.cc +++ b/lily/simple-music-iterator.cc @@ -20,7 +20,8 @@ Simple_music_iterator::Simple_music_iterator () Simple_music_iterator::Simple_music_iterator (Simple_music_iterator const &src) : Music_iterator (src) { - last_processed_mom_ = -1; + last_processed_mom_ = src.last_processed_mom_; + length_mom_ = src.length_mom_; } void @@ -44,6 +45,13 @@ Simple_music_iterator::pending_moment ()const return length_mom_; } +void +Simple_music_iterator::skip (Moment m) +{ + music_l_ = 0; + last_processed_mom_ = m; +} + void Simple_music_iterator::process (Moment m) { @@ -59,6 +67,5 @@ Simple_music_iterator::process (Moment m) classname (music_l_))); } #endif - music_l_ = 0; - last_processed_mom_ = m; + skip (m); } diff --git a/ly/declarations-as.ly b/ly/declarations-as.ly index ceae9b08aa..d0caa74ac3 100644 --- a/ly/declarations-as.ly +++ b/ly/declarations-as.ly @@ -6,10 +6,11 @@ breve = \duration #'( -1 0) longa = \duration #'( -2 0 ) maxima = \duration #'( -3 0 ) -#(eval-string (ly-gulp-file "generic-property.scm")) - -% urg, move to basic property? -#(eval-string (ly-gulp-file "slur.scm")) +#(begin + (eval-string (ly-gulp-file "slur.scm")) + (eval-string (ly-gulp-file "generic-property.scm")) + (eval-string (ly-gulp-file "basic-properties.scm")) + ) \include "nederlands.ly" % dutch \include "chord-modifiers.ly" diff --git a/ly/engraver.ly b/ly/engraver.ly index 0fdd838bea..03e7cd9689 100644 --- a/ly/engraver.ly +++ b/ly/engraver.ly @@ -366,6 +366,7 @@ ScoreContext = \translator { aDueText = #"\\`a2" soloADue = ##t splitInterval = #'(0 . 1) + changeMoment = #`(,(make-moment 0 0) . ,(make-moment 1 512)) defaultClef = #"treble" diff --git a/ly/params-as.ly b/ly/params-as.ly index 58ab2b6bd2..f805540d69 100644 --- a/ly/params-as.ly +++ b/ly/params-as.ly @@ -15,6 +15,9 @@ indent = 8.0\char; staffspace = (\staffheight - 1.0 ) / 4.0; stafflinethickness = \staffspace / 2.0; +% deprecated +interline = \staffspace; + %{ The space taken by a note is determined by the formula @@ -26,8 +29,10 @@ arithmetic_basicspace. The smallest space is the one following the shortest note in the measure. Typically arithmetic_basicspace is set to the width of a quarter note head. %} +% quartwidth == 1.32 * staffspace arithmetic_basicspace = 2.; -arithmetic_multiplier = 0.9 * \quartwidth ; +%arithmetic_multiplier = 0.9 * \quartwidth ; +arithmetic_multiplier = 0.9 * 1.32 * \staffspace; % catch suspect beam slopes, set slope to zero if diff --git a/mutopia/Coriolan/coriolan-paper.ly b/mutopia/Coriolan/coriolan-paper.ly index 08cc643ca3..e8d1a3358c 100644 --- a/mutopia/Coriolan/coriolan-paper.ly +++ b/mutopia/Coriolan/coriolan-paper.ly @@ -1,4 +1,5 @@ \paper{ + \paper_sixteen textheight = 295.0\mm; linewidth = 180.0\mm; @@ -50,6 +51,7 @@ soloIIText = #"" aDueText = #"" splitInterval = #'(1 . 0) + changeMoment = #`(,(make-moment 1 1) . ,(make-moment 1 1)) } \translator { \StaffGroupContext diff --git a/mutopia/Coriolan/coriolan-part-combine-paper.ly b/mutopia/Coriolan/coriolan-part-combine-paper.ly index b78365c2a8..844bf454e3 100644 --- a/mutopia/Coriolan/coriolan-part-combine-paper.ly +++ b/mutopia/Coriolan/coriolan-part-combine-paper.ly @@ -50,6 +50,7 @@ soloIIText = #"" aDueText = #"" splitInterval = #'(1 . 0) + changeMoment = #`(,(make-moment 1 1) . ,(make-moment 1 1)) } \translator { \StaffGroupContext