lilypond-devel
[Top][All Lists]
Advanced

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

Re: cross-staff versions of \arpeggioArrowUp etc.


From: Mark Polesky
Subject: Re: cross-staff versions of \arpeggioArrowUp etc.
Date: Fri, 31 Jul 2009 18:58:01 -0700 (PDT)

Mark Polesky wrote:

> Interesting idea. As a first attempt, I tried making the functionality
> of the \arpeggioArrowUp command dependent on the 'connectArpeggios
> context property, but obviously I'm doing something wrong. Does anyone
> know why this doesn't work? Can anyone see how to make this work? If
> not, are there other oppositions to my earlier solution of defining new
> commands?

I think I might have figured out how to make \arpeggioArrowUp and
its kin select the appropriate context depending on whether 
'connectArpeggios is set. Can someone look at this and check to
make sure it's legit?

Thanks!
- Mark

*****************
\version "2.13.3"

#(define (arpeggio-generic context pushpops)
  (let* ((PianoStaff (ly:context-find context 'PianoStaff))
         (target (if (and PianoStaff
                          (eq? #t
                               (ly:context-property PianoStaff
                                                    'connectArpeggios)))
                     PianoStaff
                     context)))
    (for-each
      (lambda (pushpop)
        (if (pair? pushpop)
            (ly:context-pushpop-property target
                                         'Arpeggio
                                         (car pushpop)
                                         (cdr pushpop))
            (ly:context-pushpop-property target
                                         'Arpeggio
                                         pushpop)))
      pushpops)))

arpeggioArrowUp =
\applyContext
  #(lambda (context)
     (arpeggio-generic context
       `(stencil X-extent (arpeggio-direction . ,UP))))

arpeggioArrowDown =
\applyContext
  #(lambda (context)
     (arpeggio-generic context
       `(stencil X-extent (arpeggio-direction . ,DOWN))))

arpeggioNormal =
\applyContext
  #(lambda (context)
    (let ((PianoStaff (ly:context-find context 'PianoStaff))
          (Staff (ly:context-find context 'Staff)))

      ;; not sure if the conditional tests are necessary
      (if PianoStaff
          (arpeggio-generic PianoStaff
            `(stencil X-extent arpeggio-direction dash-definition)))
      (if Staff
          (arpeggio-generic Staff
            `(stencil X-extent arpeggio-direction dash-definition)))

      (arpeggio-generic context
        `(stencil X-extent arpeggio-direction dash-definition))))

arpeggioBracket =
\applyContext
  #(lambda (context)
     (arpeggio-generic context
       `(X-extent (stencil . ,ly:arpeggio::brew-chord-bracket))))

\new PianoStaff \relative <<
  \new Staff {
    \arpeggioArrowUp
    <c e g>4\arpeggio
    \arpeggioNormal
    <c e g>\arpeggio
    \set PianoStaff.connectArpeggios = ##t
    \arpeggioArrowUp
    <c e g>\arpeggio
    \arpeggioBracket
    <c e g>\arpeggio
    \set PianoStaff.connectArpeggios = ##f
    \arpeggioNormal
    <c e g>\arpeggio
  }
  \new Staff {
    \clef bass
    \arpeggioArrowDown
    <c, e g>4\arpeggio
    <c e g>\arpeggio
    <c e g>\arpeggio
    <c e g>\arpeggio
    <c e g>\arpeggio
  }
>>



      




reply via email to

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