]> git.donarmstrong.com Git - lilypond.git/commitdiff
patch::: 1.3.78.jcn2
authorJan Nieuwenhuizen <janneke@gnu.org>
Mon, 14 Aug 2000 21:46:57 +0000 (23:46 +0200)
committerJan Nieuwenhuizen <janneke@gnu.org>
Mon, 14 Aug 2000 21:46:57 +0000 (23:46 +0200)
1.3.78.jcn2
===========

* Fixed part combiner's too-late problem (Dankje!)

CHANGES
VERSION
lily/a2-engraver.cc
lily/include/part-combine-music-iterator.hh
lily/part-combine-music-iterator.cc

diff --git a/CHANGES b/CHANGES
index 983fbc6e78d548906108a3f698e558fdc5c90ab4..4209f65e2ee681deea244172ad8310985ee85191 100644 (file)
--- 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 c1932a964572ccf0c22983bd6c6efb6f27e84eef..71350ddb6a87c4785cbc99fce1f1a132aebe9c48 100644 (file)
--- 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.
index 2aedb05b2003ffcc8c863a7340775d2ee82b5161..76b6e6926422b055eacc1f62a3d502aabf1e366d 100644 (file)
@@ -113,6 +113,8 @@ A2_engraver::acknowledge_element (Score_element_info i)
          
   if (Stem::has_interface (i.elem_l_))
     {
+      Item *stem_l = dynamic_cast<Item*> (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));
            }
        }
     }
index dcf86214e86e522912c056fe05ce31c96a8ecbac..60cbebc8fc47b4d3754baa0d43c9fc91c4ac4848 100644 (file)
@@ -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 */
index 6933b2bd1c3eed751bb9e48d2a2b9ac6059a111d..ceeadef5d617909eeee985f5c4ec7b4c102ca244 100644 (file)
@@ -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<Part_combine_music const* > (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 ();
 }