One music type and concept less to worry about.
Since this tracks the partcombine decisions via context properties,
using one forced partcombine override in one voice will not be cancelled
by another forced partcombine in another.
In the event stream, \once\override is indistinguishable from
\override ... \revert so in order to be able to implement
\once\partcombine ... in one voice, we have to retain any permanent
\partcombineForce in the other.
\header {
texidoc ="Overrides for the part-combiner. All functions like
- @code{\\partcombineApart} and @code{\\partcombineApartOnce} are internally implemented
- using a dedicated @code{PartCombineForceEvent}.
-"
+ @code{\\partcombineApart} and @code{\\partcombineApartOnce} are
+ internally implemented using a dedicated @code{partCombineForced}
+ context property."
}
\layout { ragged-right = ##t }
#{ \with { \voiceTwo \override DynamicLineSpanner.direction = #DOWN } #}
#{ \with { \voiceTwo \override DynamicLineSpanner.direction = #DOWN } #} ))
-partcombineForce =
-#(define-music-function (type once) (boolean-or-symbol? boolean?)
- (_i "Override the part-combiner.")
- (make-music 'EventChord
- 'elements (list (make-music 'PartCombineForceEvent
- 'forced-type type
- 'once once))))
-partcombineApart = \partcombineForce #'apart ##f
-partcombineApartOnce = \partcombineForce #'apart ##t
-partcombineChords = \partcombineForce #'chords ##f
-partcombineChordsOnce = \partcombineForce #'chords ##t
-partcombineUnisono = \partcombineForce #'unisono ##f
-partcombineUnisonoOnce = \partcombineForce #'unisono ##t
-partcombineSoloI = \partcombineForce #'solo1 ##f
-partcombineSoloIOnce = \partcombineForce #'solo1 ##t
-partcombineSoloII = \partcombineForce #'solo2 ##f
-partcombineSoloIIOnce = \partcombineForce #'solo2 ##t
-partcombineAutomatic = \partcombineForce ##f ##f
-partcombineAutomaticOnce = \partcombineForce ##f ##t
+%% Part combine forcing to be found in ly/property-init.ly
partial =
#(define-music-function (dur) (ly:duration?)
(_i "Print @var{note} with a triangle-shaped note head.")
(style-note-heads 'NoteHead 'do note))
+%% part combiner
+
+partcombineForce =
+#(define-music-function (type) ((symbol?))
+ (_i "Override the part-combiner.")
+ (if type (propertySet 'partCombineForced type)
+ (propertyUnset 'partCombineForced)))
+
+partcombineApart = \partcombineForce #'apart
+partcombineApartOnce = \once \partcombineApart
+partcombineChords = \partcombineForce #'chords
+partcombineChordsOnce = \once \partcombineChords
+partcombineUnisono = \partcombineForce #'unisono
+partcombineUnisonoOnce = \once \partcombineUnisono
+partcombineSoloI = \partcombineForce #'solo1
+partcombineSoloIOnce = \once \partcombineSoloI
+partcombineSoloII = \partcombineForce #'solo2
+partcombineSoloIIOnce = \once \partcombineSoloII
+partcombineAutomatic = \partcombineForce \default
+partcombineAutomaticOnce = \once \partcombineAutomatic
+
%% phrasing slurs
translator during music interpretation.")
+ (partCombineForced ,symbol? "Override for the partcombine
+decision. Can be @code{apart}, @code{chords}, @code{unisono},
+@code{solo1}, or @code{solo2}.")
(partCombineTextsOnNote ,boolean? "Print part-combine texts only on
the next note rather than immediately on rests or skips.")
(pedalSostenutoStrings ,list? "See @code{pedalSustainStrings}.")
extender-event span-event rhythmic-event dynamic-event
break-event label-event percent-event key-change-event
string-number-event stroke-finger-event tie-event
- part-combine-event part-combine-force-event
+ part-combine-event
beam-forbid-event script-event tempo-change-event
tremolo-event bend-after-event fingering-event
glissando-event harmonic-event hyphen-event
(footnote-text ,markup? "Text to appear in a footnote.")
(force-accidental ,boolean? "If set, a cautionary accidental should
always be printed on this note.")
- (forced-type ,symbol? "Override for the part-combiner.")
(grob-property ,symbol? "The symbol of the grob property to set.")
(grob-property-path ,list? "A list of symbols, locating a nested grob
(types . (break-event page-turn-event event))
))
- (PartCombineForceEvent
- . ((description . "Override the part-combiner's strategy.")
- (types . (part-combine-force-event event))
- ))
-
(PartialSet
. ((description . "Create an anacrusis or upbeat (partial measure).")
(iterator-ctor . ,ly:partial-iterator::constructor)
(define (analyse-forced-combine result-idx prev-res)
(define (get-forced-event x)
- (and (ly:in-event-class? x 'part-combine-force-event)
- (cons (ly:event-property x 'forced-type)
- (ly:event-property x 'once))))
+ (cond
+ ((and (ly:in-event-class? x 'SetProperty)
+ (eq? (ly:event-property x 'symbol) 'partCombineForced))
+ (cons (ly:event-property x 'value #f)
+ (ly:event-property x 'once #f)))
+ ((and (ly:in-event-class? x 'UnsetProperty)
+ (eq? (ly:event-property x 'symbol) 'partCombineForced))
+ (cons #f (ly:event-property x 'once #f)))
+ (else #f)))
+
(define (part-combine-events vs)
(if (not vs)
'()