]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/dynamic-performer.cc
patch::: 1.3.36.jcn4
[lilypond.git] / lily / dynamic-performer.cc
index 7fbca0dd698718d599a2dca4e009e224a2ed94bf..c9614b89de666172552e1b5d0252446d301c8ab5 100644 (file)
@@ -71,10 +71,49 @@ Dynamic_performer::do_process_music ()
         (ly_symbol2scm ("dynamic-absolute-volume"),
          ly_quote_scm (ly_str02scm (text_script_req_l_->text_str_.ch_C ())),
          SCM_UNDEFINED));
-      int volume = gh_scm2int (ly_eval_str ("dynamic-default-volume"));
+      Real volume = gh_scm2double (ly_eval_str ("dynamic-default-volume"));
       if (gh_number_p (s))
-       volume = gh_scm2int (s);
+       volume = gh_scm2double (s);
+      
+      /*
+       urg, code duplication:: staff_performer
+       */
+      s = get_property ("midiInstrument");
+      
+      if (!gh_string_p(s))
+       s = get_property ("instrument");
+
+      if (!gh_string_p(s))
+       s = ly_str02scm ("piano");
 
+      
+      /*
+       properties override default equaliser setting
+       */
+      SCM min = get_property ("midiMinimumVolume");
+      SCM max = get_property ("midiMaximumVolume");
+      if (gh_number_p (min) || gh_number_p (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);
+         volume = iv[MIN] + iv.length () * volume;
+       }
+      else
+       {
+         s = scm_eval (gh_list (ly_symbol2scm ("instrument-equaliser"),
+                                s, SCM_UNDEFINED));
+         if (gh_pair_p (s))
+           {
+             Interval iv;
+             iv[MIN] = gh_scm2double (gh_car (s));
+             iv[MAX] = gh_scm2double (gh_cdr (s));
+             volume = iv[MIN] + iv.length () * volume;
+           }
+       }
+      
       audio_p_ = new Audio_dynamic (volume);
       Audio_element_info info (audio_p_, text_script_req_l_);
       announce_element (info);