[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: New snippet: remove staff if another is alive (for wind divisi)
From: |
Thomas Morley |
Subject: |
Re: New snippet: remove staff if another is alive (for wind divisi) |
Date: |
Sun, 5 Aug 2018 18:14:38 +0200 |
2018-08-03 23:14 GMT+02:00 Saul Tobin <address@hidden>:
> Hi all,
>
> I just put together a snippet to make managing shared wind staves more
> automatic, particularly with triple winds that may be combined in different
> ways.
>
> \version "2.19.82"
>
> #(define remove-if-sibling
> (lambda (offsets)
> (lambda (grob)
> (let* (
> ;; The parent of a VerticalAxisGroup is a VerticalAlignment
> (parent (ly:grob-parent grob 1))
> ;; Get the children VerticalAxisGroups of the parent
> (siblings (ly:grob-object parent 'elements))
> (siblings-list
> (if (ly:grob-array? siblings)
> (ly:grob-array->list siblings)
> '()))
> ;; Find the siblings above or below me by offsets
> (my-vindex (ly:grob-get-vertical-axis-group-index grob))
> (enemy-indices (map (lambda (offset) (+ offset my-vindex))
> offsets))
> (enemy-vaxis? (lambda (v) (member
> (ly:grob-get-vertical-axis-group-index v)
> enemy-indices)))
> (enemy-vaxes
> (filter enemy-vaxis? siblings-list))
> )
> ;; Suicide if an enemy sibling is alive
> (map
> (lambda (enemy-vaxis)
> (ly:pointer-group-interface::add-grob grob 'make-dead-when
> enemy-vaxis))
> enemy-vaxes)
> )
> )
> )
> )
>
> %% Two Staff Example
>
> global = {
> s1
> \break
> s1
> \break
> s1*2
> }
>
> I = {
> c'''1
> \context Staff = "1" { \set Staff.keepAliveInterfaces = #'() }
> c'''1
> c'''1
> \context Staff = "1" { \unset Staff.keepAliveInterfaces }
> c'''1
> }
>
> II = {
> e''1
> e''1
> e''1
> e''1
> }
>
> <<
> \new Staff = "1+2" \with {
> \override VerticalAxisGroup.before-line-breaking = #(remove-if-sibling
> '(1))
> \override VerticalAxisGroup.remove-empty = ##t
> \override VerticalAxisGroup.remove-first = ##t
> } << \global \partcombine \I \II >>
> \new Staff = "1" \with {
> \override VerticalAxisGroup.remove-empty = ##t
> \override VerticalAxisGroup.remove-first = ##t
> } << \global \I >>
> \new Staff = "2" \with {
> \override VerticalAxisGroup.before-line-breaking = #(remove-if-sibling
> '(-2))
> \override VerticalAxisGroup.remove-empty = ##t
> \override VerticalAxisGroup.remove-first = ##t
> } << \global \II >>
>>>
>
> %% Three Staff Example
>
> global = {
> s1
> \break
> s1
> \break
> s1
> \break
> s1*2
> }
>
> I = {
> c'''1
> \context Staff = "1" { \set Staff.keepAliveInterfaces = #'() }
> c'''1
> c'''1
> c'''1
> \context Staff = "1" { \unset Staff.keepAliveInterfaces }
> c'''1
> }
>
> II = {
> e''1
> e''1
> e''1
> e''1
> e''1
> }
>
> III = {
> a'1
> a'1
> \context Staff = "3" { \set Staff.keepAliveInterfaces = #'() }
> a'1
> a'1
> a'1
> }
>
> <<
> \new Staff = "1+2+3" \with {
> \override VerticalAxisGroup.before-line-breaking = #(remove-if-sibling
> '(2 5))
> \override VerticalAxisGroup.remove-empty = ##t
> \override VerticalAxisGroup.remove-first = ##t
> } << \global \I \II \III >>
> \new Staff = "1+2" \with {
> \override VerticalAxisGroup.before-line-breaking = #(remove-if-sibling
> '(1 -1))
> \override VerticalAxisGroup.remove-empty = ##t
> \override VerticalAxisGroup.remove-first = ##t
> } << \global \partcombine \I \II >>
> \new Staff = "1" \with {
> \override VerticalAxisGroup.remove-empty = ##t
> \override VerticalAxisGroup.remove-first = ##t
> } << \global \I >>
> \new Staff = "2+3" \with {
> \override VerticalAxisGroup.before-line-breaking = #(remove-if-sibling
> '(2 -3))
> \override VerticalAxisGroup.remove-empty = ##t
> \override VerticalAxisGroup.remove-first = ##t
> } << \global \partcombine \II \III >>
> \new Staff = "2" \with {
> \override VerticalAxisGroup.before-line-breaking = #(remove-if-sibling
> '(-1 -3 -4))
> \override VerticalAxisGroup.remove-empty = ##t
> \override VerticalAxisGroup.remove-first = ##t
> } << \global \II >>
> \new Staff = "3" \with {
> \override VerticalAxisGroup.remove-empty = ##t
> \override VerticalAxisGroup.remove-first = ##t
> } << \global \III >>
>>>
>
> _______________________________________________
> lilypond-user mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/lilypond-user
>
Hi,
I had a closer look at your code.
You select via vertical-axis-group-index. This makes for a not
intuitive argument of your `remove-if-sibling`-procedure. Even worse,
the needed arguments may need to be changed if other staves are added
to the score.
Also I think divisis should be controlled, well, from the divisi-staves.
Inspired by your work I come up with the attached.
Cheers,
Harm
divisi-saul-02-test.pdf
Description: Adobe PDF document
divisi-saul-02-test.ly
Description: Text Data
- New snippet: remove staff if another is alive (for wind divisi), Saul Tobin, 2018/08/03
- Re: New snippet: remove staff if another is alive (for wind divisi), Ben, 2018/08/03
- Re: New snippet: remove staff if another is alive (for wind divisi),
Thomas Morley <=
- Re: New snippet: remove staff if another is alive (for wind divisi), Thomas Morley, 2018/08/06
- Re: New snippet: remove staff if another is alive (for wind divisi), Thomas Morley, 2018/08/06
- Re: New snippet: remove staff if another is alive (for wind divisi), Thomas Morley, 2018/08/07
- Re: New snippet: remove staff if another is alive (for wind divisi), David Kastrup, 2018/08/07
- Re: New snippet: remove staff if another is alive (for wind divisi), Thomas Morley, 2018/08/07
- Re: New snippet: remove staff if another is alive (for wind divisi), David Kastrup, 2018/08/07
- Re: New snippet: remove staff if another is alive (for wind divisi), Thomas Morley, 2018/08/07
- Re: New snippet: remove staff if another is alive (for wind divisi), David Kastrup, 2018/08/07
- Re: New snippet: remove staff if another is alive (for wind divisi), Saul Tobin, 2018/08/07
- Re: New snippet: remove staff if another is alive (for wind divisi), Thomas Morley, 2018/08/08