On Mon, Dec 15, 2008 at 12:18 AM, Trevor Bača <trevorb...@gmail.com> wrote:
> OK, this explanation is extremely helpful. But there's still something > deeply wrong. Han-Wen from a bit earlier: > > "Note that contexts do not 'nest' as you claim in a message below. > Voice contexts cannot contain any other context." > > But check this out: > > %%% VOICE-RESOLUTION EX 3 %%% > > \version "2.11.65" > \include "english.ly" > > \new Voice = "foo" { > \override Voice.NoteHead #'color = #red > \whichContext > c'8 > cs'8 > \new Voice = "bar" { > \override Voice.NoteHead #'color = #blue > \whichContext > d'8 > ef'8 > \new Voice = "blah" { > \override Voice.NoteHead #'color = #green > \whichContext > e'8 > f'8 > fs'8 > g'8 > } > \whichContext > af'8 > a'8 > } > \whichContext > bf'8 > b'8 > } > > %%% END %%% > > It appears as though the voice contexts are indeed nesting ... perfectly, in > fact! The music expressions are nested, as you can easily see from the syntax. However, the contexts themselves (that the music expressions are shipping their events to) are actually running in parallel, and are siblings in the context tree. When you do \new Voice = foo { c4 // * \new Voice = bar { d4 } e4 } at the location marked by * there is an iterator for the outer expression (delivering events to Voice=foo); the moment \new Voice = bar expression is opened, this creates an iterator pointing to Voice=bar. The outer iterator still points to foo, but it has no events to deliver, because the inner iterator already sends them to bar. The moment the final note (e4) is processed, the relevant iterator (Event_chord_iterator, if memory serves me) inherits the destination from its parent, so the e4 goes to foo. The foo and bar voice contexts themselves are not nested, they are contained in their respective Staff objects and are independent. > And, in fact, John's new \whichContext function emits the following during > interpretation: -- Han-Wen Nienhuys - han...@xs4all.nl - http://www.xs4all.nl/~hanwen
_______________________________________________ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel