]> git.donarmstrong.com Git - lilypond.git/commitdiff
patch::: 1.3.78.jcn3
authorJan Nieuwenhuizen <janneke@gnu.org>
Tue, 15 Aug 2000 20:30:41 +0000 (22:30 +0200)
committerJan Nieuwenhuizen <janneke@gnu.org>
Tue, 15 Aug 2000 20:30:41 +0000 (22:30 +0200)
1.3.78.jcn3
===========

* Unhardcoded part combiner and a2-engraver; introduced properties
  splitInterval, soloADue, soloText, soloIIText, aDueText.

CHANGES
VERSION
input/bugs/almost.ly [new file with mode: 0644]
input/test/hymn.ly [new file with mode: 0644]
input/test/part-combine.ly
input/test/short-part-combine.ly [new file with mode: 0644]
input/test/solo-a2.ly [new file with mode: 0644]
lily/a2-devnull-engraver.cc
lily/a2-engraver.cc
lily/part-combine-music-iterator.cc
ly/engraver.ly

diff --git a/CHANGES b/CHANGES
index 4209f65e2ee681deea244172ad8310985ee85191..d5e17b1feab23110744437bc292cac9b55d1690e 100644 (file)
--- 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 71350ddb6a87c4785cbc99fce1f1a132aebe9c48..410f982f500273210bd7260ccb2c52c7faf5eed2 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=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 (file)
index 0000000..7276562
--- /dev/null
@@ -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 (file)
index 0000000..8003c4d
--- /dev/null
@@ -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;
+%              }
+       }
+}
+
index 1213e9d1a92ebad244d74f1f550c8af281b20cc8..40fe3fc007747934d57558c2432e4bcecb17124b 100644 (file)
@@ -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''
                                {
                                        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 (file)
index 0000000..89e907c
--- /dev/null
@@ -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 (file)
index 0000000..e305421
--- /dev/null
@@ -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;
+       }
+}
index e0f95453334cba794430ade0653132e9c2c4c386..30638451d88107a4b9c48954d9cdbabbf744a085 100644 (file)
@@ -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 ();
 }
index 76b6e6926422b055eacc1f62a3d502aabf1e366d..796056eb4de1eb1f8df7d6b21d419c41c737a75c 100644 (file)
@@ -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<Item*> (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));
            }
        }
index ceeadef5d617909eeee985f5c4ec7b4c102ca244..e0e0d0a52861afae95c8b15151afd11722ad150e 100644 (file)
@@ -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<Part_combine_music const* > (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<Musical_pitch>* first_arr_l = &first_spanish_inquisition->pitch_arr_;
+  Array<Musical_pitch>* 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*
index 60399daa1bf62c93d5e8b1c0d0958e080751e1e7..16dbcfa15ef8ebbfcf8f2c2c8614f722aedb1e8e 100644 (file)
@@ -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";