From: Jan Nieuwenhuizen Date: Mon, 14 Aug 2000 21:46:57 +0000 (+0200) Subject: patch::: 1.3.78.jcn2 X-Git-Tag: release/1.3.79~4 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=038d4f3968d1589e5438538fb8d704f007eb4908;p=lilypond.git patch::: 1.3.78.jcn2 1.3.78.jcn2 =========== * Fixed part combiner's too-late problem (Dankje!) --- diff --git a/CHANGES b/CHANGES index 983fbc6e78..4209f65e2e 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,8 @@ +1.3.78.jcn2 +=========== + +* Fixed part combiner's too-late problem (Dankje!) + 1.3.78.jcn1 =========== @@ -5,7 +10,7 @@ * Renamed part combiner music names to "one", "two". -* Cleaned up property setting of part combiner, renamed to "solo"/"unison" +* Cleaned up decision making in part combiner, renamed to "solo"/"unison" 1.3.77.jcn5 diff --git a/VERSION b/VERSION index c1932a9645..71350ddb6a 100644 --- a/VERSION +++ b/VERSION @@ -2,7 +2,7 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=1 MINOR_VERSION=3 PATCH_LEVEL=78 -MY_PATCH_LEVEL=jcn1 +MY_PATCH_LEVEL=jcn2 # use the above to send patches: MY_PATCH_LEVEL is always empty for a # released version. diff --git a/lily/a2-engraver.cc b/lily/a2-engraver.cc index 2aedb05b20..76b6e69264 100644 --- a/lily/a2-engraver.cc +++ b/lily/a2-engraver.cc @@ -113,6 +113,8 @@ A2_engraver::acknowledge_element (Score_element_info i) if (Stem::has_interface (i.elem_l_)) { + Item *stem_l = dynamic_cast (i.elem_l_); + SCM unirhythm = get_property ("unirhythm"); SCM unison = get_property ("unison"); SCM solo = get_property ("solo"); @@ -121,25 +123,19 @@ A2_engraver::acknowledge_element (Score_element_info i) /* This still needs some work. */ - if ((unirhythm != SCM_BOOL_T && solo != SCM_BOOL_T)) -#if 0 - /* - Apart from the uglyness of this, we can't do this yet - because to get up/down stems for small intervals, we - need Part_combine_music_iterator to uncombine the - voices (while still setting unison). - */ + if ((unirhythm != SCM_BOOL_T && solo != SCM_BOOL_T) || (unirhythm == SCM_BOOL_T && gh_number_p (interval) && gh_scm2int (interval) < 3)) -#endif { if (daddy_trans_l_->id_str_ == "one") { - Directional_element_interface (i.elem_l_).set (UP); + //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 (i.elem_l_).set (DOWN); + //Directional_element_interface (stem_l).set (DOWN); + stem_l->set_elt_property ("direction", gh_int2scm (-1)); } } } diff --git a/lily/include/part-combine-music-iterator.hh b/lily/include/part-combine-music-iterator.hh index dcf86214e8..60cbebc8fc 100644 --- a/lily/include/part-combine-music-iterator.hh +++ b/lily/include/part-combine-music-iterator.hh @@ -33,7 +33,7 @@ private: Music_iterator * first_iter_p_; Music_iterator * second_iter_p_; - bool unirhythm_b_; + bool combined_b_; }; #endif /* PART_COMBINE_MUSIC_ITERATOR_HH */ diff --git a/lily/part-combine-music-iterator.cc b/lily/part-combine-music-iterator.cc index 6933b2bd1c..ceeadef5d6 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 () { - unirhythm_b_ = false; + combined_b_ = false; first_iter_p_ = 0; second_iter_p_ = 0; @@ -119,7 +119,6 @@ Part_combine_music_iterator::do_process_and_next (Moment m) Part_combine_music const * p = dynamic_cast (music_l_); - String to_id = unirhythm_b_ ? "one" : "two"; /* different rhythm for combined voices: separate same rhythm for separated voices: combine @@ -132,25 +131,7 @@ Part_combine_music_iterator::do_process_and_next (Moment m) use + junk the result, and then do the real process_and_next...? */ - if ((first_next != second_next && unirhythm_b_) - || (first_next == second_next && !unirhythm_b_)) - { - unirhythm_b_ = !unirhythm_b_; - to_id = unirhythm_b_ ? "one" : "two"; - change_to (second_iter_p_, p->what_str_, to_id); - } - Translator_group * fd = - first_iter_p_->report_to_l ()->find_create_translator_l (p->what_str_, - "one"); - Translator_group * sd = - second_iter_p_->report_to_l ()->find_create_translator_l (p->what_str_, - to_id); - - fd->set_property ("unirhythm", unirhythm_b_ ? SCM_BOOL_T : SCM_BOOL_F); - sd->set_property ("unirhythm", unirhythm_b_ ? SCM_BOOL_T : SCM_BOOL_F); - first_iter_p_->report_to_l ()->set_property ("unirhythm", unirhythm_b_ ? SCM_BOOL_T : SCM_BOOL_F); - second_iter_p_->report_to_l ()->set_property ("unirhythm", unirhythm_b_ ? SCM_BOOL_T : SCM_BOOL_F); if (first_next <= m) first_iter_p_->process_and_next (m); @@ -162,16 +143,14 @@ Part_combine_music_iterator::do_process_and_next (Moment m) /* TODO: - - * "a2" string is fine, but "Soli" strings are one request late?? - - The problem seems to be: we need to do_try_music for the - spanish_inquisition to work; but the properties that we set - need to be set *before* we do_try_music? - - * setting of stem directions by a2-engraver don't work - * separate for small ( <3 ?) intervals too + * setting of stem directions by a2-engraver don't work !! + + * 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): @@ -200,46 +179,82 @@ 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); - if ((first_next == second_next) + SCM interval = SCM_BOOL_F; + if (first_spanish_inquisition->pitch_arr_.size () + && second_spanish_inquisition->pitch_arr_.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 ()); + } + + + 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 unirhythm_b = (first_next == second_next) && !solo; + + bool too_close_b = false; + if (gh_number_p (interval) && gh_scm2int (interval) < 3) + too_close_b = true; + + String to_id = combined_b_ ? "one" : "two"; + if ((!unirhythm_b && combined_b_) + || (unirhythm_b && !combined_b_) + || (too_close_b && combined_b_) + || (solo && combined_b_)) + { + 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 (); + + Translator_group * fd = fir->find_create_translator_l (p->what_str_, "one"); + Translator_group * sd = sir->find_create_translator_l (p->what_str_, "two"); + + 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); + + 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); - first_iter_p_->report_to_l ()->set_property ("unison", SCM_BOOL_T); - second_iter_p_->report_to_l ()->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); - first_iter_p_->report_to_l ()->set_property ("unison", SCM_BOOL_F); - second_iter_p_->report_to_l ()->set_property ("unison", SCM_BOOL_F); + fir->set_property ("unison", SCM_BOOL_F); + sir->set_property ("unison", SCM_BOOL_F); } - if (first_spanish_inquisition->pitch_arr_.size () && - second_spanish_inquisition->pitch_arr_.size ()) - { - first_spanish_inquisition->pitch_arr_.sort (Musical_pitch::compare); - second_spanish_inquisition->pitch_arr_.sort (Musical_pitch::compare); - SCM interval = gh_int2scm (first_spanish_inquisition->pitch_arr_.top ().semitone_pitch () - - second_spanish_inquisition->pitch_arr_[0].semitone_pitch ()); - fd->set_property ("interval", interval); - sd->set_property ("interval", interval); - first_iter_p_->report_to_l ()->set_property ("interval", interval); - second_iter_p_->report_to_l ()->set_property ("interval", interval); - } + 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); - first_iter_p_->report_to_l ()->set_property ("solo", SCM_BOOL_T); + fir->set_property ("solo", SCM_BOOL_T); } else { fd->set_property ("solo", SCM_BOOL_F); - first_iter_p_->report_to_l ()->set_property ("solo", SCM_BOOL_F); + fir->set_property ("solo", SCM_BOOL_F); } @@ -247,14 +262,15 @@ Part_combine_music_iterator::do_process_and_next (Moment m) && second_spanish_inquisition->pitch_arr_.size ()) { sd->set_property ("solo", SCM_BOOL_T); - second_iter_p_->report_to_l ()->set_property ("solo", SCM_BOOL_T); + sir->set_property ("solo", SCM_BOOL_T); } else { sd->set_property ("solo", SCM_BOOL_F); - second_iter_p_->report_to_l ()->set_property ("solo", SCM_BOOL_F); + sir->set_property ("solo", SCM_BOOL_F); } + first_spanish_inquisition->pitch_arr_.clear (); second_spanish_inquisition->pitch_arr_.clear (); }