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 01:12:21 +0200

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. There are however some
problems, mainly that the writer needs to figure out which context
that the CreateContext event created. The problem can be solved in an
unclean way (e.g. look up all child contexts in the context->int map
and see which one that isn't already in the lookup), question is
what's the Right Way to do it.

Hm. One way that feels quite OK is to keep CreateContext as it is, but
remove the unique field, and then let newly created contexts signal
their creation with a AnnounceContext event, which only contains a
reference to the context itself. The AnnounceContext event has no
semantics and will not be part of the output file. Instead, only those
who are interested in accessing the new context directly (i.e. the one
who sent the CreateContext event initially, and the file writer) will
listen to the AnnounceContext event.

There will be problems if a CreateContext triggers another
CreateContext event before the first one reaches the file writer; this
is a clear strength of the unique system. But I'm too tired to think
about that now.

(chronology: 1. CreateContext event is created and dispatched. 2.
event arrives to parent context, which creates new context. 3. event
arrives to file writer, which must associate the event with the newly
created context. other listeners may exist between 2 and 3, which may
want to create new contexts; in that case the file writer may receive
CreateContext and AnnounceContext events in a strange order).

(sorry if I write confusing text. I'm going to sleep now)

Erik




reply via email to

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