On 06/12/2013 05:18 PM, Urs Liska
wrote:
On
06/12/2013 05:10 PM, Paul Morris wrote:
Urs Liska wrote
BTW: How can I read such properties in a
Scheme function, i.e. determine
where we are in a piece when a function is executed?
I didn't find it in the manual ...
http://www.lilypond.org/doc/v2.17/Documentation/extending/object-properties
says that object properties are stored in alist-chains.
So I'm looking for an entry '(currentBarNumber . N) of the
Score object.
But that doesn't help me unfortunately.
How would I write if I want something like
(define curNum Score.currentBarNumber)
?
Maybe this snippet will help show how to do this?
http://lsr.dsi.unimi.it/LSR/Item?id=333
Looks promising, but I'm too tired to digest that right now ...
Thanks
Actually, when looking at the snippet I looked up \applyContext, and
guess what I find there?
http://www.lilypond.org/doc/v2.17/Documentation/extending/context-evaluation#index-_005capplyContext
\applyContext function
function should be a Scheme
function that takes a single argument: the context in which the \applyContext command is being called.
The following code will print the current bar number on the
standard output during the compile:
\applyContext
#(lambda (x)
(format #t "\nWe were called in barnumber ~a.\n"
(ly:context-property x 'currentBarNumber)))
:-)
|