Reviewers: J_lowe, dan_faithful.be,
Message:
I updated the patch and added a regtest.
Dan, I don't have time for now to rewrite the whole part combiner. Do
you want to do it ? If so, I can help you (at my level).
Bertrand
Description:
New partcombineUp and partcombineDown functions
Fix issue 1321
Please review this at http://codereview.appspot.com/4514042/
Affected files:
A input/regression/part-combine-3voices.ly
M lily/part-combine-iterator.cc
M ly/music-functions-init.ly
M scm/part-combiner.scm
Index: input/regression/part-combine-3voices.ly
diff --git a/input/regression/part-combine-3voices.ly
b/input/regression/part-combine-3voices.ly
new file mode 100644
index
..8dcb00966b4eec2b882b4562d9da3e49d79c96ab
--- /dev/null
+++ b/input/regression/part-combine-3voices.ly
@@ -0,0 +1,18 @@
+\version 2.15.10
+
+\header {
+ texidoc =It is possible to use the part combiner for three
+ voices with \\partcombineUp and \\partcombineDown.
+}
+
+
+soprano = { d''2 f'' g'' }
+alto = { a' c''4 d'' e''2 }
+tenor = { f'2 a'4 b' c''2 }
+basso = { d'4 e' f' g' g'2 }
+
+\new Staff \partcombineUp \soprano \alto \\ \basso
+
+\new Staff \soprano \\ \partcombineDown \tenor \basso
+
+
Index: lily/part-combine-iterator.cc
diff --git a/lily/part-combine-iterator.cc b/lily/part-combine-iterator.cc
index
4583d221f646ef9bcdc801dd46c4674366795fb3..9ab0495ae14ce909838c5498e5421d28590fd5bf
100644
--- a/lily/part-combine-iterator.cc
+++ b/lily/part-combine-iterator.cc
@@ -65,6 +65,11 @@ 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_;
@@ -133,6 +138,11 @@ 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;
playing_state_ = APART;
last_playing_ = APART;
@@ -349,6 +359,17 @@ 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 ();
@@ -369,6 +390,8 @@ Part_combine_iterator::construct_children ()
Context *two = handles_[CONTEXT_TWO].get_context ();
set_context (two);
second_iter_ = unsmob_iterator (get_iterator (unsmob_music (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
@@ -391,16 +414,20 @@ Part_combine_iterator::construct_children ()
{
SCM sym = ly_symbol2scm (*p);
execute_pushpop_property (one, sym,
-ly_symbol2scm (direction), scm_from_int
(1));
+ly_symbol2scm (direction),
directionOne_);
execute_pushpop_property (two, sym,
-ly_symbol2scm (direction), scm_from_int
(-1));
+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),
scm_from_int (0));
+ly_symbol2scm (horizontal-shift),
horizontalShiftOne_);
execute_pushpop_property (two, ly_symbol2scm (NoteColumn),
-ly_symbol2scm (horizontal-shift),
scm_from_int (1));
+ly_symbol2scm (horizontal-shift),
horizontalShiftTwo_);
/* Also handle MultiMeasureRest positions for voice 1/2 */
execute_pushpop_property (one, ly_symbol2scm (MultiMeasureRest),
ly_symbol2scm (staff-position), scm_from_int
(4));
Index: ly/music-functions-init.ly
diff --git a/ly/music-functions-init.ly b/ly/music-functions-init.ly
index
b3a009860753c54d7ab7549617ab4ba6f32d3ae5..1419daa808f7ebf5e65f33cb9116b940d1fdda67
100644
--- a/ly/music-functions-init.ly
+++ b/ly/music-functions-init.ly
@@ -767,7 +767,21 @@ partcombine =
(_i Take the music in @var{part1} and