Is there anyone who could help me understand this?
Contexts in general die when they have nothing to do, but one Voice context
within a Staff seems to live indefinitely, even when it has nothing to do.
At first I thought the one selected to live was the first context encounted,
but it's not that simple, as the examples below demonstrate.
Why is this? Is this an accident of the implementation or is it an
essential feature?
Here are some examples:
a) Voice AAA lives indefinitely; voice BBB dies as soon as it has nothing to
do.
\new Staff {
\new Voice = AAA {
\voiceOneStyle
c d e f
}
\new Voice = BBB {
\voiceTwoStyle
g a b c
}
\context Voice = AAA { c1 }
\context Voice = BBB { c1 }
\context Voice = AAA { c1 }
}
b) Voices A and B die at the end of the parallel section; voice C then lives
indefinitely:
musicA = \relative c'' { d4 d d d }
musicB = \relative c'' { g4 g g g }
musicC = \relative c'' { b4 b b b }
\score {
\new Staff {
<<
\new Voice = "A" {
\voiceOneStyle
\musicA
}
\new Voice = "B" {
\voiceTwoStyle
\musicB
}
>>
% Contexts "A" and "B" both die here
\new Voice = "C" {
% Voice "C" is the one which persists
\voiceThreeStyle
\musicC
}
\context Voice = "B" {
% A new context called "B" is created. voiceTwoStyle is lost.
\musicB
}
\context Voice = "A" {
% A new context called "A" is created. voiceTwoStyle is lost.
\musicA
}
\context Voice = "C" {
% Context "C" is still alive, so voiceThreeStyle continues.
\musicC
}
}
}
c) And here voice A persists, even though it is not the first to
be declared:
musicA = \relative c'' { d4 d d d }
musicB = \relative c'' { g4 g g g }
\score {
\new Staff {
<<
\new Voice = "B" { s1*5 } % Keep Voice "B" alive for 5 bars
{
\new Voice = "A" {
\voiceOneStyle
\musicA
}
\context Voice = "B" {
\voiceTwoStyle
\musicB
}
\context Voice = "A" {
% voiceOneStyle continues as Voice A never dies
\musicA
}
\context Voice = "B" {
% voiceTwoStyle continues, as Voice "B" is kept alive
\musicB
}
\context Voice = "A" {
% Voice "A" is still alive
\musicA
}
}
>>
}
}
Trevor
_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel