On 3/5/10 5:05 AM, "Marc Hohl" <m...@hohlart.de> wrote:

> 
> This works fine, but I wanted to evaluate the position of the current note
> within the current bar. I found the measurePosition property, but to use
> 
> ly:context-property context 'measurePosition
> 
> in my function, I need the appropriate context. How can I achieve that?
> 
> (I think it must be something very simple, but digging in the sources and
> the manuals, I didn't get a hint. the lsr provides a solution with
> \applyOutput, but this doesn't work here).

It's actually not simple at all, because music functions are evaluated
during the parsing stage, when events are put on the music tree, rather than
during the iteration/translation stage when the events are handed to
contexts.  Therefore, you need something in your music function that will
have evaluation delayed until the translation stage when a context will be
provided as an argument.

This was something I didn't understand when I started working on the
autobeaming.  And it caused me lots of grief until I figured out a
workaround.

The workaround is to create a context-spec-music expression and export it
with ly:export.  You can see some examples at the bottom of
scm/beam-settings.scm.  I won't promise that they're good examples, but they
are examples.

HTH,

Carl



_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to