]> git.donarmstrong.com Git - lilypond.git/commitdiff
* lily/*-performer.cc: Converted try_music to listen_*
authorErik Sandberg <mandolaerik@gmail.com>
Wed, 19 Jul 2006 21:33:02 +0000 (21:33 +0000)
committerErik Sandberg <mandolaerik@gmail.com>
Wed, 19 Jul 2006 21:33:02 +0000 (21:33 +0000)
* lily/grob-info.cc, lily/engraver.cc: represent the cause of grob
as a stream-event internally. Introduce event_cause (), deprecate
music_cause ().

* scm/define-music-types.scm: Removed BusyPlayingEvent

43 files changed:
ChangeLog
lily/accidental-placement.cc
lily/arpeggio-engraver.cc
lily/audio-element-info.cc
lily/beam-performer.cc
lily/cluster-engraver.cc
lily/completion-note-heads-engraver.cc
lily/drum-note-engraver.cc
lily/drum-note-performer.cc
lily/dynamic-performer.cc
lily/easy-notation.cc
lily/engraver.cc
lily/grob-info.cc
lily/grob.cc
lily/include/audio-element-info.hh
lily/include/grob-info.hh
lily/include/music.hh
lily/include/stream-event.hh
lily/include/translator.hh
lily/key-performer.cc
lily/lyric-performer.cc
lily/music.cc
lily/note-heads-engraver.cc
lily/note-performer.cc
lily/piano-pedal-performer.cc
lily/slur-performer.cc
lily/span-dynamic-performer.cc
lily/stream-event-scheme.cc
lily/stream-event.cc
lily/swallow-perf.cc
lily/tab-note-heads-engraver.cc
lily/tempo-performer.cc
lily/tie-engraver.cc
lily/tie-performer.cc
lily/translator.cc
scm/define-event-classes.scm
scm/define-music-types.scm
scm/framework-gnome.scm
scm/output-lib.scm
scm/output-ps.scm
scm/output-socket.scm
scm/output-tex.scm
scm/stencil.scm

index 3b0154b619dbeb141e86e253576a3feeaf93e2bc..b75ac3fd9f5167d94083814badd0f48ab3c8cc04 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2006-07-19  Erik Sandberg  <mandolaerik@gmail.com>
+
+       * lily/*-performer.cc: Converted try_music to listen_*
+
+       * lily/grob-info.cc, lily/engraver.cc: represent the cause of grob
+       as a stream-event internally. Introduce event_cause (), deprecate
+       music_cause ().
+
+       * scm/define-music-types.scm: Removed BusyPlayingEvent
+       
 2006-07-19  Mats Bengtsson  <mabe@drongo.s3.kth.se>
 
        * Documentation/user/advanced-notation.itely (Font selection):
index d8702520e1817fc7637bf0a3740597486e022199..f05a5e67f552b34a1f5b952af9dc4ba4fe6919d0 100644 (file)
@@ -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 @@ Accidental_placement::add_accidental (Grob *me, Grob *a)
   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 d67d9da120269ae3cd4d51de49cf962d6eb3c697..1cc143dbd7beb9144decf9f80d1d58b4f88cd245 100644 (file)
@@ -45,7 +45,6 @@ IMPLEMENT_TRANSLATOR_LISTENER (Arpeggio_engraver, arpeggio);
 void Arpeggio_engraver::listen_arpeggio (Stream_event *ev)
 {
   arpeggio_event_ = ev;
-  ev->protect ();
 }
 
 void
@@ -86,7 +85,6 @@ Arpeggio_engraver::process_music ()
   if (arpeggio_event_)
     {
       arpeggio_ = make_item ("Arpeggio", arpeggio_event_->self_scm ());
-      arpeggio_event_->unprotect ();
     }
 }
 
index f6dd6b471fa164870fd2573f75baf43bdc701a61..877828bb9422ebc78a4ff7ea76b22a598fedac63 100644 (file)
@@ -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 0998ef3220d9e0c43adad8d230c42e3ef6c96748..6d36c78381774295d3d1c60411cf9bca29db0f66 100644 (file)
@@ -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 @@ public:
   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 @@ Beam_performer::start_translation_timestep ()
   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 faac5f79d0c90c5e66e82cbc0f9c41aa089f9c77..df26f6a689c8d07ddc9c3b290907ee44dfc4ac7e 100644 (file)
@@ -129,7 +129,7 @@ ADD_ACKNOWLEDGER (Cluster_spanner_engraver, note_column);
 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 6fe80dc30949e0bfb9638141c79bfd93c55ffdd5..aee5e181c24ce254f6680593b59a42fa5dd71bc5 100644 (file)
@@ -97,8 +97,6 @@ Completion_heads_engraver::try_music (Music *m)
 
       return true;
     }
-  else if (m->is_mus_type ("busy-playing-event"))
-    return note_events_.size () && is_first_;
 
   return false;
 }
@@ -303,6 +301,6 @@ ADD_TRANSLATOR (Completion_heads_engraver,
                "@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 1d1b8d2331c226a0845850cfd9b9e0d2fa18d74b..7a0adbda6e216e109ab37c6f7aea1f4372bf70f9 100644 (file)
@@ -46,8 +46,6 @@ Drum_notes_engraver::try_music (Music *m)
       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_ACKNOWLEDGER (Drum_notes_engraver, note_column);
 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 a29b7a1dee7986a512317066d44f61c7e603fd92..112ad6972c8ad872d149268629b0f8945a26cc8d 100644 (file)
 #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 @@ public:
   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 @@ Drum_note_performer::process_music ()
 
   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 @@ Drum_note_performer::process_music ()
 
       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 @@ Drum_note_performer::stop_translation_timestep ()
   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 05969cffad6fa28294388ea86afa820a2e225147..1289051bbb6a7107fa5cd1cdb46d83c3d8173008 100644 (file)
@@ -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 @@ class Dynamic_performer : public Performer
 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 @@ Dynamic_performer::stop_translation_timestep ()
     }
 }
 
-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 fde65143457560b00f1c4325401cd13f23d558f1..6ddc00e1d39418be0c9c628388b61f3f6df8e134 100644 (file)
 #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 @@ Note_head::brew_ez_stencil (SCM smob)
   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 7f7dc65f3a872d9aac101e9377742622cf3cf87e..cf2eebbe9b5c4a65515ba6a1fd3974ea656659a3 100644 (file)
@@ -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 @@ Engraver::announce_end_grob (Grob_info inf)
 }
 
 /*
-  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,7 +65,12 @@ Engraver::announce_grob (Grob *e, SCM cause)
 void
 Engraver::announce_end_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);
index a8f3f4c7b1c5320b1cfa34a2ddb9381fee193c5a..5ad3d5701e36fa6525fd422d017dcdd19528662a 100644 (file)
@@ -6,13 +6,14 @@
   (c) 1997--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
 */
 
