Hi,

I have finished converting all performers, as a warming-up round (it made me 
realise which obstacles I will encounter when converting engravers).

I also encountered and worked around a problem with engravers: The 'cause 
property of a grob is currently set to a music object sometimes. Eventually 
I'll change this to stream-event everywhere, but until then I've implemented 
a hybrid solution: Music causes are stored as stream-events internally, and 
Grob_info::music_cause converts that event back to Music. (to make things 
easy, I simply added a music-cause property to stream-events, which links 
back to the originating music. That property will be removed later.)

New methods for reading event_cause have been added as well.

I also removed the unused BusyPlayingEvent.

-- 
Erik
Index: lily/accidental-placement.cc
===================================================================
RCS file: /sources/lilypond/lilypond/lily/accidental-placement.cc,v
retrieving revision 1.70
diff -u -r1.70 accidental-placement.cc
--- lily/accidental-placement.cc	11 Feb 2006 11:35:18 -0000	1.70
+++ lily/accidental-placement.cc	17 Jul 2006 17:48:53 -0000
@@ -7,16 +7,17 @@
 */
 
 
-
 #include "accidental-placement.hh"
-#include "skyline.hh"
+
+#include "accidental-interface.hh"
 #include "music.hh"
-#include "pitch.hh"
-#include "warn.hh"
+#include "note-collision.hh"
 #include "note-column.hh"
+#include "pitch.hh"
 #include "pointer-group-interface.hh"
-#include "note-collision.hh"
-#include "accidental-interface.hh"
+#include "skyline.hh"
+#include "stream-event.hh"
+#include "warn.hh"
 
 
 void
@@ -26,10 +27,10 @@
   a->set_property ("X-offset", Grob::x_parent_positioning_proc);
   SCM cause = a->get_parent (Y_AXIS)->get_property ("cause");
 
-  Music *mcause = unsmob_music (cause);
+  Stream_event *mcause = unsmob_stream_event (cause);
   if (!mcause)
     {
-      programming_error ("note head has no music cause");
+      programming_error ("note head has no event cause");
       return;
     }
 
Index: lily/arpeggio-engraver.cc
===================================================================
RCS file: /sources/lilypond/lilypond/lily/arpeggio-engraver.cc,v
retrieving revision 1.43
diff -u -r1.43 arpeggio-engraver.cc
--- lily/arpeggio-engraver.cc	14 Jul 2006 06:58:29 -0000	1.43
+++ lily/arpeggio-engraver.cc	17 Jul 2006 17:48:53 -0000
@@ -45,7 +45,6 @@
 void Arpeggio_engraver::listen_arpeggio (Stream_event *ev)
 {
   arpeggio_event_ = ev;
-  ev->protect ();
 }
 
 void
@@ -86,7 +85,6 @@
   if (arpeggio_event_)
     {
       arpeggio_ = make_item ("Arpeggio", arpeggio_event_->self_scm ());
-      arpeggio_event_->unprotect ();
     }
 }
 
Index: lily/audio-element-info.cc
===================================================================
RCS file: /sources/lilypond/lilypond/lily/audio-element-info.cc,v
retrieving revision 1.21
diff -u -r1.21 audio-element-info.cc
--- lily/audio-element-info.cc	11 Feb 2006 11:35:18 -0000	1.21
+++ lily/audio-element-info.cc	17 Jul 2006 17:48:53 -0000
@@ -11,7 +11,7 @@
 #include "translator-group.hh"
 #include "context.hh"
 
-Audio_element_info::Audio_element_info (Audio_element *s, Music *r)
+Audio_element_info::Audio_element_info (Audio_element *s, Stream_event *r)
 {
   elem_ = s;
   origin_trans_ = 0;
Index: lily/beam-performer.cc
===================================================================
RCS file: /sources/lilypond/lilypond/lily/beam-performer.cc,v
retrieving revision 1.22
diff -u -r1.22 beam-performer.cc
--- lily/beam-performer.cc	6 Jan 2006 09:13:27 -0000	1.22
+++ lily/beam-performer.cc	17 Jul 2006 17:48:53 -0000
@@ -10,6 +10,7 @@
 #include "audio-item.hh"
 #include "audio-column.hh"
 #include "global-context.hh"
+#include "stream-event.hh"
 #include "warn.hh"
 #include "music.hh"
 
@@ -21,13 +22,13 @@
   TRANSLATOR_DECLARATIONS (Beam_performer);
 
 protected:
-  virtual bool try_music (Music *ev);
   void start_translation_timestep ();
   void process_music ();
   void set_melisma (bool);
+  DECLARE_TRANSLATOR_LISTENER (beam);
 private:
-  Music *start_ev_;
-  Music *now_stop_ev_;
+  Stream_event *start_ev_;
+  Stream_event *now_stop_ev_;
   bool beam_;
 };
 
@@ -69,20 +70,16 @@
   now_stop_ev_ = 0;
 }
 
-bool
-Beam_performer::try_music (Music *m)
+IMPLEMENT_TRANSLATOR_LISTENER (Beam_performer, beam);
+void
+Beam_performer::listen_beam (Stream_event *ev)
 {
-  if (m->is_mus_type ("beam-event"))
-    {
-      Direction d = to_dir (m->get_property ("span-direction"));
+  Direction d = to_dir (ev->get_property ("span-direction"));
 
-      if (d == START)
-	start_ev_ = m;
-      else if (d == STOP)
-	now_stop_ev_ = m;
-      return true;
-    }
-  return false;
+  if (d == START)
+    start_ev_ = ev;
+  else if (d == STOP)
+    now_stop_ev_ = ev;
 }
 
 ADD_TRANSLATOR (Beam_performer, "", "",
Index: lily/cluster-engraver.cc
===================================================================
RCS file: /sources/lilypond/lilypond/lily/cluster-engraver.cc,v
retrieving revision 1.45
diff -u -r1.45 cluster-engraver.cc
--- lily/cluster-engraver.cc	11 Feb 2006 11:35:18 -0000	1.45
+++ lily/cluster-engraver.cc	17 Jul 2006 17:48:53 -0000
@@ -129,7 +129,7 @@
 ADD_TRANSLATOR (Cluster_spanner_engraver,
 		/* doc */ 	"Engraves a cluster using Spanner notation ",
 		/* create */ 	"ClusterSpanner ClusterSpannerBeacon",
-		/* accept */ 	"cluster-note-event busy-playing-event",
+		/* accept */ 	"cluster-note-event",
 		/* read */ 	"",
 		/* write */	"");
 
Index: lily/completion-note-heads-engraver.cc
===================================================================
RCS file: /sources/lilypond/lilypond/lily/completion-note-heads-engraver.cc,v
retrieving revision 1.66
diff -u -r1.66 completion-note-heads-engraver.cc
--- lily/completion-note-heads-engraver.cc	11 Feb 2006 11:35:18 -0000	1.66
+++ lily/completion-note-heads-engraver.cc	17 Jul 2006 17:48:53 -0000
@@ -97,8 +97,6 @@
 
       return true;
     }
-  else if (m->is_mus_type ("busy-playing-event"))
-    return note_events_.size () && is_first_;
 
   return false;
 }
@@ -303,6 +301,6 @@
 		"@code{Note_heads_engraver}. It plays some trickery to "
 		"break long notes and automatically tie them into the next measure.",
 		/* create */ "NoteHead Dots Tie",
-		/* accept */ "busy-playing-event note-event",
+		/* accept */ "note-event",
 		/* read */ "middleCPosition measurePosition measureLength",
 		/* write */ "");
Index: lily/drum-note-engraver.cc
===================================================================
RCS file: /sources/lilypond/lilypond/lily/drum-note-engraver.cc,v
retrieving revision 1.48
diff -u -r1.48 drum-note-engraver.cc
--- lily/drum-note-engraver.cc	11 Feb 2006 11:35:18 -0000	1.48
+++ lily/drum-note-engraver.cc	17 Jul 2006 17:48:53 -0000
@@ -46,8 +46,6 @@
       events_.push_back (m);
       return true;
     }
-  else if (m->is_mus_type ("busy-playing-event"))
-    return events_.size ();
 
   return false;
 }
@@ -160,7 +158,7 @@
 ADD_TRANSLATOR (Drum_notes_engraver,
 		/* doc */ "Generate noteheads.",
 		/* create */ "NoteHead Dots Script",
-		/* accept */ "note-event busy-playing-event",
+		/* accept */ "note-event",
 		/* read */ "drumStyleTable",
 		/* write */ "");
 
Index: lily/drum-note-performer.cc
===================================================================
RCS file: /sources/lilypond/lilypond/lily/drum-note-performer.cc,v
retrieving revision 1.28
diff -u -r1.28 drum-note-performer.cc
--- lily/drum-note-performer.cc	11 Feb 2006 11:35:18 -0000	1.28
+++ lily/drum-note-performer.cc	17 Jul 2006 17:48:53 -0000
@@ -10,9 +10,10 @@
 #include "audio-item.hh"
 #include "audio-column.hh"
 #include "global-context.hh"
-#include "warn.hh"
 #include "pitch.hh"
-#include "music.hh"
+#include "stream-event.hh"
+#include "translator.icc"
+#include "warn.hh"
 
 class Drum_note_performer : public Performer
 {
@@ -20,12 +21,11 @@
   TRANSLATOR_DECLARATIONS (Drum_note_performer);
 
 protected:
-  virtual bool try_music (Music *ev);
   void stop_translation_timestep ();
   void process_music ();
-
+  DECLARE_TRANSLATOR_LISTENER (note);
 private:
-  vector<Music*> note_evs_;
+  vector<Stream_event*> note_evs_;
   vector<Audio_note*> notes_;
 };
 
@@ -40,7 +40,7 @@
 
   while (note_evs_.size ())
     {
-      Music *n = note_evs_.back ();
+      Stream_event *n = note_evs_.back ();
       note_evs_.pop_back ();
       SCM sym = n->get_property ("drum-type");
       SCM defn = SCM_EOL;
@@ -51,7 +51,7 @@
 
       if (Pitch *pit = unsmob_pitch (defn))
 	{
-	  Audio_note *p = new Audio_note (*pit, n->get_length (), 0);
+	  Audio_note *p = new Audio_note (*pit, get_event_length (n), 0);
 	  Audio_element_info info (p, n);
 	  announce_element (info);
 	  notes_.push_back (p);
@@ -73,22 +73,13 @@
   note_evs_.clear ();
 }
 
-bool
-Drum_note_performer::try_music (Music *ev)
+IMPLEMENT_TRANSLATOR_LISTENER (Drum_note_performer, note);
+void
+Drum_note_performer::listen_note (Stream_event *ev)
 {
-  if (ev->is_mus_type ("note-event"))
-    {
-      note_evs_.push_back (ev);
-      return true;
-    }
-  else if (ev->is_mus_type ("busy-playing-event"))
-    return note_evs_.size ();
-
-  return false;
+  note_evs_.push_back (ev);
 }
 
-#include "translator.icc"
-
 ADD_TRANSLATOR (Drum_note_performer,
 		"Play drum notes.", "",
-		"note-event busy-playing-event", "", "");
+		"note-event", "", "");
Index: lily/dynamic-performer.cc
===================================================================
RCS file: /sources/lilypond/lilypond/lily/dynamic-performer.cc,v
retrieving revision 1.50
diff -u -r1.50 dynamic-performer.cc
--- lily/dynamic-performer.cc	6 Jan 2006 09:13:27 -0000	1.50
+++ lily/dynamic-performer.cc	17 Jul 2006 17:48:53 -0000
@@ -9,7 +9,7 @@
 #include "performer.hh"
 
 #include "audio-item.hh"
-#include "music.hh"
+#include "stream-event.hh"
 #include "translator.icc"
 
 /*
@@ -24,12 +24,12 @@
 public:
   TRANSLATOR_DECLARATIONS (Dynamic_performer);
 protected:
-  virtual bool try_music (Music *event);
   void stop_translation_timestep ();
   void process_music ();
 
+  DECLARE_TRANSLATOR_LISTENER (absolute_dynamic);
 private:
-  Music *script_event_;
+  Stream_event *script_event_;
   Audio_dynamic *audio_;
 };
 
@@ -110,18 +110,12 @@
     }
 }
 
-bool
-Dynamic_performer::try_music (Music *r)
+IMPLEMENT_TRANSLATOR_LISTENER (Dynamic_performer, absolute_dynamic);
+void
+Dynamic_performer::listen_absolute_dynamic (Stream_event *r)
 {
   if (!script_event_)
-    {
-      if (r->is_mus_type ("absolute-dynamic-event")) // fixme.
-	{
-	  script_event_ = r;
-	  return true;
-	}
-    }
-  return false;
+    script_event_ = r;
 }
 
 ADD_TRANSLATOR (Dynamic_performer,
Index: lily/easy-notation.cc
===================================================================
RCS file: /sources/lilypond/lilypond/lily/easy-notation.cc,v
retrieving revision 1.11
diff -u -r1.11 easy-notation.cc
--- lily/easy-notation.cc	19 Jan 2006 22:39:13 -0000	1.11
+++ lily/easy-notation.cc	17 Jul 2006 17:48:53 -0000
@@ -11,14 +11,15 @@
 #include <cctype>
 using namespace std;
 
-#include "text-interface.hh"
+#include "font-interface.hh"
 #include "grob.hh"
-#include "output-def.hh"
 #include "music.hh"
+#include "output-def.hh"
 #include "pitch.hh"
-#include "font-interface.hh"
 #include "staff-symbol-referencer.hh"
 #include "stem.hh"
+#include "stream-event.hh"
+#include "text-interface.hh"
 
 /*
 
@@ -33,7 +34,7 @@
   int log = Note_head::get_balltype (me);
 
   SCM cause = me->get_property ("cause");
-  SCM spitch = unsmob_music (cause)->get_property ("pitch");
+  SCM spitch = unsmob_stream_event (cause)->get_property ("pitch");
   Pitch *pit = unsmob_pitch (spitch);
 
   SCM idx = scm_from_int (pit->get_notename ());
Index: lily/engraver.cc
===================================================================
RCS file: /sources/lilypond/lilypond/lily/engraver.cc,v
retrieving revision 1.80
diff -u -r1.80 engraver.cc
--- lily/engraver.cc	11 Jul 2006 05:58:00 -0000	1.80
+++ lily/engraver.cc	17 Jul 2006 17:48:53 -0000
@@ -8,13 +8,14 @@
 
 #include "engraver.hh"
 
+#include "context.hh"
+#include "item.hh"
+#include "lilypond-key.hh"
 #include "music.hh"
 #include "score-engraver.hh"
-#include "warn.hh"
 #include "spanner.hh"
-#include "item.hh"
-#include "context.hh"
-#include "lilypond-key.hh"
+#include "stream-event.hh"
+#include "warn.hh"
 
 Engraver_group *
 Engraver::get_daddy_engraver () const
@@ -35,13 +36,18 @@
 }
 
 /*
-  CAUSE is the object (typically a Music object)  that
+  CAUSE is the object (typically a Stream_event object)  that
   was the reason for making E.
 */
 void
 Engraver::announce_grob (Grob *e, SCM cause)
 {
-  if (unsmob_music (cause) || unsmob_grob (cause))
+  /* TODO: Remove Music code when it's no longer needed */
+  if (Music *m = unsmob_music (cause))
+    {
+      cause = m->to_event ()->unprotect ();
+    }
+  if (unsmob_stream_event (cause) || unsmob_grob (cause))
     e->set_property ("cause", cause);
 
   Grob_info i (this, e);
@@ -59,6 +65,11 @@
 void
 Engraver::announce_end_grob (Grob *e, SCM cause)
 {
+  /* TODO: Remove Music code when it's no longer needed */
+  if (Music *m = unsmob_music (cause))
+    {
+      cause = m->to_event ()->unprotect ();
+    }
   if (unsmob_music (cause) || unsmob_grob (cause))
     e->set_property ("cause", cause);
 
Index: lily/grob-info.cc
===================================================================
RCS file: /sources/lilypond/lilypond/lily/grob-info.cc,v
retrieving revision 1.29
diff -u -r1.29 grob-info.cc
--- lily/grob-info.cc	30 May 2006 15:47:16 -0000	1.29
+++ lily/grob-info.cc	17 Jul 2006 17:48:53 -0000
@@ -6,13 +6,14 @@
   (c) 1997--2006 Han-Wen Nienhuys <[EMAIL PROTECTED]>
 */
 
+#include "context.hh"
 #include "grob-info.hh"
 #include "grob.hh"
+#include "item.hh"
 #include "music.hh"
-#include "translator-group.hh"
-#include "context.hh"
 #include "spanner.hh"
-#include "item.hh"
+#include "stream-event.hh"
+#include "translator-group.hh"
 
 Grob_info::Grob_info (Translator *t, Grob *g)
 {
@@ -28,11 +29,29 @@
   origin_trans_ = 0;
 }
 
+/* ES TODO: Junk this when no more engravers use try_music */
 Music *
 Grob_info::music_cause () const
 {
   SCM cause = grob_->get_property ("cause");
-  return unsmob_music (cause);
+
+  Music *ret = unsmob_music (cause);
+  if (ret)
+    return ret;
+  else
+    {
+      Stream_event *ev = unsmob_stream_event (cause);
+      if (!ev)
+	return 0;
+      return unsmob_music (ev->get_property ("music-cause"));
+    }
+}
+
+Stream_event *
+Grob_info::event_cause () const
+{
+  SCM cause = grob_->get_property ("cause");
+  return unsmob_stream_event (cause);
 }
 
 vector<Context*>
@@ -68,6 +87,20 @@
   return dynamic_cast<Item *> (grob_);
 }
 
+Stream_event *
+Grob_info::ultimate_event_cause () const
+{
+  SCM cause = grob_->self_scm ();
+  while (unsmob_grob (cause))
+    {
+      cause = unsmob_grob (cause)->get_property ("cause");
+    }
+  return unsmob_stream_event (cause);
+}
+
+/*
+ES TODO: Junk this when no more engraver uses try_music
+*/
 Music *
 Grob_info::ultimate_music_cause () const
 {
@@ -77,6 +110,12 @@
       cause = unsmob_grob (cause)->get_property ("cause");
     }
 
-  return unsmob_music (cause);
+  Music *ret = unsmob_music (cause);
+  if (ret)
+    return ret;
+  else
+    {
+      Stream_event *ev = unsmob_stream_event (cause);
+      return unsmob_music (ev->get_property ("music-cause"));
+    }
 }
-
Index: lily/grob.cc
===================================================================
RCS file: /sources/lilypond/lilypond/lily/grob.cc,v
retrieving revision 1.172
diff -u -r1.172 grob.cc
--- lily/grob.cc	14 Jul 2006 06:58:29 -0000	1.172
+++ lily/grob.cc	17 Jul 2006 17:48:54 -0000
@@ -514,6 +514,7 @@
   while (Grob *g = unsmob_grob (cause))
     cause = g->get_property ("cause");
 
+  /* ES TODO: cause can't be Music*/
   if (Music *m = unsmob_music (cause))
     m->origin ()->warning (s);
   else if (Stream_event *ev = unsmob_stream_event (cause))
@@ -541,6 +542,7 @@
 
   s = _f ("programming error: %s", s);
 
+  /* ES TODO: cause can't be Music*/
   if (Music *m = unsmob_music (cause))
     m->origin ()->message (s);
   else if (Stream_event *ev = unsmob_stream_event (cause))
Index: lily/key-performer.cc
===================================================================
RCS file: /sources/lilypond/lilypond/lily/key-performer.cc,v
retrieving revision 1.71
diff -u -r1.71 key-performer.cc
--- lily/key-performer.cc	6 Jan 2006 09:13:26 -0000	1.71
+++ lily/key-performer.cc	17 Jul 2006 17:48:54 -0000
@@ -6,11 +6,14 @@
   (c) 1997--2006 Jan Nieuwenhuizen <[EMAIL PROTECTED]>
 */
 
-#include "music-sequence.hh"
 #include "audio-item.hh"
+#include "music-sequence.hh"
 #include "performer.hh"
+#include "stream-event.hh"
 #include "warn.hh"
 
+#include "translator.icc"
+
 class Key_performer : public Performer
 {
 public:
@@ -18,12 +21,12 @@
   ~Key_performer ();
 
 protected:
-  virtual bool try_music (Music *ev);
   void process_music ();
   void stop_translation_timestep ();
 
+  DECLARE_TRANSLATOR_LISTENER (key_change);
 private:
-  Music *key_ev_;
+  Stream_event *key_ev_;
   Audio_key *audio_;
 };
 
@@ -85,17 +88,14 @@
     }
 }
 
-bool
-Key_performer::try_music (Music *ev)
+IMPLEMENT_TRANSLATOR_LISTENER (Key_performer, key_change);
+void
+Key_performer::listen_key_change (Stream_event *ev)
 {
   if (!key_ev_)
     key_ev_ = ev;
-
-  return true;
 }
 
-#include "translator.icc"
-
 ADD_TRANSLATOR (Key_performer,
 		"", "",
 		"key-change-event",
Index: lily/lyric-performer.cc
===================================================================
RCS file: /sources/lilypond/lilypond/lily/lyric-performer.cc,v
retrieving revision 1.55
diff -u -r1.55 lyric-performer.cc
--- lily/lyric-performer.cc	11 Feb 2006 11:35:17 -0000	1.55
+++ lily/lyric-performer.cc	17 Jul 2006 17:48:54 -0000
@@ -8,7 +8,8 @@
 
 #include "audio-item.hh"
 #include "performer.hh"
-#include "music.hh"
+#include "stream-event.hh"
+#include "translator.icc"
 
 class Lyric_performer : public Performer
 {
@@ -16,12 +17,11 @@
   TRANSLATOR_DECLARATIONS (Lyric_performer);
 protected:
 
-  virtual bool try_music (Music *event);
   void stop_translation_timestep ();
-   void process_music ();
-
+  void process_music ();
+  DECLARE_TRANSLATOR_LISTENER (lyric);
 private:
-  vector<Music*> events_;
+  vector<Stream_event *> events_;
   Audio_text *audio_;
 };
 
@@ -57,18 +57,12 @@
   events_.clear ();
 }
 
-bool
-Lyric_performer::try_music (Music *event)
+IMPLEMENT_TRANSLATOR_LISTENER (Lyric_performer, lyric);
+void
+Lyric_performer::listen_lyric (Stream_event *event)
 {
-  if (event->is_mus_type ("lyric-event"))
-    {
-      events_.push_back (event);
-      return true;
-    }
-  return false;
+  events_.push_back (event);
 }
 
