lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: get current bar number


From: Jan-Peter Voigt
Subject: Re: get current bar number
Date: Fri, 23 Mar 2018 07:21:05 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0

Hi Kevin,

yes, you need to get a context object. If you want to use it inside some music expression \applyContext is the key:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
doSomething =
\applyContext #(lambda (context)
                 (display
                  (ly:context-property context 'currentBarNumber)
                  ))

{ c''4 \doSomething d'' }
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

If you are going to write an engraver you can find some informations in the archive.

HTH
Jan-Peter


Am 23.03.2018 um 01:55 schrieb Kevin Barry:
Hi All,

I would like to be able to get the current bar number context property so that I can do something with it (like printing it in markup for example).

I have tried the following scheme function:
(ly:context-property 'Score 'currentBarNumber)
but it errors out, telling me that Score is not a context. Do I need to get the context object somehow?

Any help appreciated.

Kevin



_______________________________________________
lilypond-user mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/lilypond-user





reply via email to

[Prev in Thread] Current Thread [Next in Thread]