Hi David,
> Perhaps it would have been worthwhile creating a minimal example
> demonstrating the exact circumstance you actually need it for...
Your revised code — brilliant, as always! — appears to work perfectly on the
attached MWE of the exact circumstance I need.
I'll try it in my "real-world" score and report back.
Thanks!
Kieren.
%%% SNIPPET BEGINS
\version "2.19.64"
#(define (moment->string mom)
(if (zero? (ly:moment-grace mom))
(number->string (ly:moment-main mom))
(format "~sG~a" (ly:moment-main mom) (ly:moment-grace mom))))
Current_moment_engraver =
#(make-engraver
(acknowledgers
((text-script-interface self grob origin)
(let ((ctx (ly:translator-context self)))
(if (equal? (ly:grob-property grob 'text) "@")
(set! (ly:grob-property grob 'text)
#{ \markup \with-color #red
#(format "~a@~a" (ly:context-property ctx 'currentBarNumber)
(moment->string (ly:context-property ctx
'measurePosition))) #}))))))
#(ly:register-translator
Current_moment_engraver 'Current_moment_engraver
'((description . "\
This engraver replaces text scripts with a text of @code{@@} with
a red currentBarNumber@measurePosition indicator.")))
\layout {
\context {
\Score
\remove "Timing_translator"
\remove "Default_bar_line_engraver"
}
\context {
\Staff
\consists "Timing_translator"
\consists "Default_bar_line_engraver"
\consists "Current_moment_engraver"
}
}
<<
\new Staff { c d-"@" f g }
\new Staff { \time 3/4 c4 d f g2.-"@" }
>>
%%% SNIPPET ENDS
________________________________
Kieren MacMillan, composer
‣ website: www.kierenmacmillan.info
‣ email: [email protected]
_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user