lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Refer to a staff relatively, not by name


From: Urs Liska
Subject: Re: Refer to a staff relatively, not by name
Date: Tue, 02 Apr 2013 12:50:10 +0200
User-agent: K-9 Mail for Android

Hi harm,

Thank you for this.
I'll try to understand it as soon as I have access to a non-deficient* computer again.


Best
Urs

* i.e. lilypond-equipped ;-)



Thomas Morley <address@hidden> schrieb:
2013/4/1 Urs Liska <address@hidden>

OK, thanks for the information.

And does anybody know how/if one can retrieve information about the existing (staff) context? Some property accible by Scheme?


Hi Urs,

below a possibility, though, not sure if it is really helpful.
I'm using Eluze's example and
http://lists.gnu.org/archive/html/lilypond-user/2010-01/msg00668.html
Thanks Reinhold.

\verson "2.17.15"

%%%% Helper functions, which simply print out the observed Music
%%%% in a nice format:
#(define (format-ctx engraver event)
(let* ((context (ly:translator-context engraver))
(ctx (ly:context-id context))
(ctx-name (ly:context-name context))
;(mus (ly:event-property event 'music))
)
(ly:message "We are in \"~a\" with name \"~a\"\n\n" ctx-name ctx)
)
)

%%%% The actual engraver definition: We just install a listener.

ctxInfo =
#(list
(cons 'listeners
(list
(cons 'note-event format-ctx))))

\layout {
\context {
% I add this to the score, so all voices are caught. You can also only add
% the engraver to selected voices to get the statistics split down.
\Staff
\consists #ctxInfo
}
}

\new ChoirStaff <<
\new Staff = "One" \with { instrumentName = "ctx 1" }
{ \clef "treble_8" s1 * 6 }

\new Staff = "Two" \with { instrumentName = "ctx 2" }
{ \clef treble s1 * 6 }

\new Staff = "Three" \with { instrumentName = "ctx 3" }
{ \clef alto s1 * 6 }

\new Staff = "Four" \with { instrumentName = "ctx 4" }
\relative f {
\clef bass c4 d e f
\change Staff = "Three" g' a b c
\change Staff = "Two" g a b c
\change Staff = "One" g, a b c
\change Staff = "Three" g a b c
\change Staff = "Four" g a b c
}



HTH,
Harm



lilypond-user mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/lilypond-user

--
Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail gesendet.
reply via email to

[Prev in Thread] Current Thread [Next in Thread]