- /*
- 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
- {
- /*
- urg, code duplication:: staff_performer
- */
- SCM s = get_property ("midiInstrument");
-
- if (!gh_string_p(s))
- s = get_property ("instrument");
-
- if (!gh_string_p(s))
- s = ly_str02scm ("piano");
-
-
- SCM eq = get_property ("instrumentEqualizer");
- if (gh_procedure_p (eq))
- {
- s = gh_call1 (eq, s);
- }
-
- 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_, script_req_l_);
+ if (script_event_)
+ {
+ SCM proc = get_property ("dynamicAbsoluteVolumeFunction");
+
+ SCM svolume = SCM_EOL;
+ if (ly_is_procedure (proc))
+ {
+ // urg
+ svolume = scm_call_1 (proc, script_event_->get_property ("text"));
+ }
+
+ Real volume = robust_scm2double (svolume, 0.5);
+
+ last_volume_
+ = absolute_->volume_ = equalize_volume (volume);
+ }
+
+ Audio_element_info info (absolute_, script_event_);