On Aug 31, 2011, at 5:30 PM, harm6 wrote: > > > Mike Solomon-2 wrote: >> >> Hmm...I thought that after-line-breaking would be called after the bounds >> were set, but I was wrong. >> >> Try: >> >> #(define (has-interface? grob interface) >> (member interface >> (assoc-get 'interfaces >> (ly:grob-property grob 'meta)))) >> >> #(define (find-system grob) >> (if (has-interface? grob 'system-interface) >> grob >> (find-system (ly:grob-parent grob X)))) >> >> #(define (first-musical-column grobl) >> (if (not (eqv? #t (ly:grob-property (car grobl) 'non-musical))) >> (car grobl) >> (first-musical-column (cdr grobl)))) >> >> #(define (change-bound grob) >> (let* ((system (find-system grob)) >> (cols (ly:grob-array->list (ly:grob-object system 'columns))) >> (musical-column (first-musical-column (reverse cols)))) >> (ly:spanner-set-bound! grob RIGHT musical-column))) >> >> #(define (internal-my-callback grob) >> (let* ( >> ;; have we been split? >> (orig (ly:grob-original grob)) >> >> ;; if yes, get the split pieces (our siblings) >> (siblings (if (ly:grob? orig) >> (ly:spanner-broken-into orig) >> '()))) >> >> (if (and (>= (length siblings) 2) >> (not (eq? (car (reverse siblings)) grob))) >> (change-bound grob)))) >> >> #(define (my-callback grob) >> (internal-my-callback grob) >> (ly:hairpin::print grob)) >> >> { >> a1\break >> \override Hairpin #'stencil = #my-callback >> a\< \repeat unfold 31 { a } \break \key fis \major >> \repeat unfold 32 { a } \break \key ees \major \repeat unfold 42 {a} a\p >> } >> >> It may result in oddities with other grobs that rely on spanner bounds, >> but it should be tame in most situations. >> >> Cheers, >> MS >> > > > Hi Mike, > > now it works as expected, but I found another problem: > Using \> instead of \< looks like succeeding decrescendos and not one > continuous one. > > One more question: Would it be possible to increase the control of the > length of the hairpin? > Doing the following at the end of a hairpin allows some more control on > the length of the hairpin. Not so for anywhere in the middle of it.. > > \relative c' { > \override Hairpin #'stencil = #my-callback > c'1\> c1*5/8 s1*3/8 > \break > \key cis\major > d2 e e1*7/8 s1*1/8\! > } > > Would any such increased / improved control be feasible in the context > of the solution you developed so far? > > > Best, > Harm >
More control over the length is always achievable by overriding the stencil, as is the solution to the problem you pose above regarding the closing diminuendi. Try: #(define (has-interface? grob interface) (member interface (assoc-get 'interfaces (ly:grob-property grob 'meta)))) #(define (find-system grob) (if (has-interface? grob 'system-interface) grob (find-system (ly:grob-parent grob X)))) #(define (first-musical-column grobl) (if (not (eqv? #t (ly:grob-property (car grobl) 'non-musical))) (car grobl) (first-musical-column (cdr grobl)))) #(define (change-bound grob) (let* ((system (find-system grob)) (cols (ly:grob-array->list (ly:grob-object system 'columns))) (musical-column (first-musical-column (reverse cols)))) (ly:spanner-set-bound! grob RIGHT musical-column))) #(define (internal-my-callback grob fn1 fn2) (let* ( ;; have we been split? (orig (ly:grob-original grob)) ;; if yes, get the split pieces (our siblings) (siblings (if (ly:grob? orig) (ly:spanner-broken-into orig) '()))) (if (and (>= (length siblings) 2) (not (eq? (car (reverse siblings)) grob))) (fn1 grob) (fn2 grob)))) #(define (change-ends grob) (let* ((st (ly:hairpin::print grob)) (gd (ly:grob-property grob 'grow-direction)) (w (ly:stencil-extent st X)) (thick (* (ly:grob-property grob 'thickness) (ly:staff-symbol-line-thickness grob))) (h (ly:stencil-extent st Y)) (ylu (if (eqv? gd RIGHT) (interval-center (cons (interval-center h) (cdr h))) (cdr h))) (yru (if (eqv? gd RIGHT) (cdr h) (interval-center (cons (interval-center h) (cdr h))))) (yld (if (eqv? gd RIGHT) (interval-center (cons (car h) (interval-center h))) (car h))) (yrd (if (eqv? gd RIGHT) (car h) (interval-center (cons (car h) (interval-center h)))))) (ly:stencil-add (make-line-stencil thick (car w) ylu (cdr w) yru) (make-line-stencil thick (car w) yld (cdr w) yrd)))) #(define (my-callback grob) (internal-my-callback grob change-bound values) (if (eqv? LEFT (ly:grob-property grob 'grow-direction)) (internal-my-callback grob change-ends ly:hairpin::print) (ly:hairpin::print grob))) { a1\break \override Hairpin #'stencil = #my-callback \override Hairpin #'bound-padding = #my-callback a\> \repeat unfold 31 { a } \break \key fis \major \repeat unfold 32 { a } \break \key ees \major \repeat unfold 42 {a} a\p } { a1\break \override Hairpin #'stencil = #my-callback \override Hairpin #'bound-padding = #my-callback a\< \repeat unfold 31 { a } \break \key fis \major \repeat unfold 32 { a } \break \key ees \major \repeat unfold 42 {a} a\p } _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user