[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Get the positions of a beam (or other grob with positions)
From: |
Janek Warchoł |
Subject: |
Re: Get the positions of a beam (or other grob with positions) |
Date: |
Wed, 23 May 2012 12:30:39 +0200 |
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
- Get the positions of a beam (or other grob with positions), Urs Liska, 2012/05/17
- Re: Get the positions of a beam (or other grob with positions), David Nalesnik, 2012/05/17
- Re: Get the positions of a beam (or other grob with positions), Janek Warchoł, 2012/05/19
- Re: Get the positions of a beam (or other grob with positions), David Nalesnik, 2012/05/19
- Re: Get the positions of a beam (or other grob with positions), Janek Warchoł, 2012/05/19
- Re: Get the positions of a beam (or other grob with positions),
Janek Warchoł <=
- Re: Get the positions of a beam (or other grob with positions), David Kastrup, 2012/05/23
- Re: Get the positions of a beam (or other grob with positions), Janek Warchoł, 2012/05/23
- Re: Get the positions of a beam (or other grob with positions), Thomas Morley, 2012/05/23
- Re: Get the positions of a beam (or other grob with positions), Janek Warchoł, 2012/05/23
- Re: Get the positions of a beam (or other grob with positions), David Kastrup, 2012/05/23