Am Mittwoch, 10. August 2011, 17:11:44 schrieb Ricardo Wurmus: > On Aug 10, Neil Puttock wrote: > > BTW, if you're prepared to wrap the notes in a chord (so you have > > access to 'articulations), you won't even need a scheme engraver (all > > the processing can take place in the NoteHead's stencil callback). > > It should be a generic engraver, so I cannot assume that notes will > always be wrapped in a chord. I'll play around with defining a function > for process-acknowledged and see where it leads me.
One detail that might be interesting for you is that you can define engraver- wide variables by wrapping the whole engraver in a (let (..) ...) block. See e.g. the scheme engraver instance regtest (input/regression/scheme- engraver-instance.ly in the source code tree): \header { texidoc = "Scheme engravers may be instantiated, with instance-scoped slots, by defining a 1 argument procedure which shall return the engraver definition as an alist, with the private slots defined in a closure. The argument procedure argument is the context where the engraver is instantiated." } \version "2.14.0" \layout { \context { \Voice \consists #(let ((instance-counter 0)) (lambda (context) (set! instance-counter (1+ instance-counter)) (let ((instance-id instance-counter) (private-note-counter 0)) `((listeners (note-event . ,(lambda (engraver event) (set! private-note-counter (1+ private-note-counter)) (let ((text (ly:engraver-make-grob engraver 'TextScript event))) (ly:grob-set-property! text 'text (format #f "~a.~a" instance-id private-note- counter)))))))))) } } << \relative c'' { c4 d e f } \\ \relative c' { c4 d e f } >> In this example, instance-counter is a global variable, which is reused by every voice, while instance-id and private-note-counter are variables that are separate for each voice. In this example, instance-id stores the number of the voice, while private-note-counter counts the number of notes in each voice separately. In particular, the engravers used in the first and in the second voice will have different private-note-counter variables. You can use this to collect information from all encountered objects and thin in 'process-acknowledged or 'stop-translation-timestep procell all of them at once. For a list of all possible "functions" inside the engraver, see input/regression/scheme-engraver.ly Cheers, Reinhold -- ------------------------------------------------------------------ Reinhold Kainhofer, reinh...@kainhofer.com, http://reinhold.kainhofer.com/ * Financial & Actuarial Math., Vienna Univ. of Technology, Austria * http://www.fam.tuwien.ac.at/, DVR: 0005886 * LilyPond, Music typesetting, http://www.lilypond.org _______________________________________________ lilypond-devel mailing list lilypond-devel@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-devel