Am 02.09.18 um 10:10 schrieb [email protected]:
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
}

_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to