[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
AW: [Question] How to increment the current bar number
From: |
simon |
Subject: |
AW: [Question] How to increment the current bar number |
Date: |
Mon, 3 Sep 2018 11:47:09 +0200 |
Thank you very much to the both of you!
This solved my problem 😊
Greetings,
Simon
-----Ursprüngliche Nachricht-----
Von: lilypond-user <address@hidden> Im Auftrag von Torsten Hämmerle
Gesendet: Sonntag, 2. September 2018 21:21
An: address@hidden
Betreff: Re: [Question] How to increment the current bar number
David Kastrup wrote
> Malte Meyn <
> lilypond@
> > writes:
>
>> 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?)
>
> The current "whatever". Since you already had R1*3 descend to Bottom,
> that would be Bottom.
How about using ly:context-property-where-defined?
As in:
%%%%%%%%%%%%%%%
\version "2.19.82"
increaseBarNumber =
#(define-music-function (par loc addm) (integer?)
(make-apply-context
(lambda (context)
(let* ((where (ly:context-property-where-defined context
'currentBarNumber))
(cbn (ly:context-property where 'currentBarNumber)))
(ly:context-set-property! where 'currentBarNumber (+ addm cbn))))))
testmusic = \relative {
c'4 d e f g a b c d e f g a b c2 R1*3
c4 b a g f e d c b a g f e d c2
}
\score {
<<
\new PianoStaff <<
\new Staff { R1*22 }
\new Staff{
\testmusic
<>^"↓ increase barnumber by 100"
\increaseBarNumber #100
\testmusic
}
>>
\new Staff { \testmusic \testmusic }
>>
}%%%%%%%%%%%%%%%
All the best,
Torsten
--
Sent from: http://lilypond.1069038.n5.nabble.com/User-f3.html
_______________________________________________
lilypond-user mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/lilypond-user