Am 01.09.2011 10:02, schrieb Marc Hohl:
[...]
I noticed that
a)
I can detect string numbers within < ... > only, so
< c\3 > is recognized, d\4 not, but I need to cover *both* cases.
[...]
Ok, so \4 isn't an articulation (which is obvious, but I had
overlooked it).
AFAIK, the string-number won't be accessible in this case, so I tried to
acknowledge the string-number-interface, too.
Meanwhile, I found out that the string-number-interface isn't used in
this case, so
I searched in the sources and found that I had to use string-number-events
instead, which are addressed to by listeners, IIUC.
So I wrote a simple test case:
\version "2.15.9"
#(define-public (test_string_engraver context)
(let ((stringnumbers '()))
`(;; the list of listeners
(listeners
(string-number-event .
,(lambda (engraver event)
(set! stringnumbers (cons event stringnumbers)))))
;; once the acknowledging stage has finished,
;; process the grobs we've found
(process-music
. ,(lambda (trans)
(for-each (lambda (strnum)
(let* ((stringnum (ly:event-property strnum
'string-number)))
(display "We have a string-number-event: ")
(display stringnum)
(display " \n"))
) ;; end lambda (strnum)
stringnumbers)
))
(stop-translation-timestep
. ,(lambda (trans)
(set! stringnumbers '()))))))
\layout {
\context {
\Voice
\consists \test_string_engraver
}
}
test = \relative c'{
c4\4 < e\2 >
}
%\displayMusic { \test }
\new Voice { \test }
So I think I am on the right track for now, but any hints, optimizations
etc.
are highly welcome!
Marc
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user