+#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 @@ Grob_info::Grob_info ()
   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 @@ Grob_info::item () const
   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 @@ Grob_info::ultimate_music_cause () const
       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 c1545de824208cff345a3320594f057bdc720191..d13f127044f0011ed7757dace63767d71108b8f2 100644 (file)
@@ -514,6 +514,7 @@ Grob::warning (string s) const
   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 @@ Grob::programming_error (string s) const
 
   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 8eed5953733a9f25f6a9fd83f9e3c6690313a710..fd529bfde22f2244ad345526508a91d19de19d29 100644 (file)
@@ -19,12 +19,12 @@ class Audio_element_info
 {
 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 4ed3790954532d9695634631cef2ae10cd2c7be7..ebd860ef3a82869ee156886d6678f994b22a7f73 100644 (file)
@@ -29,7 +29,9 @@ public:
   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 3c43209b47307e256f8b8607ca9938b7f40617fa..f09ba2f851a1d856da0f87602ce1dfe6750a15be 100644 (file)
@@ -29,6 +29,8 @@ public:
 
   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 @@ public:
   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 0ac1b4712fc91bf53288e9cc714b49b8b27c00c1..6a1f8d98455cee7597959e53120016f1a125793f 100644 (file)
@@ -19,6 +19,7 @@ public:
   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 @@ public:
   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 eba2d6def4c6a76c83372aff508a11d91e607d2a..f39b122d8b83c91f9eb48d04517ec84a0a0b08f1 100644 (file)
@@ -137,5 +137,6 @@ protected:                  // should be private.
 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 26dbe93a8dec76763045dbb5d5b6c7d5f622e2bd..c2fc6346cc4909b639d26f01addad75cb341bad2 100644 (file)
@@ -6,11 +6,14 @@
   (c) 1997--2006 Jan Nieuwenhuizen <janneke@gnu.org>
 */
 
-#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 @@ public:
   ~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 @@ Key_performer::stop_translation_timestep ()
     }
 }
 
