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:29:33 +0100

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

> And here's my solution for tablature:
>
> #(define (glissando::calc-tab-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))
>         (left-staff-position (ly:grob-property left-bound 'staff-position))
>         (right-staff-position (ly:grob-property right-bound
> 'staff-position))
>         (extra-dy
>            (if (and (= left-staff-position right-staff-position)
>                     (ly:pitch<? right-pitch left-pitch))

Be careful here: ly:pitch<? compares pitches lexicographically, so
you'll come unstuck if the pitches differ only in alteration:

#(let ((c-natural (ly:make-pitch 0 0 0))
       (c-sharp (ly:make-pitch 0 0 SHARP)))
   (display (ly:pitch<? c-natural c-sharp))
   (newline)
   (display (ly:pitch<? c-sharp c-natural)))

>                -1
>                 1 ))) ;; I don't know why, but "0" doesn't work properly in
> tablature, compare glissando::calc-extra-dy

Unless you can return the correct value or 0 (in the same way as
glissando::calc-extra-dy), you'll probably need to use cond and else:

(cond
((right pitch is lower) -1)
(right pitch is higher) 1)
(else 0))

Regards,
Neil




reply via email to

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