> > But it's also essential that the performer is told how many times to repeat each fragment! At the moment I've chickened out and used percent repeats with counts :(
> I'll have a look at this - probably a matter of adding a new engraver; I've seen a trick that used \Dynamic context to display centered measure numbers before, so maybe something like that. If you don't care so much about the alignment though, you can just put a markup in that repeat function. Like: == snip repeatSect = #(define-music-function (parser location num mus) (number? ly:music?) (define startBar #f) #{ #(make-apply-context (lambda (context) (let ((currentBar (ly:context-property context 'currentBarNumber))) (set! startBar currentBar)))) \mark \markup { \hspace #30 "repeat this" #(number->string num) "times" } \repeat volta #num { #mus } #(context-spec-music (make-apply-context (lambda (context) (let* ((endBar (ly:context-property context 'currentBarNumber)) (repLength (- endBar startBar)) (lenScaled (* repLength num)) (nextBar (+ startBar lenScaled))) (ly:context-set-property! context 'currentBarNumber nextBar)))) 'Score) #}) == snip On Fri, Feb 17, 2017 at 12:24 PM, Jeffery Shivers <jefferyshiv...@gmail.com> wrote: > > The bar number check works, but the printed bar numbers are still > sequential, which I don't understand. > > It was clear that this was a context issue, but not so clear how to > address that. For the record, context-spec-music was the procedure > that makes this work. The following passes check and engraves as > intended: > > === begin snippet > > repeatSect = > #(define-music-function (parser location num mus) > (number? ly:music?) > (define startBar #f) > #{ > #(make-apply-context > (lambda (context) > (let ((currentBar (ly:context-property context > 'currentBarNumber))) > (set! startBar currentBar)))) > \repeat volta #num { #mus } > #(context-spec-music > (make-apply-context > (lambda (context) > (let* ((endBar (ly:context-property context > 'currentBarNumber)) > (repLength (- endBar startBar)) > (lenScaled (* repLength num)) > (nextBar (+ startBar lenScaled))) > (ly:context-set-property! context 'currentBarNumber > nextBar)))) > 'Score) > #}) > > \score { > \new Staff { > \override Score.BarNumber.break-visibility = #'#(#t #t #t) > \barNumberCheck #1 > \repeatSect 4 { \rhPatternA } > % adds 4 bars ... (1 + 4 = 5) > \barNumberCheck #5 > \repeatSect 16 { \rhPatternA } > % adds 16 bars ... (5 + 16 = 21) > \barNumberCheck #21 > \repeatSect 4 { \rhPatternB } > % adds 4 bars ... (21 + 4 = 25) > \barNumberCheck #25 > \repeatSect 2 { \rhPatternA } > } > } > > === end snippet > > > But it's also essential that the performer is told how many times to > repeat each fragment! At the moment I've chickened out and used percent > repeats with counts :( > > I'll have a look at this - probably a matter of adding a new engraver; > I've seen a trick that used \Dynamic context to display centered > measure numbers before, so maybe something like that. > > On Fri, Feb 17, 2017 at 11:44 AM, Peter Toye <lilyp...@ptoye.com> wrote: > > Jeffery, > > > > Thanks. There's a lot to look at here, as I'm not (yet?) a Scheme/Guile > > programmer! But as you hint it doesn't seem to work, though. The bar > number > > check works, but the printed bar numbers are still sequential, which I > don't > > understand. > > > > But it's also essential that the performer is told how many times to > repeat > > each fragment! At the moment I've chickened out and used percent repeats > > with counts :( > > > > Best regards, > > > > Peter > > mailto:lilyp...@ptoye.com > > www.ptoye.com > > > > ------------------------- > >> Without investigating how the bar number engraver (I'm guessing, or > >> whatever engraves them), I am unsure how to correct what actually > >> gets *engraved* (which is obviously important), but here's a partial > >> solution. > >> > >> \adjustBarNum applies the repeats and does the calculations, and > >> seems to reset each next *currentBarNumber* to what it should be. > >> Maybe someone with more knowledge of how bar numbers are engraved > >> can have a look and see what is wrong/missing. > > > > -- > > Jeffery Shivers > jefferyshivers.com > soundcloud.com/jefferyshivers > -- Jeffery Shivers jefferyshivers.com soundcloud.com/jefferyshivers
_______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user