]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/dynamic-performer.cc
* lily/output-def-scheme.cc: new file.
[lilypond.git] / lily / dynamic-performer.cc
index aefb86da9c823bc933827f279f6ef5a3703bb7ce..f6885b554b94f63338043adb6d7f7d47f0093fbe 100644 (file)
@@ -3,12 +3,10 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c)  2000--2003 Jan Nieuwenhuizen <janneke@gnu.org>
+  (c) 2000--2004 Jan Nieuwenhuizen <janneke@gnu.org>
 */
 
 #include "performer.hh"
-
-#include "event.hh"
 #include "audio-item.hh"
 
 /*
@@ -21,7 +19,7 @@
 class Dynamic_performer : public Performer
 {
 public:
-  TRANSLATOR_DECLARATIONS(Dynamic_performer);
+  TRANSLATOR_DECLARATIONS (Dynamic_performer);
 protected:
   virtual bool try_music (Music* req);
   virtual void stop_translation_timestep ();
@@ -46,28 +44,26 @@ Dynamic_performer::create_audio_elements ()
       SCM proc = get_property ("dynamicAbsoluteVolumeFunction");
 
       SCM svolume  = SCM_EOL;
-      if (gh_procedure_p (proc))
+      if (ly_c_procedure_p (proc))
        {
          // urg
-         svolume = gh_call1 (proc, script_req_->get_mus_property ("text"));
+         svolume = scm_call_1 (proc, script_req_->get_property ("text"));
        }
 
-      Real volume = 0.5; 
-      if (gh_number_p (svolume))
-       volume = gh_scm2double (svolume);
+      Real volume = robust_scm2double (svolume, 0.5); 
 
       /*
        properties override default equaliser setting
        */
       SCM min = get_property ("midiMinimumVolume");
       SCM max = get_property ("midiMaximumVolume");
-      if (gh_number_p (min) || gh_number_p (max))
+      if (scm_is_number (min) || scm_is_number (max))
        {
          Interval iv (0, 1);
-         if (gh_number_p (min))
-           iv[MIN] = gh_scm2double (min);
-         if (gh_number_p (max))
-           iv[MAX] = gh_scm2double (max);
+         if (scm_is_number (min))
+           iv[MIN] = scm_to_double (min);
+         if (scm_is_number (max))
+           iv[MAX] = scm_to_double (max);
          volume = iv[MIN] + iv.length () * volume;
        }
       else
@@ -77,24 +73,22 @@ Dynamic_performer::create_audio_elements ()
          */
          SCM s = get_property ("midiInstrument");
          
-         if (!gh_string_p (s))
+         if (!scm_is_string (s))
            s = get_property ("instrument");
          
-         if (!gh_string_p (s))
+         if (!scm_is_string (s))
            s = scm_makfrom0str ("piano");
          
          
          SCM eq = get_property ("instrumentEqualizer");
-         if (gh_procedure_p (eq))
+         if (ly_c_procedure_p (eq))
            {
-             s = gh_call1 (eq, s);
+             s = scm_call_1 (eq, s);
            }
 
-         if (gh_pair_p (s))
+         if (is_number_pair (s))
            {
-             Interval iv;
-             iv[MIN] = gh_scm2double (ly_car (s));
-             iv[MAX] = gh_scm2double (ly_cdr (s));
+             Interval iv = ly_scm2interval (s);
              volume = iv[MIN] + iv.length () * volume;
            }
        }
@@ -130,7 +124,7 @@ Dynamic_performer::try_music (Music* r)
   return false;
 }
 
-ENTER_DESCRIPTION(Dynamic_performer,
+ADD_TRANSLATOR (Dynamic_performer,
                  /*descr*/               "",
                  /* creats*/ "",
                  /* accepts */     "absolute-dynamic-event",