lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Part combiner: move direction handling out of iterator (issue 226430043


From: nine . fierce . ballads
Subject: Part combiner: move direction handling out of iterator (issue 226430043 by address@hidden)
Date: Sat, 18 Apr 2015 03:40:06 +0000

Reviewers: ,

Description:
Part combiner: move direction handling out of iterator

Please review this at https://codereview.appspot.com/226430043/

Affected files (+18, -67 lines):
  M lily/part-combine-iterator.cc
  M ly/music-functions-init.ly
  M scm/part-combiner.scm


Index: lily/part-combine-iterator.cc
diff --git a/lily/part-combine-iterator.cc b/lily/part-combine-iterator.cc
index 2428d4a70fb41f26bfcbce5cd0e8dcb07c1a818f..653e338a91c9faaedba2dae3e784c98b1a0da2a0 100644
--- a/lily/part-combine-iterator.cc
+++ b/lily/part-combine-iterator.cc
@@ -65,11 +65,6 @@ private:
   Moment start_moment_;

   SCM split_list_;
-  SCM direction_;
-  SCM directionOne_;
-  SCM directionTwo_;
-  SCM horizontalShiftOne_;
-  SCM horizontalShiftTwo_;

   Stream_event *unisono_event_;
   Stream_event *solo_one_event_;
@@ -146,11 +141,6 @@ Part_combine_iterator::Part_combine_iterator ()
   first_iter_ = 0;
   second_iter_ = 0;
   split_list_ = SCM_EOL;
-  direction_ = SCM_BOOL_F;
-  directionOne_ = scm_from_int (1);
-  directionTwo_ = scm_from_int (-1);
-  horizontalShiftOne_ = scm_from_int (0);
-  horizontalShiftTwo_ = scm_from_int (1);
   state_ = APART;
   chosen_part_ = 1;
   playing_state_ = PLAYING_OTHER;
@@ -369,17 +359,6 @@ Part_combine_iterator::construct_children ()
 {
   start_moment_ = get_outlet ()->now_mom ();
   split_list_ = get_music ()->get_property ("split-list");
-  direction_ = get_music ()->get_property ("direction");
-  if (is_direction (direction_))
-    {
-      directionOne_ = direction_;
-      directionTwo_ = direction_;
-      if (scm_is_true (scm_negative_p (direction_)))
-        {
-          horizontalShiftOne_ = scm_from_int (1);
-          horizontalShiftTwo_ = scm_from_int (0);
-        }
-    }

   Context *c = get_outlet ();

@@ -402,44 +381,6 @@ Part_combine_iterator::construct_children ()
second_iter_ = Music_iterator::unsmob (get_iterator (Music::unsmob (scm_cadr (lst))));
   Context *shared = handles_[CONTEXT_SHARED].get_context ();
   set_context (shared);
-
- /* Mimic all settings of voiceOne/voiceTwo for the two separate voices...*/
-  /* FIXME: Is there any way to use the definition of \voiceOne/\voiceTwo
-            directly??? */
-  char const *syms[]
-  =
-  {
-    "Stem",
-    "DynamicLineSpanner",
-    "Tie",
-    "Dots",
-    "MultiMeasureRest",
-    "Rest",
-    "Slur",
-    "TextScript",
-    "Script",
-    0
-  };
-
-  for (char const **p = syms; *p; p++)
-    {
-      SCM sym = ly_symbol2scm (*p);
-      execute_pushpop_property (one, sym,
- ly_symbol2scm ("direction"), directionOne_);
-
-      execute_pushpop_property (two, sym,
- ly_symbol2scm ("direction"), directionTwo_);
-
-      if (scm_is_number (direction_))
-        execute_pushpop_property (shared, sym,
-                                  ly_symbol2scm ("direction"), direction_);
-    }
-  /* Handle horizontal shifts for crossing notes */
-  execute_pushpop_property (one, ly_symbol2scm ("NoteColumn"),
- ly_symbol2scm ("horizontal-shift"), horizontalShiftOne_);
-  execute_pushpop_property (two, ly_symbol2scm ("NoteColumn"),
- ly_symbol2scm ("horizontal-shift"), horizontalShiftTwo_);
-
 }

 IMPLEMENT_LISTENER (Part_combine_iterator, set_busy);
Index: ly/music-functions-init.ly
diff --git a/ly/music-functions-init.ly b/ly/music-functions-init.ly
index 9b1d36623baf9f115aa09fe774b51e3c29e02b97..53ad16fe3651f6d3e3cfd44d2493a983f77f34d2 100644
--- a/ly/music-functions-init.ly
+++ b/ly/music-functions-init.ly
@@ -1131,24 +1131,35 @@ a music expression containing simultaneous voices, where @var{part1}
 and @var{part2} are combined into one voice where appropriate.
 Optional @var{chord-range} sets the distance in steps between notes
 that may be combined into a chord or unison.")
-   (make-part-combine-music parser
-                            (list part1 part2) #f chord-range))
+   #{ \context Staff <<
+        \context Voice = "one" \with { \voiceOne } {}
+        \context Voice = "two" \with { \voiceTwo } {}
+        #(make-part-combine-music parser (list part1 part2) chord-range)
+      >> #} )

 partcombineUp =
 #(define-music-function (parser location chord-range part1 part2)
    ((number-pair? '(0 . 8)) ly:music? ly:music?)
    (_i "Take the music in @var{part1} and @var{part2} and typeset so
 that they share a staff with stems directed upward.")
-   (make-part-combine-music parser
-                            (list part1 part2) UP chord-range))
+   #{ \context Staff <<
+        \context Voice = "one" \with { \voiceOne } {}
+        \context Voice = "shared" \with { \voiceOne } {}
+        \context Voice = "two" \with { \voiceThree } {}
+        #(make-part-combine-music parser (list part1 part2) chord-range)
+      >> #} )

 partcombineDown =
 #(define-music-function (parser location chord-range part1 part2)
    ((number-pair? '(0 . 8)) ly:music? ly:music?)
    (_i "Take the music in @var{part1} and @var{part2} and typeset so
 that they share a staff with stems directed downward.")
-   (make-part-combine-music parser
-                            (list part1 part2) DOWN chord-range))
+   #{ \context Staff <<
+        \context Voice = "one" \with { \voiceFour } {}
+        \context Voice = "shared" \with { \voiceTwo } {}
+        \context Voice = "two" \with { \voiceTwo } {}
+        #(make-part-combine-music parser (list part1 part2) chord-range)
+      >> #} )

 partcombineForce =
#(define-music-function (location parser type once) (boolean-or-symbol? boolean?)
Index: scm/part-combiner.scm
diff --git a/scm/part-combiner.scm b/scm/part-combiner.scm
index ae51d0539be6796e5ebcc7d2088841a9f76d2ca4..d308c645be2cfa58a42c233160796c68dbb6d0a1 100644
--- a/scm/part-combiner.scm
+++ b/scm/part-combiner.scm
@@ -277,7 +277,7 @@ LilyPond version 2.8 and earlier."
      global)
     context-list))

-(define-public (make-part-combine-music parser music-list direction chord-range)
+(define-public (make-part-combine-music parser music-list chord-range)
   (let* ((m (make-music 'PartCombineMusic))
(m1 (make-non-relative-music (context-spec-music (first music-list) 'Voice "one"))) (m2 (make-non-relative-music (context-spec-music (second music-list) 'Voice "two")))
@@ -286,7 +286,6 @@ LilyPond version 2.8 and earlier."
          (evs1 (recording-group-emulate m1 listener)))

     (set! (ly:music-property m 'elements) (list m1 m2))
-    (set! (ly:music-property m 'direction) direction)
     (set! (ly:music-property m 'split-list)
           (if (and (assoc "one" evs1) (assoc "two" evs2))
               (determine-split-list (reverse! (assoc-get "one" evs1) '())





reply via email to

[Prev in Thread] Current Thread [Next in Thread]