Mats Bengtsson asked
Trevor Daniels wrote:
My understanding is that the name given to a context is
stored internally as the context's id. You can display this
with the ly:context-id function. In the example above both
contexts have id set to "myvoice", as least that's what this
function returns.
I take the opportunity to ask another "basic" question.
The ly:context-id function, as well as many other functions,
take a context as the input. I have never realized how you
get hold of this context id. For example, how did you print the
context id:s in my example?
There may be better ways, but this works, and is adequate
for experimentation:
displayID =
#(lambda (grob creationContext currentContext)
(format #t "\n~a" grob)
(format #t " was called in a ~a"
(ly:context-name currentContext))
(format #t " context with an id of ~a"
(ly:context-id currentContext))
(format #t " in staff position ~a"
(ly:grob-property grob 'staff-position)))
<<
\new Staff ="StaffA" {
\new Voice = "VoiceA" {
\applyOutput #'Voice #displayID
g'
}
}
\new Staff = "StaffA" {
\new Voice = "VoiceA" {
\applyOutput #'Voice #displayID
c''
}
}
/Mats
Trevor
_______________________________________________
lilypond-user mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/lilypond-user