From 1721767511b79e6e749c4220c2c21982976bc2d0 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Wed, 31 Mar 2004 10:44:46 +0000 Subject: [PATCH] * scm/part-combiner.scm (make-part-combine-music): don't do relative inside partcombine arguments. * scm/music-functions.scm (make-non-relative-music): new function. * Documentation/user/notation.itely (Automatic part combining): add note about \relative. --- ChangeLog | 8 +++++ Documentation/user/notation.itely | 59 +++++++++++++++++++++++++------ scm/music-functions.scm | 7 +++- scm/part-combiner.scm | 6 ++-- 4 files changed, 65 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2a0f5b5239..e0a20fd85a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2004-03-31 Han-Wen Nienhuys + * scm/part-combiner.scm (make-part-combine-music): don't do + relative inside partcombine arguments. + + * scm/music-functions.scm (make-non-relative-music): new function. + + * Documentation/user/notation.itely (Automatic part combining): + add note about \relative. + * lily/part-combine-iterator.cc (construct_children): add start_moment_ member. diff --git a/Documentation/user/notation.itely b/Documentation/user/notation.itely index 6e463b197c..d9e3bc517e 100644 --- a/Documentation/user/notation.itely +++ b/Documentation/user/notation.itely @@ -2995,12 +2995,28 @@ require arcane command incantations. See Voices can switch automatically between the top and the bottom staff. The syntax for this is + +@quotation @example - \autochange \context Voice @{ @dots{}@var{music}@dots{} @} +\autochange \context Voice @{ @dots{}@var{music}@dots{} @} @end example +@end quotation + +@noindent The two staves of the piano staff must be named @code{up} and @code{down}. +A @code{\relative} section that is outside of @code{\autochange} has +no effect on the pitches of @var{music}, so, if necessary, put +@code{\relative} inside @code{\autochange} like + +@quotation +@example +\autochange \relative @dots{} \new Voice @dots{} +@end example +@end quotation + + The autochanger switches on basis of pitch (middle C is the turning point), and it looks ahead skipping over rests to switch in advance. Here is a practical example @@ -3035,6 +3051,14 @@ The staff switches often do not end up in optimal places. For high quality output, staff switches should be specified manually. +@code{\autochange} cannot be inside @code{\times}. + +Internally, the @code{\partcombine} interprets both arguments as +@code{Voice}s named @code{one} and @code{two}, and then decides when +the parts can be combined. Consequently, if the arguments switch to +differently named @internalsref{Voice} contexts, the events in those +will be ignored. + @node Manual staff switches @subsection Manual staff switches @@ -4235,8 +4259,8 @@ the name to avoid a collision. @cindex transposition of pitches @cindex @code{\transpose} -A music expression can be transposed with @code{\transpose}. The syntax -is +A music expression can be transposed with @code{\transpose}. The +syntax is @example \transpose @var{from} @var{to} @var{musicexpr} @end example @@ -4418,23 +4442,34 @@ places where the two parts differ, they are typeset as separate voices, and stem directions are set automatically. Also, solo and @emph{a due} parts are identified and can be marked. - The syntax for part combining is @example \partcombine @var{musicexpr1} @var{musicexpr2} @end example -The music expressions will be interpreted as @internalsref{Voice} contexts. +The music expressions will be interpreted as @internalsref{Voice} +contexts. If using relative octaves, @code{\relative} should be +specified for both music expressions, i.e. + +@example +\partcombine \relative @dots{} @var{musicexpr1} + \relative @dots{} @var{musicexpr2} +@end example + +@noindent +A @code{\relative} section that is outside of @code{\partcombine} has +no effect on the pitches of @var{musicexpr1} and @var{musicexpr2}. + The following example demonstrates the basic functionality of the part combiner: putting parts on one staff, and setting stem directions and polyphony -@lilypond[quote,verbatim,raggedright,fragment,relative=2] +@lilypond[quote,verbatim,raggedright,fragment] \new Staff \partcombine - { g g a( b) c c r r } - { g g r4 r e e g g } + \relative g' { g g a( b) c c r r } + \relative g' { g g r4 r e e g g } @end lilypond The first @code{g} appears only once, although it was @@ -4451,8 +4486,8 @@ may set the property @code{soloADue} to false \new Staff << \set Staff.soloADue = ##f \partcombine - { g a( b) r } - { g r4 r f } + \relative g' { g a( b) r } + \relative g' { g r4 r f } >> @end lilypond @@ -4469,7 +4504,9 @@ In @code{soloADue} mode, when the two voices play the same notes on and off, the part combiner may typeset @code{a2} more than once in a measure. -@code{\partcombine} can not be inside @code{\times}. +@code{\partcombine} cannot be inside @code{\times}. + +@code{\partcombine} cannot be inside @code{\relative}. Internally, the @code{\partcombine} interprets both arguments as @code{Voice}s named @code{one} and @code{two}, and then decides when diff --git a/scm/music-functions.scm b/scm/music-functions.scm index ccda33da18..85d95339ad 100644 --- a/scm/music-functions.scm +++ b/scm/music-functions.scm @@ -217,12 +217,17 @@ i.e. this is not an override" cm)) -(define*-public (descend-to-context m context) +(define-public (descend-to-context m context) "Like context-spec-music, but only descending. " (let ((cm (context-spec-music m context))) (ly:music-set-property! cm 'descend-only #t) cm)) +(define-public (make-non-relative-music mus) + (make-music 'UnrelativableMusic + 'element mus + )) + (define-public (make-apply-context func) (make-music 'ApplyContext 'procedure func)) diff --git a/scm/part-combiner.scm b/scm/part-combiner.scm index 316878f0e5..99c28ea577 100644 --- a/scm/part-combiner.scm +++ b/scm/part-combiner.scm @@ -194,8 +194,8 @@ Voice-state objects (define-public (make-part-combine-music music-list) (let ((m (make-music 'PartCombineMusic)) - (m1 (context-spec-music (car music-list) 'Voice "one")) - (m2 (context-spec-music (cadr music-list) 'Voice "two"))) + (m1 (make-non-relative-music (context-spec-music (car music-list) 'Voice "one"))) + (m2 (make-non-relative-music (context-spec-music (cadr music-list) 'Voice "two")))) (set! (ly:music-property m 'elements) (list m1 m2)) (ly:run-translator m2 part-combine-listener) (ly:run-translator m1 part-combine-listener) @@ -463,7 +463,7 @@ the mark when there are no spanners active." (set! noticed '()) (let* ((m (make-music 'AutoChangeMusic)) - (context (ly:run-translator music part-combine-listener)) + (context (ly:run-translator (make-non-relative-music music) part-combine-listener)) (evs (last-pair noticed)) (split (reverse! (generate-split-list #f -- 2.39.2