Hi,
is there anything wrong with adding an arbitrary property to a
SequentialMusic like that:
\version "2.19.80"
someNote = { c' d' }
#(set! (ly:music-property someNote 'foo) "bar")
\displayMusic \someNote
?
The following is a MWE of a new extension I plan for scholarLY, and it
seems to work. \sic and \corr add such an arbitrary property to the
music while \choice uses that to retrieve one element out of a list of
music expressions.
\version "2.19.80"
#(define selection 'sic)
%#(define selection 'corr)
choice =
#(define-music-function (mus) (ly:music?)
(let*
((elts
(map
(lambda (expr)
(cons (ly:music-property expr 'choiceType) expr))
(ly:music-property mus 'elements)))
(chosen (assq-ref elts selection)))
(if chosen
chosen
(first (ly:music-property mus 'elements)))))
tagMusic =
#(define-void-function (mus tag)(ly:music? symbol?)
(set! (ly:music-property mus 'choiceType) tag))
sic =
#(define-music-function (mus) (ly:music?)
(tagMusic mus 'sic)
mus)
corr =
#(define-music-function (mus) (ly:music?)
(tagMusic mus 'corr)
mus)
\relative {
c' c g' g |
\choice {
\sic { g }
\corr { a }
}
a g2
}
But before proceeding I'd like to know if I'm not doing anything stupid
by injecting two list items like so:
(make-music
'SequentialMusic
'choiceType
'sic
'elements
(list (make-music
'NoteEvent
'pitch
(ly:make-pitch -1 4)
'duration
(ly:make-duration 2))))
Urs
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user