[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: context id
From: |
Milan van der Meer |
Subject: |
Re: context id |
Date: |
Tue, 15 Dec 2015 11:09:23 +0100 |
the code (frescobaldi):
#(define (format-note engraver event)
(let* (
(context (ly:translator-context engraver))
(ID (ly:context-id context))
(parent (ly:context-parent context))
(name (ly:context-name context) )
)
(display ID)
(make-eventlist engraver event)
)
)
\layout {
\context {
\Score
\consists #(make-engraver
(listeners
(note-event . format-note)
))
\new Staff <<
\new Voice = "first"
{ \voiceOne a }
\new Voice= "second"
{ \voiceTwo d }
>>
On Mon, Dec 14, 2015 at 5:55 PM, David Kastrup <address@hidden> wrote:
> Milan <address@hidden> writes:
>
> > Hello All,
> >
> > I'm trying to return the context id for a voice.
> > I'm using ly:translator-context to get the
> > context from the engraver and the function ly:context-id
> > to get the ID. However, if i display the id it prints: \new.
> > displaying the parent context results in:
> > #<Global_context Global
> > (#<Context Score=\new
> > (#<Context Staff (#<Context Voice=first () > #
> > <Context Voice=second () >) >) >) >
> >
> > The input:
> > \new Staff <<
> > \new Voice = "first"
> > { \voiceOne a }
> > \new Voice= "second"
> > { \voiceTwo d } >>
>
> That code does not output a context id. Without actually showing the
> code you use for referencing ly:context-id, one cannot say what you do
> wrong here.
>
> --
> David Kastrup
>