-#include "translator.icc"
-
 ADD_TRANSLATOR (Lyric_performer, "", "", "lyric-event",
 		"", "");
Index: lily/music.cc
===================================================================
RCS file: /sources/lilypond/lilypond/lily/music.cc,v
retrieving revision 1.153
diff -u -r1.153 music.cc
--- lily/music.cc	14 Jul 2006 06:58:29 -0000	1.153
+++ lily/music.cc	17 Jul 2006 17:48:54 -0000
@@ -236,17 +236,13 @@
   return ip ? ip : &dummy_input_global;
 }
 
-void
-Music::send_to_context (Context *c)
+/*
+  ES TODO: This method should probably be reworked or junked.
+*/
+Stream_event *
+Music::to_event () const
 {
-  /*
-    TODO: This is a work-in-progress solution. Send the event so it
-    can be read both by old-style translators and the new ones.
-  */
-  send_stream_event (c, "OldMusicEvent", origin (),
-  		     ly_symbol2scm("music"), self_scm (), 0);
-
-  /* UGH. This is a temp hack for Music->Stream_event transition */
+  /* UGH. Temp hack */
   SCM orig_sym = get_property ("name");
   char out[200];
   string in = ly_symbol2string (orig_sym);
@@ -261,9 +257,33 @@
     }
   out[outpos] = 0;
   SCM class_name = ly_symbol2scm (out);
-  
+
   Stream_event *e = new Stream_event (class_name, mutable_property_alist_);
-  c->event_source ()->broadcast (e);
+  Moment length = get_length ();
+  if (length.to_bool ())
+    e->set_property ("length", length.smobbed_copy ());
+
+  /*
+    ES TODO: This is a temporary fix. Stream_events should not be
+    aware of music.
+  */
+  e->set_property ("music-cause", self_scm ());
+  return e;
+}
+
+void
+Music::send_to_context (Context *c)
+{
+  /*
+    TODO: This is a work-in-progress solution. Send the event so it
+    can be read both by old-style translators and the new ones.
+  */
+  send_stream_event (c, "OldMusicEvent", origin (),
+  		     ly_symbol2scm("music"), self_scm (), 0);
+
+  Stream_event *ev = to_event ();
+  c->event_source ()->broadcast (ev);
+  ev->unprotect ();
 }
 
 Music *
Index: lily/note-heads-engraver.cc
===================================================================
RCS file: /sources/lilypond/lilypond/lily/note-heads-engraver.cc,v
retrieving revision 1.118
diff -u -r1.118 note-heads-engraver.cc
--- lily/note-heads-engraver.cc	15 Feb 2006 13:09:15 -0000	1.118
+++ lily/note-heads-engraver.cc	17 Jul 2006 17:48:54 -0000
@@ -45,8 +45,6 @@
       note_evs_.push_back (m);
       return true;
     }
-  else if (m->is_mus_type ("busy-playing-event"))
-    return note_evs_.size ();
 
   return false;
 }
@@ -132,7 +130,6 @@
 		"NoteHead "
 		"Dots",
 		/* accept */
-		"note-event "
-		"busy-playing-event",
+		"note-event",
 		/* read */ "middleCPosition",
 		/* write */ "");
Index: lily/note-performer.cc
===================================================================
RCS file: /sources/lilypond/lilypond/lily/note-performer.cc,v
retrieving revision 1.71
diff -u -r1.71 note-performer.cc
--- lily/note-performer.cc	11 Feb 2006 11:35:17 -0000	1.71
+++ lily/note-performer.cc	17 Jul 2006 17:48:54 -0000
@@ -10,8 +10,10 @@
 #include "audio-item.hh"
 #include "audio-column.hh"
 #include "global-context.hh"
+#include "stream-event.hh"
 #include "warn.hh"
