X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fdynamic-performer.cc;h=7f6008cb798ce54a4390fc7b8fbb48541493093a;hb=faaee71fb44c8e1040239797aad336f4e46c2c21;hp=ed60b2165f844d4cfcae059f23357305b4ea48e5;hpb=1b9fc29140bd1d9345f784595afd22158876dfb7;p=lilypond.git diff --git a/lily/dynamic-performer.cc b/lily/dynamic-performer.cc index ed60b2165f..7f6008cb79 100644 --- a/lily/dynamic-performer.cc +++ b/lily/dynamic-performer.cc @@ -3,26 +3,25 @@ source file of the GNU LilyPond music typesetter - (c) 2000 Jan Nieuwenhuizen + (c) 2000--2004 Jan Nieuwenhuizen */ #include "performer.hh" -#include "request.hh" +#include "event.hh" #include "audio-item.hh" /* TODO: - handle multiple requests - */ + + handle multiple events -/** - perform absolute (text) dynamics + perform absolute (text) dynamics */ 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 (); @@ -33,8 +32,6 @@ private: Audio_dynamic* audio_; }; - - Dynamic_performer::Dynamic_performer () { script_req_ = 0; @@ -49,28 +46,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 (ly_c_number_p (min) || ly_c_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); + if (ly_c_number_p (min)) + iv[MIN] = scm_to_double (min); + if (ly_c_number_p (max)) + iv[MAX] = scm_to_double (max); volume = iv[MIN] + iv.length () * volume; } else @@ -80,24 +75,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; } } @@ -124,7 +117,7 @@ Dynamic_performer::try_music (Music* r) { if (!script_req_) { - if (r->is_mus_type ("dynamic-event")) // fixme. + if (r->is_mus_type ("absolute-dynamic-event")) // fixme. { script_req_ = r; return true; @@ -133,10 +126,10 @@ Dynamic_performer::try_music (Music* r) return false; } -ENTER_DESCRIPTION(Dynamic_performer, +ENTER_DESCRIPTION (Dynamic_performer, /*descr*/ "", /* creats*/ "", - /* accepts */ "note-column-interface script-interface", + /* accepts */ "absolute-dynamic-event", /* acks */ "", /*reads */"dynamicAbsoluteVolumeFunction midiMaximumVolume midiMinimumVolume midiInstrument instrumentEqualizer", /*writes*/"");