[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Updating translators
From: |
Erik Sandberg |
Subject: |
Updating translators |
Date: |
Fri, 7 Jul 2006 14:59:45 +0200 |
User-agent: |
KMail/1.9.1 |
Hi,
The attached patch makes it possible for translators to listen to stream
events directly.
1. Stream events are now probs, with 'class as the only immutable property.
2. Music::send_to_context now sends two stream events for each music event:
One old-style OldMusicEvent, and one MusicEvent. The event's mutable property
list is copied directly from the music event.
3. Some mechanisms have been added to Translator, that make it possible to
register methods to listen directly for event-classes.
4. As a first demo, arpeggio-engraver has been rewritten to use these
mechanisms.
The patch is attached; it compiles regression tests nicely.
Problems:
- A side-effect of (2) is that each event is sent twice; therefore, I have
temporarily disabled a warning message.
- I think there are potential GC problems: Most translators don't seem to
protect the try_music parameter; they trust that someone else protects it for
them. This assumption is sufficient for Music (there's always someone higher
up who protects incoming Music), but I don't think you can assume the same
for Stream_events. Some possible solutions:
A. Rewrite all translators to protect incoming events appropriately. This is
the most efficient solution, but it requires more work when creating new
translators. There are currently about 50 translators for which new
derived_mark methods will have to be created.
B. Create a dummy listener that protects all incoming events, and unprotects
them at the end of each moment. The easiest way is probably to let
Score-level translators take care of this. This is the easiest and safest
solution, but also the most inefficient one.
C. Create some macro trickery in translators, so that incoming events are
remembered and protected automatically between try_music and
stop_translation_timestep.
D. Add an 'event property to Music, so that sent events are protected by
their music origins. This is the easiest solution, but I'm nervous about
memory errors that can happen when a different front-end is used (e.g., when
loading music streams directly from a file)
--
Erik
es-060707.diff
Description: Text Data
- Updating translators,
Erik Sandberg <=
- Re: Updating translators, Han-Wen Nienhuys, 2006/07/08
- Re: Updating translators, Erik Sandberg, 2006/07/08
- Re: Updating translators, Han-Wen Nienhuys, 2006/07/09
- Re: Updating translators, Erik Sandberg, 2006/07/09
- Re: Updating translators, Han-Wen Nienhuys, 2006/07/09
- Re: Updating translators, Erik Sandberg, 2006/07/10
- Re: Updating translators, Han-Wen Nienhuys, 2006/07/10
- Re: Updating translators, Erik Sandberg, 2006/07/10