[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
StringNumberEvents [was: Re: How to evaluate 'articulations entries?}
From: |
Marc Hohl |
Subject: |
StringNumberEvents [was: Re: How to evaluate 'articulations entries?} |
Date: |
Thu, 01 Sep 2011 16:14:53 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.20) Gecko/20110805 Thunderbird/3.1.12 |
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