-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 935f06c35eb42e1e9a76a49a1fb715b9c988c291..5e3a919b2cf7391b16c7a5408f9149c7611e4e66 100644 (file)
@@ -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 @@ public:
   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 @@ Lyric_performer::stop_translation_timestep ()
   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 88f38f6a3899e7b69135991d49ef28f6193b4071..246074f475f132ca540ce5bdb8c4ee80661657fe 100644 (file)
@@ -236,17 +236,13 @@ Music::origin () const
   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 @@ Music::send_to_context (Context *c)
     }
   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 7b91132246c8ac377a9ab9894aba514cc17f066f..d650b675e76b645f6a23fb098c179e4a8071a87c 100644 (file)
@@ -45,8 +45,6 @@ Note_heads_engraver::try_music (Music *m)
       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 @@ ADD_TRANSLATOR (Note_heads_engraver,
                "NoteHead "
                "Dots",
                /* accept */
-               "note-event "
-               "busy-playing-event",
+               "note-event",
                /* read */ "middleCPosition",
                /* write */ "");
index 331e7cc60ff7ed4b9bfe710a23dbadfcf63b41d4..a9acca733a513c64a9e3e7453c04d18403416d27 100644 (file)
 #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 @@ public:
   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 @@ Note_performer::process_music ()
 
       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_performer::stop_translation_timestep ()
   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 4083c468f915279fbb19ea5f2d0da57264f6f13d..4048bb57a72ef522a54e0e8360e8b02fe3941ab0 100644 (file)
 
 #include "audio-item.hh"
 #include "international.hh"
