Hello list,
for my work on the volta bracket inclusion for the new bar line interface,
I need to know how the bars are ordered in (ly:grob-object grob 'bars).
Please see the attached file.
For the \musOne, I get a grob array with eight BarLine grobs
(two for each staff) for the first volta bracket (and one for
the second volta bracket, of course):
|------volta------|
<BarLine> <BarLine>
<BarLine> <BarLine>
<BarLine> <BarLine>
<BarLine> <BarLine>
For \musTwo, I get a grob array consisting of eight BarLine grobs
(because the bracket spans eight bars in a single line) and a second
one for the second volta bracket.
|-------------------------------------volta-----------------------------------|
<BarLine> <BarLine> <BarLine> <BarLine> <BarLine> <BarLine> <BarLine>
<BarLine>
Is there any chance to get to know how the grobs are arranged?
Or more formally: how can I get the 2D structure back from a 1D vector?
Thanks in advance,
Marc
\version "2.17.2"
#(define (volta-bracket::my-print grob)
(let* ((bar-array (ly:grob-object grob 'bars))
(bar-array-length (ly:grob-array-length bar-array)))
(display "\n\n\nGrob array structure:")
(for-each (lambda (g)
(for-each display (list "\nBar-array entry No. " g ": "
(ly:grob-array-ref bar-array g))))
(iota bar-array-length))
(ly:volta-bracket-interface::print grob)))
\layout {
\context {
\Score
\override VoltaBracket #'stencil = #volta-bracket::my-print
}
}
musOne = {
\repeat volta 2 {
c4 c c c | c c c c
}
\alternative {
{ c4 c c c }
{ c2 c }
}
}
\score {
<<
\new Staff {
\new Voice { \musOne }
}
\new Staff {
\new Voice { \musOne }
}
\new Staff {
\new Voice { \musOne }
}
\new Staff {
\new Voice { \musOne }
}
>>
}
musTwo = {
\time 1/4
\repeat volta 2 {
c4 | c
}
\alternative {
{ c4 | c | c | c | c | c | c }
{ c4 | c | c | c | c | c | c }
}
}
\score {
\new Staff {
\new Voice { \musTwo }
}
}
_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel