lilypond-devel
[Top][All Lists]
Advanced

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

Re: Implementation of music streams


From: Erik Sandberg
Subject: Re: Implementation of music streams
Date: Mon, 15 May 2006 18:03:45 +0200

On 5/15/06, Han-Wen Nienhuys <address@hidden> wrote:
2006/5/15, Erik Sandberg <address@hidden>:
> On 5/14/06, Han-Wen Nienhuys <address@hidden> wrote:
> > 2006/5/14, Erik Sandberg <address@hidden>:
> > > What should be the value of the 'unique field of a CreateContext event?
> >
> > When writing, the 'unique field to be written is determined by the file 
writer.
>
> OK, so file writers have direct listeners to all contexts then? (I've
> implemented it previously using the events_below dispatcher, which is
> more convenient)
>
> I agree it would be nice to get rid of unique.


Sorry, I think we're miscommunicating something. Can you explain what
the value unique is used for? AFAICS, it's only used for reading and
writing streams, and  isn't per se necessary inside the context tree.

That observation is true. The purpose of unique is to make the
reader/writer understand which newly created contexts that are
connected to which events. Before a context is created, the parent
decides a unique value, with which the child will tag all its events.
It's a very clear and easy way to make sure that everyone agrees on
which context that belong to which parent, and which stream event that
belongs to which context.


However, I have found one good alternative, where the stream event has
no unique field. This approach involves a dummy event
"AnnounceContext", which are sent by newly created contexts. These
messages have no musical meaning, and should not be part of any output
file, but you must listen to them if you want to find out about the
context structure.

I'd suggest that an AnnounceContext event contains a direct reference
to the newly created context, as well as a direct reference to the
CreateContext event. This makes it very clear which CreateContext
events that result in which contexts.

I like my new design better than my original one, because data is
separated in a more logical way, and because I think it eliminates a
bad hack in create_context.

Erik




reply via email to

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