-#include "music.hh"
+#include "stream-event.hh"
+#include "warn.hh"
+
+#include "translator.icc"
+
+#define SOSTENUTO      0
+#define SUSTAIN                1
+#define UNA_CORDA      2
+#define NUM_PEDAL_TYPES 3
 
 /**
    perform Piano pedals
@@ -19,71 +27,76 @@ class Piano_pedal_performer : public Performer
 {
   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:
   TRANSLATOR_DECLARATIONS (Piano_pedal_performer);
-  ~Piano_pedal_performer ();
 
 protected:
   virtual void initialize ();
-  virtual bool try_music (Music *);
+  static const char *pedal_type_str (int t);
   void process_music ();
   void stop_translation_timestep ();
   void start_translation_timestep ();
-
+  DECLARE_TRANSLATOR_LISTENER (sustain);
+  DECLARE_TRANSLATOR_LISTENER (una_corda);
+  DECLARE_TRANSLATOR_LISTENER (sostenuto);
 private:
   vector<Audio_piano_pedal*> audios_;
-  Pedal_info *info_alist_;
+  Pedal_info info_alist_[NUM_PEDAL_TYPES];
 };
 
 Piano_pedal_performer::Piano_pedal_performer ()
 {
-  info_alist_ = 0;
 }
 
-Piano_pedal_performer::~Piano_pedal_performer ()
+const char *
+Piano_pedal_performer::pedal_type_str (int t)
 {
-  delete[] info_alist_;
+  switch (t)
+    {
+    case SOSTENUTO: 
+      return "Sostenuto";
+    case SUSTAIN:
+      return "Sustain";
+    case UNA_CORDA: 
+      return "UnaCorda";
+    default:
+      programming_error ("Unknown pedal type");
+      return 0;
+    }
 }
 
 void
 Piano_pedal_performer::initialize ()
 {
-  info_alist_ = new Pedal_info[4];
   Pedal_info *p = info_alist_;
 
-  char *names [] = { "Sostenuto", "Sustain", "UnaCorda", 0 };
-  char **np = names;
-  do
+  for (int i = 0; i < NUM_PEDAL_TYPES; i++, p++)
     {
-      p->name_ = *np;
       p->event_drul_[START] = 0;
       p->event_drul_[STOP] = 0;
       p->start_event_ = 0;
-
-      p++;
     }
-  while (* (np++));
 }
 
 void
 Piano_pedal_performer::process_music ()
 {
-  for (Pedal_info *p = info_alist_; p && p->name_; p++)
+  Pedal_info *p = info_alist_;
 
+  for (int i = 0; i < NUM_PEDAL_TYPES; i++, p++)
     {
       if (p->event_drul_[STOP])
        {
          if (!p->start_event_)
-           p->event_drul_[STOP]->origin ()->warning (_f ("can't find start of piano pedal: `%s'", string (p->name_)));
+           p->event_drul_[STOP]->origin ()->warning (_f ("can't find start of piano pedal: `%s'", pedal_type_str (i)));
          else
            {
              Audio_piano_pedal *a = new Audio_piano_pedal;
-             a->type_string_ = string (p->name_);
+             a->type_string_ = string (pedal_type_str (i));
              a->dir_ = STOP;
              audios_.push_back (a);
               Audio_element_info info(a, p->event_drul_[STOP]);
@@ -96,7 +109,7 @@ Piano_pedal_performer::process_music ()
        {
          p->start_event_ = p->event_drul_[START];
          Audio_piano_pedal *a = new Audio_piano_pedal;
-         a->type_string_ = string (p->name_);
+         a->type_string_ = string (pedal_type_str (i));
          a->dir_ = START;
          audios_.push_back (a);
           Audio_element_info info(a, p->event_drul_[START]);
@@ -118,34 +131,37 @@ Piano_pedal_performer::stop_translation_timestep ()
 void
 Piano_pedal_performer::start_translation_timestep ()
 {
-  for (Pedal_info *p = info_alist_; p && p->name_; p++)
+  Pedal_info *p = info_alist_;
+  for (int i = 0; i < NUM_PEDAL_TYPES; i++, p++)
     {
       p->event_drul_[STOP] = 0;
       p->event_drul_[START] = 0;
     }
 }
 
-bool
-Piano_pedal_performer::try_music (Music *r)
+IMPLEMENT_TRANSLATOR_LISTENER (Piano_pedal_performer, sostenuto);
+void
+Piano_pedal_performer::listen_sostenuto (Stream_event *r)
 {
-  if (r->is_mus_type ("pedal-event"))
-    {
-      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 ())))
-           {
-             Direction d = to_dir (r->get_property ("span-direction"));
-             p->event_drul_[d] = r;
-             return true;
-           }
-       }
-    }
-  return false;
+  Direction d = to_dir (r->get_property ("span-direction"));
+  info_alist_[SOSTENUTO].event_drul_[d] = r;
 }
 
-#include "translator.icc"
+IMPLEMENT_TRANSLATOR_LISTENER (Piano_pedal_performer, sustain);
+void
+Piano_pedal_performer::listen_sustain (Stream_event *r)
+{
+  Direction d = to_dir (r->get_property ("span-direction"));
+  info_alist_[SUSTAIN].event_drul_[d] = r;
+}
+
+IMPLEMENT_TRANSLATOR_LISTENER (Piano_pedal_performer, una_corda);
+void
+Piano_pedal_performer::listen_una_corda (Stream_event *r)
+{
+  Direction d = to_dir (r->get_property ("span-direction"));
+  info_alist_[UNA_CORDA].event_drul_[d] = r;
+}
 
 ADD_TRANSLATOR (Piano_pedal_performer, "", "",
                "pedal-event",
index b699058f21312d6bb6a08457330ad0e03024dc6f..447897d8b64dffe672bbbfbb76c4e1ee7fca089b 100644 (file)
 #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 @@ public:
   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 @@ Slur_performer::start_translation_timestep ()
   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 3d8d053be2a303afa8213e18b00b2680fd9106a5..755dd86925c4c37a298507fc441447ab791c80ef 100644 (file)
@@ -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 @@ public:
   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 @@ Span_dynamic_performer::process_music ()
 
   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_dynamic_performer::stop_translation_timestep ()
   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 bdccd1483b7c26d2d50bc930448fd2a3516bcc66..ce337d5472a990b8e0b549527e5cb6bdfff31111 100644 (file)
@@ -17,7 +17,7 @@ LY_DEFINE (ly_make_stream_event, "ly:make-stream-event",
   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 e9fe80a22fa17d60269c418763029f41a370fca5..1019c9e85bf728b06b3178fecb85c4374dfd5d10 100644 (file)
@@ -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 @@ Stream_event::origin () const
   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 150e61b274a8d7977b7df7df02a992ad8b1e782f..a2e3aa7b85b3306a77914ae290eb2d52de5e55af 100644 (file)
@@ -20,8 +20,7 @@ protected:
 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 be9fa38515c16e52348408b42d71ed2d11de8092..b6f3f4ced9f2ff3d73009da13c41cf3d704cffe6 100644 (file)
@@ -58,8 +58,6 @@ Tab_note_heads_engraver::try_music (Music *m)
       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 @@ Tab_note_heads_engraver::stop_translation_timestep ()
 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 9a70f9cdc4d78a4ceec4a45d1249b76587e03656..e21f617b60f94a5e27e48152452a5a5fdafebae3 100644 (file)
@@ -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 @@ public:
 
 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 @@ Tempo_performer::stop_translation_timestep ()
     }
 }
 
-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 c7484ed0b7a27ed2b62de0242081593d5fecf1f1..2341c3d08e282db2263985f4cb61fffb27af73c9 100644 (file)
@@ -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 @@ Tie_engraver::acknowledge_note_head (Grob_info i)
   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 @@ Tie_engraver::stop_translation_timestep ()
       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 @@ Tie_engraver::stop_translation_timestep ()
              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 bf3c513bcbdf578ba1aa44814500fcea2c54e178..5e1256453e5efc6474586e4a83a3dc37fad9b20f 100644 (file)
@@ -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 @@ protected:
   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 @@ Tie_performer::Tie_performer ()
   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 @@ Tie_performer::acknowledge_audio_element (Audio_element_info inf)
       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 @@ Tie_performer::stop_translation_timestep ()
   now_heads_.clear ();
 }
 
-#include "translator.icc"
-
 ADD_TRANSLATOR (Tie_performer,
                /* doc */ "Generate ties between noteheads of equal pitch.",
                /* create */ "",
