From: Jan Nieuwenhuizen Date: Tue, 15 Aug 2000 20:30:41 +0000 (+0200) Subject: patch::: 1.3.78.jcn3 X-Git-Tag: release/1.3.79~3 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=c7f0e307fbca6cd8e225d34f5e2a56046c229d89;p=lilypond.git patch::: 1.3.78.jcn3 1.3.78.jcn3 =========== * Unhardcoded part combiner and a2-engraver; introduced properties splitInterval, soloADue, soloText, soloIIText, aDueText. --- diff --git a/CHANGES b/CHANGES index 4209f65e2e..d5e17b1fea 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,9 @@ +1.3.78.jcn3 +=========== + +* Unhardcoded part combiner and a2-engraver; introduced properties + splitInterval, soloADue, soloText, soloIIText, aDueText. + 1.3.78.jcn2 =========== diff --git a/VERSION b/VERSION index 71350ddb6a..410f982f50 100644 --- a/VERSION +++ b/VERSION @@ -2,7 +2,7 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=1 MINOR_VERSION=3 PATCH_LEVEL=78 -MY_PATCH_LEVEL=jcn2 +MY_PATCH_LEVEL=jcn3 # use the above to send patches: MY_PATCH_LEVEL is always empty for a # released version. diff --git a/input/bugs/almost.ly b/input/bugs/almost.ly new file mode 100644 index 0000000000..7276562718 --- /dev/null +++ b/input/bugs/almost.ly @@ -0,0 +1,18 @@ +\score{ + \context Staff < + \context Voice=one { \skip 1; } + \context Voice=two { \skip 1; } + + \context Voice=one \partcombine Voice + \context Thread=one \notes\relative c'' { + a4 c4.()g8 a4 + } + \context Thread=two \notes\relative c'' { + g4 e4.()d8 c4 + } + > + \paper{ + linewidth=60.\mm; + } +} + diff --git a/input/test/hymn.ly b/input/test/hymn.ly new file mode 100644 index 0000000000..8003c4dbd4 --- /dev/null +++ b/input/test/hymn.ly @@ -0,0 +1,32 @@ +\score{ + \context Staff < + \context Voice=one { \skip 1; } + \context Voice=two { \skip 1; } + + \context Voice=one \partcombine Voice + \context Thread=one \notes\relative c'' { + %a4 c4.()g8 a4 | + g4 e' g()f | + b, a c2 + } + \context Thread=two \notes\relative c'' { + %g4 e4.()d8 c4 | + g4 c, e()f | + d2 a + } + > + \paper{ + linewidth=140.\mm; + \translator { + \VoiceContext + soloADue = ##f + %\remove Slur_engraver; + \consists Slur_engraver; + } +% \translator { +% \ThreadContext +% \consists Slur_engraver; +% } + } +} + diff --git a/input/test/part-combine.ly b/input/test/part-combine.ly index 1213e9d1a9..40fe3fc007 100644 --- a/input/test/part-combine.ly +++ b/input/test/part-combine.ly @@ -10,6 +10,7 @@ b,4 d c d r2 e4 f c4 d e f + c d e f } \context Thread=two \notes\relative c'' { @@ -17,6 +18,10 @@ r2 c4 d a c c d a4. b8 c4 d + c d e f } > + \paper{ + linewidth = 100.\mm; + } } diff --git a/input/test/short-part-combine.ly b/input/test/short-part-combine.ly new file mode 100644 index 0000000000..89e907cf04 --- /dev/null +++ b/input/test/short-part-combine.ly @@ -0,0 +1,16 @@ +\score{ + \context Staff = one < + \context Voice=one { \skip 1; } + \context Voice=two { \skip 1; } + + \context Voice=one \partcombine Voice + \context Thread=one \notes\relative c'' + { + d e f + } + \context Thread=two \notes\relative c'' + { + d d d + } + > +} diff --git a/input/test/solo-a2.ly b/input/test/solo-a2.ly new file mode 100644 index 0000000000..e3054214df --- /dev/null +++ b/input/test/solo-a2.ly @@ -0,0 +1,19 @@ +\score{ + \context Staff = one < + \context Voice=one { \skip 1; } + \context Voice=two { \skip 1; } + + \context Voice=one \partcombine Voice + \context Thread=one \notes\relative c'' + { + e \property Voice.soloADue = ##f e + } + \context Thread=two \notes\relative c'' + { + e \property Voice.soloADue = ##f e + } + > + \paper{ + linewidth = 100.\mm; + } +} diff --git a/lily/a2-devnull-engraver.cc b/lily/a2-devnull-engraver.cc index e0f9545333..30638451d8 100644 --- a/lily/a2-devnull-engraver.cc +++ b/lily/a2-devnull-engraver.cc @@ -26,6 +26,7 @@ void A2_devnull_engraver::acknowledge_element (Score_element_info i) { if (daddy_trans_l_->id_str_ == "two" - && to_boolean (get_property ("unison"))) + && to_boolean (get_property ("unison")) + && to_boolean (get_property ("soloADue"))) i.elem_l_->suicide (); } diff --git a/lily/a2-engraver.cc b/lily/a2-engraver.cc index 76b6e69264..796056eb4d 100644 --- a/lily/a2-engraver.cc +++ b/lily/a2-engraver.cc @@ -28,7 +28,7 @@ protected: private: Item* text_p_; - enum State { NORMAL, UNISON, SOLO } state_; + enum State { NORMAL, SOLO, SPLIT_INTERVAL, UNISON } state_; }; ADD_THIS_TRANSLATOR (A2_engraver); @@ -41,59 +41,59 @@ A2_engraver::A2_engraver () void A2_engraver::do_process_music () -{ -} - - -void -A2_engraver::acknowledge_element (Score_element_info i) { if (!text_p_) { SCM unison = get_property ("unison"); + SCM unirhythm = get_property ("unirhythm"); SCM solo = get_property ("solo"); + SCM split_interval = get_property ("split-interval"); + SCM solo_adue = get_property ("soloADue"); - if ((solo == SCM_BOOL_T && state_ != SOLO) - || (unison == SCM_BOOL_T && state_ != UNISON)) + if (solo_adue == SCM_BOOL_T + && ((solo == SCM_BOOL_T && state_ != SOLO) + || (unison == SCM_BOOL_T && state_ != UNISON + && daddy_trans_l_->id_str_ == "one"))) { text_p_ = new Item (get_property ("basicTextScriptProperties")); Side_position::set_axis (text_p_, Y_AXIS); announce_element (text_p_, 0); - /* - Urg, read prop - */ - SCM text; Direction dir = UP; + SCM text; if (solo == SCM_BOOL_T) { state_ = SOLO; if (daddy_trans_l_->id_str_ == "one") - text = ly_str02scm ("Solo"); + { + text = get_property ("soloText"); + } else { - text = ly_str02scm ("Solo II"); + text = get_property ("soloIIText"); dir = DOWN; } } else if (unison == SCM_BOOL_T) { - text = ly_str02scm ("\\`a 2"); state_ = UNISON; + if (daddy_trans_l_->id_str_ == "one") + text = get_property ("aDueText"); } Side_position::set_direction (text_p_, dir); text_p_->set_elt_property ("text", text); - } + else if (unison == SCM_BOOL_T) + state_ = UNISON; + else if (unirhythm == SCM_BOOL_T && split_interval == SCM_BOOL_T) + state_ = SPLIT_INTERVAL; } -#if 0 } void A2_engraver::acknowledge_element (Score_element_info i) { -#endif if (text_p_) { if (Note_head::has_interface (i.elem_l_)) @@ -115,26 +115,22 @@ A2_engraver::acknowledge_element (Score_element_info i) { Item *stem_l = dynamic_cast (i.elem_l_); - SCM unirhythm = get_property ("unirhythm"); SCM unison = get_property ("unison"); + SCM unirhythm = get_property ("unirhythm"); SCM solo = get_property ("solo"); - SCM interval = get_property ("interval"); + SCM split_interval = get_property ("split-interval"); + SCM solo_adue = get_property ("soloADue"); - /* - This still needs some work. - */ if ((unirhythm != SCM_BOOL_T && solo != SCM_BOOL_T) - || (unirhythm == SCM_BOOL_T - && gh_number_p (interval) && gh_scm2int (interval) < 3)) + || (unirhythm == SCM_BOOL_T && split_interval == SCM_BOOL_T + && (unison != SCM_BOOL_T || solo_adue != SCM_BOOL_T))) { if (daddy_trans_l_->id_str_ == "one") { - //Directional_element_interface (stem_l).set (UP); stem_l->set_elt_property ("direction", gh_int2scm (1)); } else if (daddy_trans_l_->id_str_ == "two") { - //Directional_element_interface (stem_l).set (DOWN); stem_l->set_elt_property ("direction", gh_int2scm (-1)); } } diff --git a/lily/part-combine-music-iterator.cc b/lily/part-combine-music-iterator.cc index ceeadef5d6..e0e0d0a528 100644 --- a/lily/part-combine-music-iterator.cc +++ b/lily/part-combine-music-iterator.cc @@ -14,7 +14,7 @@ Part_combine_music_iterator::Part_combine_music_iterator () { - combined_b_ = false; + combined_b_ = true; first_iter_p_ = 0; second_iter_p_ = 0; @@ -119,20 +119,6 @@ Part_combine_music_iterator::do_process_and_next (Moment m) Part_combine_music const * p = dynamic_cast (music_l_); - /* - different rhythm for combined voices: separate - same rhythm for separated voices: combine - - Arg. Voices should be separated for small intervals, eg < 3. - This should be \property settable, and, we need the outcome - of the spanish_inquisition's... - - Can't we first do a process_and_next go into a fake/tmp tree, - use + junk the result, and then do the real process_and_next...? - - */ - - if (first_next <= m) first_iter_p_->process_and_next (m); @@ -144,14 +130,10 @@ Part_combine_music_iterator::do_process_and_next (Moment m) /* TODO: - * setting of stem directions by a2-engraver don't work !! + * fix rhythm check * check setting/resetting of properties - * use some unexpectedly handy abrvs. - - (customise) * separate for small ( <3 ?) intervals too - Later (because currently, we only handle thread switching, really): Maybe different modes exist? @@ -179,33 +161,57 @@ Part_combine_music_iterator::do_process_and_next (Moment m) second_spanish_inquisition = new Pitch_interrogate_req; Music_iterator* sit = second_iter_p_->try_music (second_spanish_inquisition); + Array* first_arr_l = &first_spanish_inquisition->pitch_arr_; + Array* second_arr_l = &second_spanish_inquisition->pitch_arr_; + SCM interval = SCM_BOOL_F; - if (first_spanish_inquisition->pitch_arr_.size () - && second_spanish_inquisition->pitch_arr_.size ()) + if (first_arr_l->size () && second_arr_l->size ()) { - first_spanish_inquisition->pitch_arr_.sort (Musical_pitch::compare); - second_spanish_inquisition->pitch_arr_.sort (Musical_pitch::compare); - interval = gh_int2scm (first_spanish_inquisition->pitch_arr_.top ().semitone_pitch ()); + first_arr_l->sort (Musical_pitch::compare); + second_arr_l->sort (Musical_pitch::compare); + interval = gh_int2scm (first_arr_l->top ().steps () + - (*second_arr_l)[0].steps ()); } - Translator_group * fir = first_iter_p_->report_to_l (); Translator_group * sir = second_iter_p_->report_to_l (); - bool solo = (first_spanish_inquisition->pitch_arr_.empty () - != second_spanish_inquisition->pitch_arr_.empty ()); + bool solo_b = (first_arr_l->empty () != second_arr_l->empty ()); - bool unirhythm_b = (first_next == second_next) && !solo; + /* + Urg, this doesn't work at all. Do we need to send out another inquisition? + */ + bool unirhythm_b = (first_next == second_next) && !solo_b; - bool too_close_b = false; - if (gh_number_p (interval) && gh_scm2int (interval) < 3) - too_close_b = true; + Translator_group * fd = fir->find_create_translator_l (p->what_str_, "one"); + Translator_group * sd = sir->find_create_translator_l (p->what_str_, "two"); + + 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; + } + + /* + Hmm, maybe we should set/check combined_b_ against + + first_iter_p_->report_to_l () == second_iter_p_->report_to_l () + + ? + */ String to_id = combined_b_ ? "one" : "two"; if ((!unirhythm_b && combined_b_) - || (unirhythm_b && !combined_b_) - || (too_close_b && combined_b_) - || (solo && combined_b_)) + || (split_interval_b && combined_b_) + || (solo_b && combined_b_) + || (unirhythm_b && !combined_b_ && !split_interval_b && !solo_b)) { combined_b_ = !combined_b_; to_id = combined_b_ ? "one" : "two"; @@ -215,64 +221,33 @@ Part_combine_music_iterator::do_process_and_next (Moment m) if (!combined_b_) sir = second_iter_p_->report_to_l (); - Translator_group * fd = fir->find_create_translator_l (p->what_str_, "one"); - Translator_group * sd = sir->find_create_translator_l (p->what_str_, "two"); + SCM b = unirhythm_b ? SCM_BOOL_T : SCM_BOOL_F; + fd->set_property ("unirhythm", b); + sd->set_property ("unirhythm", b); - fd->set_property ("unirhythm", unirhythm_b ? SCM_BOOL_T : SCM_BOOL_F); - sd->set_property ("unirhythm", unirhythm_b ? SCM_BOOL_T : SCM_BOOL_F); - fir->set_property ("unirhythm", unirhythm_b ? SCM_BOOL_T : SCM_BOOL_F); - sir->set_property ("unirhythm", unirhythm_b ? SCM_BOOL_T : SCM_BOOL_F); + b = split_interval_b ? SCM_BOOL_T : SCM_BOOL_F; + fd->set_property ("split-interval", b); + sd->set_property ("split-interval", b); - if (unirhythm_b - && !compare (&first_spanish_inquisition->pitch_arr_, - &second_spanish_inquisition->pitch_arr_)) - { - fd->set_property ("unison", SCM_BOOL_T); - sd->set_property ("unison", SCM_BOOL_T); - fir->set_property ("unison", SCM_BOOL_T); - sir->set_property ("unison", SCM_BOOL_T); - } - else - { - fd->set_property ("unison", SCM_BOOL_F); - sd->set_property ("unison", SCM_BOOL_F); - fir->set_property ("unison", SCM_BOOL_F); - sir->set_property ("unison", SCM_BOOL_F); - } + b = gh_bool2scm (unirhythm_b && !compare (first_arr_l, second_arr_l)); + fd->set_property ("unison", b); + sd->set_property ("unison", b); - fd->set_property ("interval", interval); - sd->set_property ("interval", interval); - fir->set_property ("interval", interval); - sir->set_property ("interval", interval); - - if (first_spanish_inquisition->pitch_arr_.size () - && !second_spanish_inquisition->pitch_arr_.size ()) - { - fd->set_property ("solo", SCM_BOOL_T); - fir->set_property ("solo", SCM_BOOL_T); - } - else + b = solo_b ? SCM_BOOL_T : SCM_BOOL_F; + if (first_arr_l->size ()) { - fd->set_property ("solo", SCM_BOOL_F); - fir->set_property ("solo", SCM_BOOL_F); + fd->set_property ("solo", b); + sd->set_property ("solo", SCM_BOOL_F); } - - if (!first_spanish_inquisition->pitch_arr_.size () - && second_spanish_inquisition->pitch_arr_.size ()) + if (second_arr_l->size ()) { - sd->set_property ("solo", SCM_BOOL_T); - sir->set_property ("solo", SCM_BOOL_T); - } - else - { - sd->set_property ("solo", SCM_BOOL_F); - sir->set_property ("solo", SCM_BOOL_F); + fd->set_property ("solo", SCM_BOOL_F); + sd->set_property ("solo", b); } - - first_spanish_inquisition->pitch_arr_.clear (); - second_spanish_inquisition->pitch_arr_.clear (); + first_arr_l->clear (); + second_arr_l->clear (); } Music_iterator* diff --git a/ly/engraver.ly b/ly/engraver.ly index 60399daa1b..16dbcfa15e 100644 --- a/ly/engraver.ly +++ b/ly/engraver.ly @@ -154,6 +154,12 @@ VoiceContext = \translator { startUnaChorda = #"una chorda" stopUnaChorda = #"tre chorde" + soloText = #"Solo" + soloIIText = #"Solo II" + aDueText = #"\\`a2" + soloADue = ##t + splitInterval = #'(0 . 1) + \consists "Piano_pedal_engraver"; \consists "Script_engraver"; \consists "Script_column_engraver";