-#include "music.hh"
+
+#include "translator.icc"
 
 /**
    Convert evs to audio notes.
@@ -22,13 +24,12 @@
   TRANSLATOR_DECLARATIONS (Note_performer);
 
 protected:
-  virtual bool try_music (Music *ev);
-
   void stop_translation_timestep ();
   void process_music ();
 
+  DECLARE_TRANSLATOR_LISTENER (note);
 private:
-  vector<Music*> note_evs_;
+  vector<Stream_event*> note_evs_;
   vector<Audio_note*> notes_;
 };
 
@@ -45,13 +46,13 @@
 
       while (note_evs_.size ())
 	{
-	  Music *n = note_evs_.back ();
+	  Stream_event *n = note_evs_.back ();
 	  note_evs_.pop_back ();
 	  SCM pit = n->get_property ("pitch");
 
 	  if (Pitch *pitp = unsmob_pitch (pit))
 	    {
-	      Audio_note *p = new Audio_note (*pitp, n->get_length (), - transposing);
+	      Audio_note *p = new Audio_note (*pitp, get_event_length (n), - transposing);
 	      Audio_element_info info (p, n);
 	      announce_element (info);
 	      notes_.push_back (p);
@@ -73,25 +74,15 @@
   note_evs_.clear ();
 }
 
-bool
-Note_performer::try_music (Music *ev)
+IMPLEMENT_TRANSLATOR_LISTENER (Note_performer, note)
+void
+Note_performer::listen_note (Stream_event *ev)
 {
-  if (ev->is_mus_type ("note-event"))
-    {
-      note_evs_.push_back (ev);
-      return true;
-    }
-  else if (ev->is_mus_type ("busy-playing-event"))
-    return note_evs_.size ();
-
-  return false;
+  note_evs_.push_back (ev);
 }
 
-#include "translator.icc"
-
 ADD_TRANSLATOR (Note_performer, "", "",
-		"note-event "
-		"busy-playing-event",
+		"note-event ",
 		"", "");
 
 Note_performer::Note_performer ()
Index: lily/piano-pedal-performer.cc
===================================================================
RCS file: /sources/lilypond/lilypond/lily/piano-pedal-performer.cc,v
retrieving revision 1.52
diff -u -r1.52 piano-pedal-performer.cc
--- lily/piano-pedal-performer.cc	11 Feb 2006 11:35:17 -0000	1.52
+++ lily/piano-pedal-performer.cc	17 Jul 2006 17:48:54 -0000
@@ -10,7 +10,9 @@
 
 #include "audio-item.hh"
 #include "international.hh"
-#include "music.hh"
+#include "stream-event.hh"
+
+#include "translator.icc"
 
 /**
    perform Piano pedals
@@ -20,8 +22,8 @@
   struct Pedal_info
   {
     char const *name_;
-    Music *start_event_;
-    Drul_array<Music *> event_drul_;
+    Stream_event *start_event_;
+    Drul_array<Stream_event *> event_drul_;
   };
 
 public:
@@ -30,11 +32,10 @@
 
 protected:
   virtual void initialize ();
-  virtual bool try_music (Music *);
   void process_music ();
   void stop_translation_timestep ();
   void start_translation_timestep ();
-
+  DECLARE_TRANSLATOR_LISTENER (pedal);
 private:
   vector<Audio_piano_pedal*> audios_;
   Pedal_info *info_alist_;
@@ -125,28 +126,23 @@
     }
 }
 
-bool
-Piano_pedal_performer::try_music (Music *r)
+IMPLEMENT_TRANSLATOR_LISTENER (Piano_pedal_performer, pedal);
+void
+Piano_pedal_performer::listen_pedal (Stream_event *r)
 {
-  if (r->is_mus_type ("pedal-event"))
+  for (Pedal_info *p = info_alist_; p->name_; p++)
     {
-      for (Pedal_info *p = info_alist_; p->name_; p++)
+      string nm = p->name_ + string ("Event");
+      if (ly_is_equal (r->get_property ("name"),
+		       scm_str2symbol (nm.c_str ())))
 	{
-	  string nm = p->name_ + string ("Event");
-	  if (ly_is_equal (r->get_property ("name"),
-			   scm_str2symbol (nm.c_str ())))
-	    {
-	      Direction d = to_dir (r->get_property ("span-direction"));
-	      p->event_drul_[d] = r;
-	      return true;
-	    }
+	  Direction d = to_dir (r->get_property ("span-direction"));
+	  p->event_drul_[d] = r;
+	  return;
 	}
     }
-  return false;
 }
 
-#include "translator.icc"
-
 ADD_TRANSLATOR (Piano_pedal_performer, "", "",
 		"pedal-event",
 		"", "");
Index: lily/slur-performer.cc
===================================================================
RCS file: /sources/lilypond/lilypond/lily/slur-performer.cc,v
retrieving revision 1.21
diff -u -r1.21 slur-performer.cc
--- lily/slur-performer.cc	6 Jan 2006 09:13:25 -0000	1.21
+++ lily/slur-performer.cc	17 Jul 2006 17:48:54 -0000
@@ -10,8 +10,10 @@
 #include "audio-item.hh"
 #include "audio-column.hh"
 #include "global-context.hh"
+#include "stream-event.hh"
 #include "warn.hh"
-#include "music.hh"
+
+#include "translator.icc"
 
 /*
   this is C&P from beam_performer.
@@ -23,13 +25,14 @@
   TRANSLATOR_DECLARATIONS (Slur_performer);
 
 protected:
-  virtual bool try_music (Music *ev);
   void start_translation_timestep ();
   void process_music ();
   void set_melisma (bool);
+  
+  DECLARE_TRANSLATOR_LISTENER (slur);
 private:
-  Music *start_ev_;
-  Music *now_stop_ev_;
+  Stream_event *start_ev_;
+  Stream_event *now_stop_ev_;
   bool slur_;
 };
 
@@ -69,26 +72,19 @@
   now_stop_ev_ = 0;
 }
 
-bool
-Slur_performer::try_music (Music *m)
+IMPLEMENT_TRANSLATOR_LISTENER (Slur_performer, slur);
+void
+Slur_performer::listen_slur (Stream_event *ev)
 {
-  if (m->is_mus_type ("slur-event"))
-    {
-      Direction d = to_dir (m->get_property ("span-direction"));
+  Direction d = to_dir (ev->get_property ("span-direction"));
 
-      if (d == START)
-	start_ev_ = m;
-      else if (d == STOP)
-	now_stop_ev_ = m;
-      return true;
-    }
-  return false;
+  if (d == START)
+    start_ev_ = ev;
+  else if (d == STOP)
+    now_stop_ev_ = ev;
 }
 
-#include "translator.icc"
-
 ADD_TRANSLATOR (Slur_performer,
 		"", "",
 		"slur-event",
 		"", "");
-
Index: lily/span-dynamic-performer.cc
===================================================================
RCS file: /sources/lilypond/lilypond/lily/span-dynamic-performer.cc,v
retrieving revision 1.45
diff -u -r1.45 span-dynamic-performer.cc
--- lily/span-dynamic-performer.cc	11 Feb 2006 11:35:17 -0000	1.45
+++ lily/span-dynamic-performer.cc	17 Jul 2006 17:48:54 -0000
@@ -10,7 +10,9 @@
 
 #include "audio-item.hh"
 #include "international.hh"
-#include "music.hh"
+#include "stream-event.hh"
+
+#include "translator.icc"
 
 /*
   TODO: fold this into 1 engraver: \< and \> should also stop when
@@ -31,16 +33,17 @@
   TRANSLATOR_DECLARATIONS (Span_dynamic_performer);
 
 protected:
-  virtual bool try_music (Music *);
   virtual void acknowledge_audio_element (Audio_element_info);
   void process_music ();
   void stop_translation_timestep ();
 
+  DECLARE_TRANSLATOR_LISTENER (decrescendo);
+  DECLARE_TRANSLATOR_LISTENER (crescendo);
 private:
   Audio_dynamic *audio_;
   Real last_volume_;
-  Music *span_start_event_;
-  Drul_array<Music *> span_events_;
+  Stream_event *span_start_event_;
+  Drul_array<Stream_event *> span_events_;
   vector<Audio_dynamic_tuple> dynamic_tuples_;
   vector<Audio_dynamic_tuple> finished_dynamic_tuples_;
   Direction dir_;
@@ -95,7 +98,7 @@
 
   if (span_events_[START])
     {
-      dir_ = (span_events_[START]->is_mus_type ("crescendo-event"))
+      dir_ = (span_events_[START]->in_event_class ("crescendo-event"))
 	? RIGHT : LEFT;
       span_start_event_ = span_events_[START];
 
@@ -163,19 +166,21 @@
   span_events_[START] = 0;
 }
 
-bool
-Span_dynamic_performer::try_music (Music *r)
+IMPLEMENT_TRANSLATOR_LISTENER (Span_dynamic_performer, decrescendo);
+void
+Span_dynamic_performer::listen_decrescendo (Stream_event *r)
 {
-  if (r->is_mus_type ("crescendo-event")
-      || r->is_mus_type ("decrescendo-event"))
-    {
-      Direction d = to_dir (r->get_property ("span-direction"));
-      span_events_[d] = r;
-      return true;
-    }
-  return false;
+  Direction d = to_dir (r->get_property ("span-direction"));
+  span_events_[d] = r;
+}
+
+IMPLEMENT_TRANSLATOR_LISTENER (Span_dynamic_performer, crescendo);
+void
+Span_dynamic_performer::listen_crescendo (Stream_event *r)
+{
+  Direction d = to_dir (r->get_property ("span-direction"));
+  span_events_[d] = r;
 }
-#include "translator.icc"
 
 ADD_TRANSLATOR (Span_dynamic_performer,
 		"", "",
Index: lily/stream-event-scheme.cc
===================================================================
RCS file: /sources/lilypond/lilypond/lily/stream-event-scheme.cc,v
retrieving revision 1.1
diff -u -r1.1 stream-event-scheme.cc
--- lily/stream-event-scheme.cc	5 May 2006 15:59:21 -0000	1.1
+++ lily/stream-event-scheme.cc	17 Jul 2006 17:48:54 -0000
@@ -17,7 +17,7 @@
   return e->unprotect ();
 }
 
-LY_DEFINE (ly_stream_event_property, "ly:stream-event-property", 
+LY_DEFINE (ly_event_property, "ly:event-property", 
            2, 0, 0, (SCM sev, SCM sym),
 	   "Get the property @var{sym} of stream event @var{mus}.\n"
 	   "If @var{sym} is undefined, return @code{' ()}.\n")
Index: lily/stream-event.cc
===================================================================
RCS file: /sources/lilypond/lilypond/lily/stream-event.cc,v
retrieving revision 1.3
diff -u -r1.3 stream-event.cc
--- lily/stream-event.cc	14 Jul 2006 06:58:29 -0000	1.3
+++ lily/stream-event.cc	17 Jul 2006 17:48:54 -0000
@@ -13,6 +13,8 @@
 #include "input.hh"
 #include "input-smob.hh"
 
+/* TODO: Rename Stream_event -> Event */
+
 Stream_event::Stream_event ()
   : Prob (ly_symbol2scm ("Stream_event"), SCM_EOL)
 {
@@ -53,11 +55,20 @@
   return i ? i : &dummy_input_global;
 }
 
