Callback function and applying to all notes in chord

2012-03-13 Thread Nick Payne
I was trying to make a callback function to lengthen LV ties (thanks to 
David Nalesnik for his help). It works fine when applied to single 
notes, but on a chord, only one of the two ties is lengthened. Is this 
due to an error in the code below or some more deep-rooted problem. If I 
reverse the order of the notes in the chord, the long and short ties 
swap around:


\version 2.15.33

#(define ((alter-lv-tie-curve offsets) grob)
   (let ((coords (ly:semi-tie::calc-control-points grob)))

 (define (add-offsets coords offsets)
   (if (null? coords)
   '()
   (cons
(cons (+ (caar coords) (car offsets))
  (+ (cdar coords) (cadr offsets)))
(add-offsets (cdr coords) (cddr offsets)

 (add-offsets coords offsets)))

\relative c'' {
   \override LaissezVibrerTie #'control-points = #(lambda (grob)
   (if (= UP (ly:grob-property grob 'direction))
   ((alter-lv-tie-curve '(0 0 0.75 0.7 2.25 0.7 3 0)) grob)
   ((alter-lv-tie-curve '(0 0 0.75 -0.7 2.25 -0.7 3 0)) grob)))
c f,1\laissezVibrer
f, c'\laissezVibrer
}

Nick

attachment: lv.png___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Callback function and applying to all notes in chord

2012-03-13 Thread David Nalesnik
Hi Nick,

I was trying to make a callback function to lengthen LV ties (thanks to
 David Nalesnik for his help). It works fine when applied to single notes,
 but on a chord, only one of the two ties is lengthened. Is this due to an
 error in the code below or some more deep-rooted problem. If I reverse the
 order of the notes in the chord, the long and short ties swap around:


Instead of overriding the property directly, I set 'control-points within
an override of 'before-line-breaking.  Seems to to the trick:

\version 2.15.30

#(define ((alter-lv-tie-curve offsets) grob)
  (let ((coords (ly:semi-tie::calc-control-points grob)))

(define (add-offsets coords offsets)
  (if (null? coords)
  '()
  (cons
(cons (+ (caar coords) (car offsets))
  (+ (cdar coords) (cadr offsets)))
(add-offsets (cdr coords) (cddr offsets)

(add-offsets coords offsets)))

\relative c'' {
  \override LaissezVibrerTie #'before-line-breaking = #(lambda (grob)
 (set! (ly:grob-property grob 'control-points)
   (if (= UP (ly:grob-property grob 'direction))
   ((alter-lv-tie-curve '(0 0 0.75 0.7 2.25 0.7 3 0)) grob)
   ((alter-lv-tie-curve '(0 0 0.75 -0.7 2.25 -0.7 3 0)) grob

  c f,1\laissezVibrer
  f, c'\laissezVibrer
  c f c' f\laissezVibrer
}

-David
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user