]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/dynamic-performer.cc
trem fix
[lilypond.git] / lily / dynamic-performer.cc
index f3f60b9483bded2f0208d66e9b1e170765dc7619..86a1b5e0a293324a1e472b7b5021685a10d4231f 100644 (file)
 class Dynamic_performer : public Performer
 {
 public:
-  VIRTUAL_COPY_CONS (Translator);
-  
-  Dynamic_performer ();
-  ~Dynamic_performer ();
-
+  TRANSLATOR_DECLARATIONS(Dynamic_performer);
 protected:
-  virtual bool do_try_music (Music* req_l);
-  virtual void do_process_music ();
-  virtual void do_pre_move_processing ();
+  virtual bool try_music (Music* req_l);
+  virtual void stop_translation_timestep ();
+  virtual void create_audio_elements ();
 
 private:
-  Dynamic_script_req* script_req_l_;
+  Music* script_req_l_;
   Audio_dynamic* audio_p_;
 };
 
-ADD_THIS_TRANSLATOR (Dynamic_performer);
+
 
 Dynamic_performer::Dynamic_performer ()
 {
@@ -45,13 +41,8 @@ Dynamic_performer::Dynamic_performer ()
   audio_p_ = 0;
 }
 
-Dynamic_performer::~Dynamic_performer ()
-{
-}
-
-
 void
-Dynamic_performer::do_process_music ()
+Dynamic_performer::create_audio_elements ()
 {
   if (script_req_l_)
     {
@@ -61,7 +52,7 @@ Dynamic_performer::do_process_music ()
       if (gh_procedure_p (proc))
        {
          // urg
-         svolume = gh_call1 (proc, script_req_l_->text_); 
+         svolume = gh_call1 (proc, script_req_l_->get_mus_property ("text"));
        }
 
       Real volume = 0.5; 
@@ -89,10 +80,10 @@ Dynamic_performer::do_process_music ()
          */
          SCM s = get_property ("midiInstrument");
          
-         if (!gh_string_p(s))
+         if (!gh_string_p (s))
            s = get_property ("instrument");
          
-         if (!gh_string_p(s))
+         if (!gh_string_p (s))
            s = ly_str02scm ("piano");
          
          
@@ -105,8 +96,8 @@ Dynamic_performer::do_process_music ()
          if (gh_pair_p (s))
            {
              Interval iv;
-             iv[MIN] = gh_scm2double (gh_car (s));
-             iv[MAX] = gh_scm2double (gh_cdr (s));
+             iv[MIN] = gh_scm2double (ly_car (s));
+             iv[MAX] = gh_scm2double (ly_cdr (s));
              volume = iv[MIN] + iv.length () * volume;
            }
        }
@@ -119,7 +110,7 @@ Dynamic_performer::do_process_music ()
 }
 
 void
-Dynamic_performer::do_pre_move_processing ()
+Dynamic_performer::stop_translation_timestep ()
 {
   if (audio_p_)
     {
@@ -129,16 +120,19 @@ Dynamic_performer::do_pre_move_processing ()
 }
 
 bool
-Dynamic_performer::do_try_music (Music* r)
+Dynamic_performer::try_music (Music* r)
 {
   if (!script_req_l_)
     {
-      if(Dynamic_script_req* d = dynamic_cast <Dynamic_script_req*> (r))
+      if (dynamic_cast <Text_script_req*> (r)
+         && r->get_mus_property ("text-type") == ly_symbol2scm ("dynamic"))
        {
-         script_req_l_ = d;
+         script_req_l_ = r;
          return true;
        }
     }
   return false;
 }
 
+ENTER_DESCRIPTION(Dynamic_performer,
+                 "","","","dynamicAbsoluteVolumeFunction midiMaximumVolume midiMinimumVolume midiInstrument instrumentEqualizer","");