-void Stream_event::set_spot (Input *i)
+void
+Stream_event::set_spot (Input *i)
 {
   set_property ("origin", make_input (*i));
 }
 
+bool
+Stream_event::internal_in_event_class (SCM class_name)
+{
+  SCM cl = get_property ("class");
+  cl = scm_call_1 (ly_lily_module_constant ("ly:make-event-class"), cl);
+  return scm_c_memq (class_name, cl) != SCM_BOOL_F;
+}
+
 IMPLEMENT_TYPE_P (Stream_event, "ly:stream-event?");
 
 MAKE_SCHEME_CALLBACK (Stream_event, undump, 1);
Index: lily/swallow-perf.cc
===================================================================
RCS file: /sources/lilypond/lilypond/lily/swallow-perf.cc,v
retrieving revision 1.28
diff -u -r1.28 swallow-perf.cc
--- lily/swallow-perf.cc	6 Jan 2006 09:13:24 -0000	1.28
+++ lily/swallow-perf.cc	17 Jul 2006 17:48:54 -0000
@@ -20,8 +20,7 @@
 bool
 Swallow_performer::try_music (Music *m)
 {
-  if (m->is_mus_type ("busy-playing-event")
-      || m->is_mus_type ("melisma-playing-event"))
+  if (m->is_mus_type ("melisma-playing-event"))
     return false;
   else
     return true;
Index: lily/tab-note-heads-engraver.cc
===================================================================
RCS file: /sources/lilypond/lilypond/lily/tab-note-heads-engraver.cc,v
retrieving revision 1.59
diff -u -r1.59 tab-note-heads-engraver.cc
--- lily/tab-note-heads-engraver.cc	15 Feb 2006 01:38:10 -0000	1.59
+++ lily/tab-note-heads-engraver.cc	17 Jul 2006 17:48:54 -0000
@@ -58,8 +58,6 @@
       tabstring_events_.push_back (m);
       return true;
     }
-  else if (m->is_mus_type ("busy-playing-event"))
-    return note_events_.size ();
 
   return false;
 }
@@ -168,7 +166,7 @@
 ADD_TRANSLATOR (Tab_note_heads_engraver,
 		/* doc */ "Generate one or more tablature noteheads from Music of type NoteEvent.",
 		/* create */ "TabNoteHead Dots",
-		/* accept */ "note-event string-number-event busy-playing-event",
+		/* accept */ "note-event string-number-event",
 		/* read */ "middleCPosition stringTunings minimumFret tablatureFormat highStringOne stringOneTopmost",
 		/* write */ "");
 
Index: lily/tempo-performer.cc
===================================================================
RCS file: /sources/lilypond/lilypond/lily/tempo-performer.cc,v
retrieving revision 1.43
diff -u -r1.43 tempo-performer.cc
--- lily/tempo-performer.cc	6 Jan 2006 09:13:24 -0000	1.43
+++ lily/tempo-performer.cc	17 Jul 2006 17:48:54 -0000
@@ -9,8 +9,10 @@
 #include "performer.hh"
 
 #include "audio-item.hh"
-#include "music.hh"
 #include "duration.hh"
+#include "stream-event.hh"
+
+#include "translator.icc"
 
 class Tempo_performer : public Performer
 {
@@ -20,12 +22,11 @@
 
 protected:
 
-  virtual bool try_music (Music *event);
   void stop_translation_timestep ();
   void process_music ();
-
+  DECLARE_TRANSLATOR_LISTENER (metronome_change);
 private:
-  Music *tempo_event_;
+  Stream_event *tempo_event_;
   Audio_tempo *audio_;
 };
 
@@ -67,18 +68,13 @@
     }
 }
 
-bool
-Tempo_performer::try_music (Music *event)
+IMPLEMENT_TRANSLATOR_LISTENER (Tempo_performer, metronome_change);
+void
+Tempo_performer::listen_metronome_change (Stream_event *event)
 {
-  if (tempo_event_)
-    return false;
-
   tempo_event_ = event;
-  return true;
 }
 
-#include "translator.icc"
-
 ADD_TRANSLATOR (Tempo_performer, "", "",
 		"metronome-change-event",
 		"", "");
Index: lily/tie-engraver.cc
===================================================================
RCS file: /sources/lilypond/lilypond/lily/tie-engraver.cc,v
retrieving revision 1.122
diff -u -r1.122 tie-engraver.cc
--- lily/tie-engraver.cc	8 Jun 2006 15:14:16 -0000	1.122
+++ lily/tie-engraver.cc	17 Jul 2006 17:48:54 -0000
@@ -16,6 +16,7 @@
 #include "protected-scm.hh"
 #include "spanner.hh"
 #include "staff-symbol-referencer.hh"
+#include "stream-event.hh"
 #include "tie-column.hh"
 #include "tie.hh"
 #include "warn.hh"