index 7bd0e6b47e7f19e69452e9d1e2c3e38663d7f598..6eab93b9a883e75cf004447f83f82722a09e054a 100644 (file)
@@ -231,6 +231,16 @@ generic_get_acknowledger (SCM sym, vector<Acknowledge_information> const *ack_ar
   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 86245efcbbc04c1f8444b39e4337b284b3aee850..f70e4d57c397eb2ab30ef8e91a1feeaf8a063d1f 100644 (file)
     ((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)
+    ((sostenuto-event sustain-event una-corda-event) . pedal-event)
     ((Announcement) . '())
     ((AnnounceNewContext) . Announcement)
     ))
index 757e9e3a1eee9ce876d1e9efccd6c3d984c3290d..489e27b2a25f18f42ff9355256ea42280a01831b 100644 (file)
@@ -124,12 +124,6 @@ Syntax:
 
        (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 7243ccebbcf9c678cd2ff039fbc766e4af9b55ca..9e8cf4510d955dcd123aca45a1fd85927ab79072 100644 (file)
 (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 e38d967e9573dc835417475cee90e7262b61b015..561184cbe9f69337d6662d777d462334b29f8f24 100644 (file)
@@ -248,17 +248,17 @@ centered, X==1 is at the right, X == -1 is at the left."
 
 (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 94d53f71defbefa0a9f255da433f795ce13b8b70..010e8f15a294da66383bc69105a7e1b1d8b298c1 100644 (file)
 
 (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 c8a0fac3c7e872f5c7359951a33ac681956c11be..e992e7c74b095605c4729338a10bdc3bb59f42cb 100644 (file)
          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 9068f5b9373df6a743c9aa37b707a91223d8c098..c9697f5f12a718ea005926bf510a87178f5073f9 100644 (file)
 
   (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 e4befe50d3de28076c0f9333d381a0a29051da92..cf810d6bd39179ba3e343e837852f4133539c4ac 100644 (file)
@@ -310,13 +310,13 @@ grestore
              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 @@ grestore
        ((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))