lilypond-user
[Top][All Lists]
Advanced

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

Re: Issue 1724 -> 620 : workaround?


From: Neil Puttock
Subject: Re: Issue 1724 -> 620 : workaround?
Date: Sat, 23 Jul 2011 21:27:57 +0100

On 20 July 2011 15:26, Neil Puttock <address@hidden> wrote:

> Let me think about it for a bit.  I have an idea using a scheme
> engraver which might work.

Here's the scheme engraver if you want to try it out.  It's obviously
not as sophisticated as Mike's proposed fix, but it does have the
advantage of aligning absolute dynamics properly (assuming there's a
NoteColumn present at the same time).

\version "2.15.5"

\layout {
  \context {
    \PianoStaff
    \consists #(lambda (ctx)
                 (let ((dynamics '())
                       (column '()))
                   `(
                     (acknowledgers
                      (note-column-interface
                       . ,(lambda (trans grob source)
                            (and (null? column)
                                 (set! column grob))))
                      (dynamic-interface
                       . ,(lambda (trabs grob source)
                                 (set! dynamics (cons grob dynamics)))))
                     (stop-translation-timestep
                      . ,(lambda (grob)
                           (and (pair? dynamics)
                                (ly:grob? column)
                                (for-each (lambda (g)
                                            (display (ly:grob-parent g X))
                                            (if (ly:spanner? g)
                                                (ly:spanner-set-bound!
g LEFT column)
                                                (begin
                                                  (set!
(ly:grob-parent g X) column)
                                                  (set!
(ly:grob-property g 'X-offset)
                                                        (lambda (grob)
                                                          (+

(ly:self-alignment-interface::centered-on-x-parent grob)

(ly:self-alignment-interface::x-aligned-on-self grob)))))))
                                  dynamics)
                                (set! dynamics '()))
                           (set! column '()))))))
  }
}

\score {
  <<
    \new PianoStaff <<
      \new Staff = "up" {
        \clef treble
        \repeat unfold 32 c'4
      }
      \new Dynamics = "dynamics" {
        \repeat unfold 2 {
          s1\cresc s1\f s1\dim s1\p
        }
      }
      \new Staff = "down" {
        \clef bass
        \repeat unfold 32 c4
      }
      \new Dynamics= "pedal" {
        \repeat unfold 2 {
          s1\sustainOn s1\sustainOff
        }
      }
    >>
  >>
}

Cheers,
Neil



reply via email to

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