|
From: | Trevor Daniels |
Subject: | Re: Expert question on named contexts |
Date: | Sun, 10 Aug 2008 23:24:26 +0100 |
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
[Prev in Thread] | Current Thread | [Next in Thread] |