lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: missing glissando features (bugs?)


From: Neil Puttock
Subject: Re: missing glissando features (bugs?)
Date: Sun, 10 May 2009 23:07:25 +0100

2009/5/10 Marc Hohl <address@hidden>:

> I came up with the following definition:
>
> #(define (glissando::calc-extra-dy grob)
>  (let* ((original (ly:grob-original grob))
>         (left-bound (ly:spanner-bound original LEFT))
>         (right-bound (ly:spanner-bound original RIGHT))
>         (left-pitch (ly:event-property (event-cause left-bound) 'pitch))
>         (right-pitch (ly:event-property (event-cause right-bound) 'pitch))
>         (extra-dy
>             (if (and (= (ly:pitch-octave left-pitch) (ly:pitch-octave
> right-pitch))
>                      (= (ly:pitch-notename left-pitch) (ly:pitch-notename
> right-pitch)))
>                 (- (ly:pitch-alteration right-pitch) (ly:pitch-alteration
> left-pitch))
>                 0 )))
>         (set! (ly:grob-property grob 'extra-dy) extra-dy)
>         (ly:line-spanner::print grob)))

Good stuff, though you don't need to override #'stencil here; it will
work just as well with #'extra-dy directly:

#(define (glissando::calc-extra-dy grob)
   (let* ((original (ly:grob-original grob))
          (left-bound (ly:spanner-bound original LEFT))
          (right-bound (ly:spanner-bound original RIGHT))
          (left-pitch (ly:event-property (event-cause left-bound) 'pitch))
          (right-pitch (ly:event-property (event-cause right-bound) 'pitch)))

     (if (and (= (ly:pitch-octave left-pitch) (ly:pitch-octave right-pitch))
              (= (ly:pitch-notename left-pitch) (ly:pitch-notename 
right-pitch)))
         (- (ly:pitch-alteration right-pitch) (ly:pitch-alteration left-pitch))
         0)))

\override Glissando #'extra-dy = #glissando::calc-extra-dy

Regards,
Neil




reply via email to

[Prev in Thread] Current Thread [Next in Thread]