Hello, I'm currently attempting to write a custom engraver in scheme. This is the shortened code:
;; global variables to be used in `do-something' #(define g_filled #f) #(define g_direction 0) #(define g_finger 0) #(define g_string-number 0) ;; .... #(define-public (music-cause grob) (let* ((event (event-cause grob))) (if (ly:stream-event? event) (ly:event-property event 'music-cause) #f))) #(define my-engraver (list (cons 'acknowledgers (list (cons 'note-head-interface (lambda (engraver grob source-engraver) (let* ((event (event-cause grob)) (mus (music-cause grob)) ;; TODO: how do I get *into* this articulations list? (articulations (ly:music-property mus 'articulations))) ;; note head filling depends on duration (set! g_filled (ly:moment<? duration filled-threshold)) (do-something grob)))))) )) The `do-something' function (not shown here) replaces note heads according to variables that I hope to extract from the event data structure. In my code, the `mus' variable contains the music object, which has a property `articulations'. This is what the music object looks like when displaying it: #<Prob: Music C++: Music( (length . #<Mom 1/4>) (elements) (duration . #<Duration 4 >) (articulations #<Prob: Stream_event C++: Stream_event ((music-cause . #<Prob: Music C++: Music ((digit . 2) (origin . #<location test.ly:50:14>)) ((display-methods #<procedure #f (event parser)>) (name . FingeringEvent) (types general-music fingering-event event)) >) (digit . 2) (origin . #<location test.ly:50:14>)) ((class . fingering-event)) > ) (pitch . #<Pitch bes >) (origin . #<location test.ly:50:11>)) ((display-methods #<procedure #f (note parser)>) (name . NoteEvent) (types general-music event note-event rhythmic-event melodic-event)) > I'm trying to get to the music object *inside* the `articulations' list, but I cannot seem to find a way to do so. Simply getting the property `articulations' with ly:music-property returns a list, but I cannot run cdr or car on that list to get to the Stream_event. Is there a way to do this? Maybe this is the wrong approach. Is there another way to get access to all music properties from within an acknowledger? Can I use more than one interface in the same acknowledger? I tried using event listeners before to collect the note properties, but this fails as soon as there is more than one voice, because the acknowledgers are called after *all* the listeners at a certain moment. I'd appreciate any comments or hints. Thanks, Rekado _______________________________________________ lilypond-devel mailing list lilypond-devel@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-devel