]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/piano-pedal-performer.cc
* THANKS: add Don.
[lilypond.git] / lily / piano-pedal-performer.cc
index 859c4fa3f8527de2a2877a9f66b5c87af4eb247d..4083c468f915279fbb19ea5f2d0da57264f6f13d 100644 (file)
@@ -3,11 +3,13 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c) 2000--2005 Jan Nieuwenhuizen <janneke@gnu.org>
+  (c) 2000--2006 Jan Nieuwenhuizen <janneke@gnu.org>
 */
 
 #include "performer.hh"
+
 #include "audio-item.hh"
+#include "international.hh"
 #include "music.hh"
 
 /**
@@ -29,12 +31,12 @@ public:
 protected:
   virtual void initialize ();
   virtual bool try_music (Music *);
-  virtual void create_audio_elements ();
+  void process_music ();
   void stop_translation_timestep ();
   void start_translation_timestep ();
 
 private:
-  Link_array<Audio_piano_pedal> audios_;
+  vector<Audio_piano_pedal*> audios_;
   Pedal_info *info_alist_;
 };
 
@@ -69,7 +71,7 @@ Piano_pedal_performer::initialize ()
 }
 
 void
-Piano_pedal_performer::create_audio_elements ()
+Piano_pedal_performer::process_music ()
 {
   for (Pedal_info *p = info_alist_; p && p->name_; p++)
 
@@ -77,15 +79,15 @@ Piano_pedal_performer::create_audio_elements ()
       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'", string (p->name_)));
          else
            {
              Audio_piano_pedal *a = new Audio_piano_pedal;
-             a->type_string_ = String (p->name_);
+             a->type_string_ = string (p->name_);
              a->dir_ = STOP;
-             audios_.push (a);
+             audios_.push_back (a);
+              Audio_element_info info(a, p->event_drul_[STOP]);
+              announce_element (info);
            }
          p->start_event_ = 0;
        }
@@ -94,9 +96,11 @@ Piano_pedal_performer::create_audio_elements ()
        {
          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 (p->name_);
          a->dir_ = START;
-         audios_.push (a);
+         audios_.push_back (a);
+          Audio_element_info info(a, p->event_drul_[START]);
+          announce_element (info);
        }
       p->event_drul_[START] = 0;
       p->event_drul_[STOP] = 0;
@@ -106,7 +110,7 @@ Piano_pedal_performer::create_audio_elements ()
 void
 Piano_pedal_performer::stop_translation_timestep ()
 {
-  for (int i = 0; i < audios_.size (); i++)
+  for (vsize i = 0; i < audios_.size (); i++)
     play_element (audios_[i]);
   audios_.clear ();
 }
@@ -128,9 +132,9 @@ Piano_pedal_performer::try_music (Music *r)
     {
       for (Pedal_info *p = info_alist_; p->name_; p++)
        {
-         String nm = p->name_ + String ("Event");
+         string nm = p->name_ + string ("Event");
          if (ly_is_equal (r->get_property ("name"),
-                           scm_str2symbol (nm.to_str0 ())))
+                          scm_str2symbol (nm.c_str ())))
            {
              Direction d = to_dir (r->get_property ("span-direction"));
              p->event_drul_[d] = r;
@@ -145,4 +149,4 @@ Piano_pedal_performer::try_music (Music *r)
 
 ADD_TRANSLATOR (Piano_pedal_performer, "", "",
                "pedal-event",
-                "", "");
+               "", "");