Hi David,

i'm writing just to let you know that the function changing arpeggio length:

offsetArpeggioPositions =
 #(define-music-function (parser location offsets) (pair?)
   #{
      \override Arpeggio #'positions = #(lambda (grob)
        (let* ((func (assoc-get 'positions (cdr
(ly:grob-basic-properties grob))))
               (pos (func grob)))
           (coord-translate pos offsets)))
   #})

suffered form exactly the same problem as the \shape functions (if it
was used before another override of the same object, LilyPond
crashed).  Fortunately, the same fix can be applied!  Here is a more
generic version of the funciton (takes context name and grob name as
argument) that doesn't have this bug:

offsetPositions =
#(define-music-function (parser location context-name grob-name
offsets) (string? string? pair?)
  #{
     \override $context-name . $grob-name #'positions = #(lambda (grob)
       (let* ((func (assoc-get 'positions
(reverse(ly:grob-basic-properties grob))))
              (pos (func grob)))
          (coord-translate pos offsets)))
  #})

% example of use:

\layout {
  \offsetPositions Staff Arpeggio #'(-1 . 1)
  \offsetPositions PianoStaff Arpeggio #'(-3 . 2)
}

\relative c'   {
  <c e g c>2\arpeggio
}

\new PianoStaff \relative c' <<
  \set PianoStaff.connectArpeggios = ##t
    \new Staff {
    <e g>2\arpeggio
  }
  \new Staff {
    \clef bass
    <c, e>2\arpeggio
  }
>>

this is cool! :D
I wish it was possible to add context to grob name in a more
LilyPondish way (i.e. with a dot)

cheers,
Janek

_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to