lilypond-user
[Top][All Lists]
Advanced

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

Re: [Question] How to increment the current bar number


From: Malte Meyn
Subject: Re: [Question] How to increment the current bar number
Date: Sun, 2 Sep 2018 19:07:41 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0



Am 02.09.18 um 10:10 schrieb address@hidden:
Hi everyone,

i want to increase the current bar number by a fixed number of steps at a certain point in my sheet music.

To do this, I modify  Score.currentBarNumber. My approach for increasing the bar number by 4 steps would be:

\set Score.currentBarNumber = #(+ Score.currentBarNumber 4)

This does not work however, as GUILE says that currentBarNumber has the value #<unspecified>. So I guess I do not access the currentBarNumber variable in the right way.

But how do I access it in this context?

You have to get the Score context somehow. This can be done by using \applyContext. I don’t know what context the procedure then is called with (maybe the current Bottom?) but you can find the Score context from there and then get and set the currentBarNumber:

\version "2.18.2"

{
  \override Score.BarNumber.break-visibility = #all-visible
  R1*3
  \applyContext
  #(lambda (context)
     (let* ((myscore (ly:context-find context 'Score))
            (curnum (ly:context-property myscore 'currentBarNumber))
            (newnum (+ curnum 4)))
       (ly:context-set-property! myscore 'currentBarNumber newnum)))
  R
}



reply via email to

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