%% \partcombine
\test ##[ \partcombine { c4 e4 }
-{ d4 f4 } #] % PartCombineMusic UnrelativableMusic
+{ d4 f4 } #]
+\test ##[ \partcombineUp { c2 e2 }
+{ d2 f2 } #]
+\test ##[ \partcombineDown { c1 e1 }
+{ d1 f1 } #]
%% Cue notes
\test ##[ \cueDuring #"foo" #1 { c4 d4 } #]
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_;
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;
{
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 ();
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);
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 } {}
+ \context Voice = "shared" {}
+ #(make-part-combine-music parser (list part1 part2) #f 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 = "two" \with { \voiceThree } {}
+ \context Voice = "shared" \with { \voiceOne } {}
+ #(make-part-combine-music parser (list part1 part2) UP 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 = "two" \with { \voiceTwo } {}
+ \context Voice = "shared" \with { \voiceTwo } {}
+ #(make-part-combine-music parser (list part1 part2) DOWN chord-range)
+ >> #} )
partcombineForce =
#(define-music-function (location parser type once) (boolean-or-symbol? boolean?)
(define-extra-display-method PartCombineMusic (expr parser)
(with-music-match (expr (music 'PartCombineMusic
+ direction ?dir
elements ((music 'UnrelativableMusic
element (music 'ContextSpeccedMusic
context-id "one"
context-id "two"
context-type 'Voice
element ?sequence2)))))
- (format #f "\\partcombine ~a~a~a"
+ (format #f "\\partcombine~a ~a~a~a"
+ (cond ((equal? ?dir UP) "Up")
+ ((equal? ?dir DOWN) "Down")
+ (else ""))
(music->lily-string ?sequence1 parser)
(new-line->lily-string)
(music->lily-string ?sequence2 parser))))
+(define-extra-display-method ContextSpeccedMusic (expr parser)
+ "If `expr' is a \\partcombine expression, return \"\\partcombine ...\".
+Otherwise, return #f."
+ (with-music-match
+ (expr (music 'ContextSpeccedMusic
+ context-type 'Staff
+ element (music 'SimultaneousMusic
+ elements ((music 'ContextSpeccedMusic
+ context-id "one"
+ context-type 'Voice)
+ (music 'ContextSpeccedMusic
+ context-id "two"
+ context-type 'Voice)
+ (music 'ContextSpeccedMusic
+ context-id "shared"
+ context-type 'Voice)
+ ?pc-music))))
+ (with-music-match
+ (?pc-music (music 'PartCombineMusic))
+ (format #f "~a" (music->lily-string ?pc-music parser)))))
+
(define-display-method UnrelativableMusic (expr parser)
(music->lily-string (ly:music-property expr 'element) parser))