@@ -103,15 +104,15 @@
   for (vsize i = heads_to_tie_.size (); i--;)
     {
       Grob *th = heads_to_tie_[i].head_;
-      Music *right_mus = unsmob_music (h->get_property ("cause"));
-      Music *left_mus = unsmob_music (th->get_property ("cause"));
+      Stream_event *right_ev = unsmob_stream_event (h->get_property ("cause"));
+      Stream_event *left_ev = unsmob_stream_event (th->get_property ("cause"));
 
       /*
 	maybe should check positions too.
       */
-      if (right_mus && left_mus
-	  && ly_is_equal (right_mus->get_property ("pitch"),
-			  left_mus->get_property ("pitch")))
+      if (right_ev && left_ev
+	  && ly_is_equal (right_ev->get_property ("pitch"),
+			  left_ev->get_property ("pitch")))
 	{
 	  Grob *p = new Spanner (heads_to_tie_[i].tie_definition_,
 				 context ()->get_grob_key ("Tie"));
@@ -176,8 +177,8 @@
       for (vsize i = 0; i < now_heads_.size (); i++)
 	{
 	  Grob *head = now_heads_[i];
-	  Music *left_mus = unsmob_music (head->get_property ("cause"));
-	  if (left_mus)
+	  Stream_event *left_ev = unsmob_stream_event (head->get_property ("cause"));
+	  if (left_ev)
 	    {
 	      Head_event_tuple event_tup;
 
@@ -188,11 +189,11 @@
 	      Moment end = now_mom ();
 	      if (end.grace_part_)
 		{
-		  end.grace_part_ += left_mus->get_length ().main_part_;
+		  end.grace_part_ += get_event_length (left_ev).main_part_;
 		}
 	      else
 		{
-		  end += left_mus->get_length (); 
+		  end += get_event_length (left_ev);
 		}
 	      event_tup.end_moment_ = end;
 
Index: lily/tie-performer.cc
===================================================================
RCS file: /sources/lilypond/lilypond/lily/tie-performer.cc,v
retrieving revision 1.62
diff -u -r1.62 tie-performer.cc
--- lily/tie-performer.cc	11 Feb 2006 11:35:17 -0000	1.62
+++ lily/tie-performer.cc	17 Jul 2006 17:48:54 -0000
@@ -8,15 +8,16 @@
 
 #include "performer.hh"
 
-#include "music.hh"
-#include "context.hh"
 #include "audio-item.hh"
+#include "context.hh"
 #include "pqueue.hh"
+#include "stream-event.hh"
+#include "translator.icc"
 
 class Tie_performer : public Performer
 {
-  Music *event_;
-  Music *last_event_;
+  Stream_event *event_;
+  Stream_event *last_event_;
   vector<Audio_element_info> now_heads_;
   vector<Audio_element_info> heads_to_tie_;
 
@@ -26,8 +27,8 @@
   void stop_translation_timestep ();
   void start_translation_timestep ();
   virtual void acknowledge_audio_element (Audio_element_info);
-  virtual bool try_music (Music *);
   void process_music ();
+  DECLARE_TRANSLATOR_LISTENER (tie);
 public:
   TRANSLATOR_DECLARATIONS (Tie_performer);
 };
@@ -39,13 +40,11 @@
   ties_created_ = false;
 }
 
-bool
-Tie_performer::try_music (Music *mus)
+IMPLEMENT_TRANSLATOR_LISTENER (Tie_performer, tie);
+void
+Tie_performer::listen_tie (Stream_event *ev)
 {
-  if (mus->is_mus_type ("tie-event"))
-    event_ = mus;
-
-  return true;
+  event_ = ev;
 }
 
 void
@@ -63,10 +62,10 @@
       now_heads_.push_back (inf);
       for (vsize i = heads_to_tie_.size (); i--;)
 	{
-	  Music *right_mus = inf.event_;
+	  Stream_event *right_mus = inf.event_;
 
 	  Audio_note *th = dynamic_cast<Audio_note *> (heads_to_tie_[i].elem_);
-	  Music *left_mus = heads_to_tie_[i].event_;
+	  Stream_event *left_mus = heads_to_tie_[i].event_;
 
 	  if (right_mus && left_mus
 	      && ly_is_equal (right_mus->get_property ("pitch"),
@@ -105,8 +104,6 @@
   now_heads_.clear ();
 }
 
-#include "translator.icc"
-
 ADD_TRANSLATOR (Tie_performer,
 		/* doc */ "Generate ties between noteheads of equal pitch.",
 		/* create */ "",
Index: lily/translator.cc
===================================================================
RCS file: /sources/lilypond/lilypond/lily/translator.cc,v
retrieving revision 1.102
diff -u -r1.102 translator.cc
--- lily/translator.cc	14 Jul 2006 06:58:29 -0000	1.102
+++ lily/translator.cc	17 Jul 2006 17:48:54 -0000
@@ -231,6 +231,16 @@
   return 0;
 }
 
+Moment
+get_event_length (Stream_event *e)
+{
+  Moment *m = unsmob_moment (e->get_property ("length"));
+  if (m)
+    return *m;
+  else
+    return Moment (0);
+}
+
 ADD_TRANSLATOR (Translator,
 		"Base class. Unused",
 		"",
Index: lily/include/audio-element-info.hh
===================================================================
RCS file: /sources/lilypond/lilypond/lily/include/audio-element-info.hh,v
retrieving revision 1.18
diff -u -r1.18 audio-element-info.hh
--- lily/include/audio-element-info.hh	11 Feb 2006 11:35:17 -0000	1.18
+++ lily/include/audio-element-info.hh	17 Jul 2006 17:48:54 -0000
@@ -19,12 +19,12 @@
 {
 public:
   Audio_element *elem_;
-  Music *event_;
+  Stream_event *event_;
   Translator *origin_trans_;
 
   vector<Context*> origin_contexts (Translator *) const;
 
-  Audio_element_info (Audio_element *, Music *);
+  Audio_element_info (Audio_element *, Stream_event *);
   Audio_element_info ();
 };
 
Index: lily/include/grob-info.hh
===================================================================
RCS file: /sources/lilypond/lilypond/lily/include/grob-info.hh,v
retrieving revision 1.27
diff -u -r1.27 grob-info.hh
--- lily/include/grob-info.hh	30 May 2006 15:47:16 -0000	1.27
+++ lily/include/grob-info.hh	17 Jul 2006 17:48:54 -0000
@@ -29,7 +29,9 @@
   Translator *origin_translator () const { return origin_trans_; }
 
   Context *context () const;
+  Stream_event *event_cause () const;
   Music *music_cause () const;
+  Stream_event *ultimate_event_cause () const;
   Music *ultimate_music_cause () const;
   vector<Context*> origin_contexts (Translator *) const;
   Grob_info (Translator *, Grob *);
Index: lily/include/music.hh
===================================================================
RCS file: /sources/lilypond/lilypond/lily/include/music.hh,v
retrieving revision 1.79
diff -u -r1.79 music.hh
--- lily/include/music.hh	16 May 2006 11:30:55 -0000	1.79
+++ lily/include/music.hh	17 Jul 2006 17:48:54 -0000
@@ -29,6 +29,8 @@
 
   bool internal_is_music_type (SCM) const;
 
+  Stream_event *to_event () const;
+
   DECLARE_SCHEME_CALLBACK (relative_callback, (SCM, SCM));
   Pitch to_relative_octave (Pitch);
   Pitch generic_to_relative_octave (Pitch);
@@ -46,7 +48,7 @@
   void send_to_context (Context *c);
 
   DECLARE_SCHEME_CALLBACK (duration_length_callback, (SCM));
-  
+ 
 protected:
   virtual SCM copy_mutable_properties () const;
   virtual void type_check_assignment (SCM, SCM) const;
Index: lily/include/stream-event.hh
===================================================================
RCS file: /sources/lilypond/lilypond/lily/include/stream-event.hh,v
retrieving revision 1.4
diff -u -r1.4 stream-event.hh
--- lily/include/stream-event.hh	14 Jul 2006 06:58:29 -0000	1.4
+++ lily/include/stream-event.hh	17 Jul 2006 17:48:54 -0000
@@ -19,6 +19,7 @@
   Stream_event ();
   Input *origin () const;
   void set_spot (Input *i);
+  bool internal_in_event_class (SCM class_name);
 
   DECLARE_SCHEME_CALLBACK (undump, (SCM));
   DECLARE_SCHEME_CALLBACK (dump, (SCM));
@@ -30,6 +31,8 @@
   Stream_event (Stream_event *ev);
 };
 
+#define in_event_class(class_name) internal_in_event_class (ly_symbol2scm (class_name))
+
 Stream_event *unsmob_stream_event (SCM);
 DECLARE_TYPE_P (Stream_event);
 
Index: lily/include/translator.hh
===================================================================
RCS file: /sources/lilypond/lilypond/lily/include/translator.hh,v
retrieving revision 1.102
diff -u -r1.102 translator.hh
--- lily/include/translator.hh	14 Jul 2006 06:58:29 -0000	1.102
+++ lily/include/translator.hh	17 Jul 2006 17:48:54 -0000
@@ -137,5 +137,6 @@
 void add_translator (Translator *trans);
 
 Translator *get_translator (SCM s);
+Moment get_event_length (Stream_event *s);
 DECLARE_UNSMOB (Translator, translator);
 #endif // TRANSLATOR_HH
Index: scm/define-event-classes.scm
===================================================================
RCS file: /sources/lilypond/lilypond/scm/define-event-classes.scm,v
retrieving revision 1.4
diff -u -r1.4 define-event-classes.scm
--- scm/define-event-classes.scm	14 Jul 2006 06:58:29 -0000	1.4
+++ scm/define-event-classes.scm	17 Jul 2006 17:48:54 -0000
@@ -13,7 +13,12 @@
     ((RemoveContext ChangeParent Override Revert UnsetProperty
       SetProperty MusicEvent OldMusicEvent CreateContext Prepare
       OneTimeStep Finish) . StreamEvent)
-    ((arpeggio-event) . MusicEvent)
+    ((arpeggio-event 
+      beam-event note-event absolute-dynamic-event
+      key-change-event lyric-event pedal-event slur-event tie-event
+      metronome-change-event span-dynamic-event)
+     . MusicEvent)
+    ((decrescendo-event crescendo-event) . span-dynamic-event)
     ((Announcement) . '())
     ((AnnounceNewContext) . Announcement)
     ))
Index: scm/define-music-types.scm
===================================================================
RCS file: /sources/lilypond/lilypond/scm/define-music-types.scm,v
retrieving revision 1.83
diff -u -r1.83 define-music-types.scm
--- scm/define-music-types.scm	4 Jul 2006 07:38:50 -0000	1.83
+++ scm/define-music-types.scm	17 Jul 2006 17:48:54 -0000
@@ -119,12 +119,6 @@
 
 	(types . (general-music event breathing-event))
 	)) 
-    (BusyPlayingEvent
-     . (
-	(description .	"Used internally to signal beginning and ending of notes.")
-
-	(types . (general-music event busy-playing-event))
-	))
     (ContextChange
      . (
 	(description .	"Change staffs in Piano staff. 
Index: scm/framework-gnome.scm
===================================================================
RCS file: /sources/lilypond/lilypond/scm/framework-gnome.scm,v
retrieving revision 1.51
diff -u -r1.51 framework-gnome.scm
--- scm/framework-gnome.scm	6 Feb 2006 01:13:58 -0000	1.51
+++ scm/framework-gnome.scm	17 Jul 2006 17:48:55 -0000
@@ -193,12 +193,12 @@
 (define location-callback spawn-editor)
 
 (define (get-location grob)
-  (and-let* ((p? (procedure? point-and-click))
+  (and-let* ((p (procedure? point-and-click))
 	     (g grob)
 	     (cause (ly:grob-property grob 'cause))
-	     (music-origin (if (ly:music? cause)
-			       (ly:music-property cause 'origin)
-			       ;; How come #<unspecied> [and '()]
+	     (music-origin (if (ly:event? cause)
+			       (ly:event-property cause 'origin)
+			       ;; How come #<unspecified> [and '()]
 			       ;; are #t? :-(
 			       #f)))
 	    (if (ly:input-location? music-origin)
Index: scm/output-lib.scm
===================================================================
RCS file: /sources/lilypond/lilypond/scm/output-lib.scm,v
retrieving revision 1.101
diff -u -r1.101 output-lib.scm
--- scm/output-lib.scm	11 Jul 2006 10:44:49 -0000	1.101
+++ scm/output-lib.scm	17 Jul 2006 17:48:55 -0000
@@ -248,17 +248,17 @@
 
 (define-public (tuplet-number::calc-denominator-text grob)
   (let*
-      ((mus (ly:grob-property grob 'cause)))
+      ((ev (ly:grob-property grob 'cause)))
     
-    (number->string (ly:music-property mus 'denominator))))
+    (number->string (ly:event-property ev 'denominator))))
 
 
 (define-public (tuplet-number::calc-fraction-text grob)
   (let*
-      ((mus (ly:grob-property grob 'cause)))
+      ((ev (ly:grob-property grob 'cause)))
     (format "~a:~a" 
-      (ly:music-property mus 'denominator)
-      (ly:music-property mus 'numerator))))
+      (ly:event-property ev 'denominator)
+      (ly:event-property ev 'numerator))))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Color
Index: scm/output-ps.scm
===================================================================
RCS file: /sources/lilypond/lilypond/scm/output-ps.scm,v
retrieving revision 1.171
diff -u -r1.171 output-ps.scm
--- scm/output-ps.scm	17 Jul 2006 09:40:36 -0000	1.171
+++ scm/output-ps.scm	17 Jul 2006 17:48:55 -0000
@@ -174,8 +174,8 @@
 
 (define (grob-cause offset grob)
   (let* ((cause (ly:grob-property grob 'cause))
-	 (music-origin (if (ly:music? cause)
-			   (ly:music-property cause 'origin))))
+	 (music-origin (if (ly:stream-event? cause)
+			   (ly:event-property cause 'origin))))
     (if (not (ly:input-location? music-origin))
 	""
 	(let* ((location (ly:input-file-line-char-column music-origin))
Index: scm/output-socket.scm
===================================================================
RCS file: /sources/lilypond/lilypond/scm/output-socket.scm,v
retrieving revision 1.10
diff -u -r1.10 output-socket.scm
--- scm/output-socket.scm	20 May 2006 19:54:42 -0000	1.10
+++ scm/output-socket.scm	17 Jul 2006 17:48:55 -0000
@@ -49,12 +49,12 @@
 	  breapth width depth height blot-diameter
 	  ))
 
-(define (music-cause grob)
+(define (event-cause grob)
   (let*
       ((cause (ly:grob-property  grob 'cause)))
 
     (cond
-     ((ly:music? cause) cause)
+     ((ly:stream-event? cause) cause)
 ;     ((ly:grob? cause) (music-cause cause))
      (else
       #f))))
@@ -83,9 +83,9 @@
 
 (define-public (grob-cause offset grob)
   (let*
-      ((cause (music-cause grob))
-       (tag (if (and cause (integer? (ly:music-property cause 'input-tag)))
-		(ly:music-property cause 'input-tag)
+      ((cause (event-cause grob))
+       (tag (if (and cause (integer? (ly:event-property cause 'input-tag)))
+		(ly:event-property cause 'input-tag)
 		-1))
        (name (cdr (assoc 'name (ly:grob-property grob 'meta))))
        )
Index: scm/output-tex.scm
===================================================================
RCS file: /sources/lilypond/lilypond/scm/output-tex.scm,v
retrieving revision 1.97
diff -u -r1.97 output-tex.scm
--- scm/output-tex.scm	6 Feb 2006 01:13:59 -0000	1.97
+++ scm/output-tex.scm	17 Jul 2006 17:48:55 -0000
@@ -173,8 +173,8 @@
 
   (if (procedure? point-and-click)
       (let* ((cause (ly:grob-property grob 'cause))
-	     (music-origin (if (ly:music? cause)
-			       (ly:music-property cause 'origin)))
+	     (music-origin (if (ly:stream-event? cause)
+			       (ly:event-property cause 'origin)))
 	     (location (if (ly:input-location? music-origin)
 			   (ly:input-file-line-column music-origin))))
 	(if (pair? location)
Index: scm/stencil.scm
===================================================================
RCS file: /sources/lilypond/lilypond/scm/stencil.scm,v
retrieving revision 1.40
diff -u -r1.40 stencil.scm
--- scm/stencil.scm	17 Jul 2006 09:40:36 -0000	1.40
+++ scm/stencil.scm	17 Jul 2006 17:48:55 -0000
@@ -310,13 +310,13 @@
 	      rest))
 	expr))
   
-  (define (music-cause grob)
+  (define (event-cause grob)
     (let*
 	((cause (ly:grob-property  grob 'cause)))
       
       (cond
-       ((ly:music? cause) cause)
-       ((ly:grob? cause) (music-cause cause))
+       ((ly:stream-event? cause) cause)
+       ((ly:grob? cause) (event-cause cause))
        (else #f))))
 
   (define (pythonic-string expr)
@@ -341,8 +341,8 @@
 	((grob (car expr))
 	 (rest (cdr expr))
 	 (collected '())
-	 (cause (music-cause grob))
-	 (input (if (ly:music? cause) (ly:music-property cause 'origin) #f))
+	 (cause (event-cause grob))
+	 (input (if (ly:stream-event? cause) (ly:event-property cause 'origin) #f))
 	 (location (if (ly:input-location? input) (ly:input-file-line-char-column input) '()))
 
 	 (x-ext (ly:grob-extent grob system-grob X))
_______________________________________________
lilypond-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to