Hi David and all,
I stuck with successfully sending override-events from an engraver. I
created an example where I broadcast 3 events, one of them being an
override, but the override is not applied while the other 2 events are
processed as expected.
All events are sent using the same procedure. What might be the error in
this procedure. Is there something missing?
TIA
Jan-Peter
Am 05.03.2018 um 13:01 schrieb Jan-Peter Voigt:
* I will refactor the EE to also broadcast overrides.
\version "2.19.80"
% this is a broadcast-function for single events like \p or c''4
#(define (broadcast-music context music)
; get attributes for this music expression
(let ((evcls (ly:assoc-get (ly:music-property music 'name) music-descriptions '())))
; log time and music
(ly:message "~A ~A ~A"
(ly:context-property context 'currentBarNumber)
(ly:context-property context 'measurePosition)
(with-output-to-string (lambda() (displayLilyMusic music))))
; broadcast event
(ly:broadcast (ly:context-event-source context) ; broadcast to this context
(ly:make-stream-event
(ly:assoc-get 'types evcls '()) ; get event class from attributes
(ly:music-mutable-properties music)) ; get properties for this music-event
)
))
% 3 tests
evA = \p
evB = \once \override NoteHead.color = #red
evC = g'4
% a demo engraver
eng = #(make-engraver
((start-translation-timestep trans)
(let ((context (ly:translator-context trans)))
(cond
((equal? (ly:context-property context 'measurePosition) (ly:make-moment 1/4))
(broadcast-music context evA)) ; on moment 1/4 broadcast \p
((equal? (ly:context-property context 'measurePosition) (ly:make-moment 2/4))
(broadcast-music context evB)) ; on moment 2/4 broadcast \override ...
((equal? (ly:context-property context 'measurePosition) (ly:make-moment 3/4))
(broadcast-music context evC)) ; on moment 3/4 broadcast g'4
)))
)
\layout {
ragged-right = ##f
\context {
\Voice
\consists #eng
}
}
% demo music
% Why are the overrides not applied?
\relative {
\repeat unfold 3 { c''4 c^"p" c^"red?" c^"+g" }
}
_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel