[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: |
Mon, 8 Apr 2013 01:09:04 +0200 |
Hi Harm,
thanks for that suggestion.
Unfortunately it doesn't quite do what I need, and I don't really understand it.
But fortunately it gives quite a good clue how to ask more concretely.
It seems that functions/properties like
ly:context-id
ly:context-name
provide information on the current context we're in.
a)
Is it possible to gather a list of all (Staff) contexts that are currently
present?
b)
Is it possible to determine whether a given context is within a StaffGroup (or
similar)?
With this information I hope it would be possible to identify the previous or
next staff within a system in order to be able to "\change" to that Staff
context.
Best
Urs
On Tue, 2 Apr 2013 01:20:00 +0200
Thomas Morley <address@hidden> wrote:
> \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
> }
> >>
- Re: Refer to a staff relatively, not by name, Eluze, 2013/04/01
- Re: Refer to a staff relatively, not by name, Urs Liska, 2013/04/01
- Re: Refer to a staff relatively, not by name, Eluze, 2013/04/01
- Re: Refer to a staff relatively, not by name, Urs Liska, 2013/04/01
- Re: Refer to a staff relatively, not by name, Thomas Morley, 2013/04/01
- Re: Refer to a staff relatively, not by name, Urs Liska, 2013/04/02
- Re: Refer to a staff relatively, not by name,
Urs Liska <=