X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fdynamic-performer.cc;h=7320ef7e242757e818564b5803ab95f600e01cc8;hb=11816bfa82647652f10acefb44ea53f793c4cc50;hp=71ce23fb7415fd9b39b130aa4655da7a3eb79bac;hpb=58bcc84c9480dae1b21bc24d8396b91fe19e0131;p=lilypond.git diff --git a/lily/dynamic-performer.cc b/lily/dynamic-performer.cc index 71ce23fb74..7320ef7e24 100644 --- a/lily/dynamic-performer.cc +++ b/lily/dynamic-performer.cc @@ -7,7 +7,10 @@ */ #include "performer.hh" + #include "audio-item.hh" +#include "music.hh" +#include "translator.icc" /* TODO: @@ -21,33 +24,33 @@ class Dynamic_performer : public Performer public: TRANSLATOR_DECLARATIONS (Dynamic_performer); protected: - virtual bool try_music (Music *req); - virtual void stop_translation_timestep (); - virtual void create_audio_elements (); + virtual bool try_music (Music *event); + void stop_translation_timestep (); + void process_music (); private: - Music *script_req_; + Music *script_event_; Audio_dynamic *audio_; }; Dynamic_performer::Dynamic_performer () { - script_req_ = 0; + script_event_ = 0; audio_ = 0; } void -Dynamic_performer::create_audio_elements () +Dynamic_performer::process_music () { - if (script_req_) + if (script_event_) { SCM proc = get_property ("dynamicAbsoluteVolumeFunction"); SCM svolume = SCM_EOL; - if (ly_c_procedure_p (proc)) + if (ly_is_procedure (proc)) { // urg - svolume = scm_call_1 (proc, script_req_->get_property ("text")); + svolume = scm_call_1 (proc, script_event_->get_property ("text")); } Real volume = robust_scm2double (svolume, 0.5); @@ -80,10 +83,8 @@ Dynamic_performer::create_audio_elements () s = scm_makfrom0str ("piano"); SCM eq = get_property ("instrumentEqualizer"); - if (ly_c_procedure_p (eq)) - { - s = scm_call_1 (eq, s); - } + if (ly_is_procedure (eq)) + s = scm_call_1 (eq, s); if (is_number_pair (s)) { @@ -93,9 +94,9 @@ Dynamic_performer::create_audio_elements () } audio_ = new Audio_dynamic (volume); - Audio_element_info info (audio_, script_req_); + Audio_element_info info (audio_, script_event_); announce_element (info); - script_req_ = 0; + script_event_ = 0; } } @@ -112,11 +113,11 @@ Dynamic_performer::stop_translation_timestep () bool Dynamic_performer::try_music (Music *r) { - if (!script_req_) + if (!script_event_) { if (r->is_mus_type ("absolute-dynamic-event")) // fixme. { - script_req_ = r; + script_event_ = r; return true; } } @@ -124,9 +125,8 @@ Dynamic_performer::try_music (Music *r) } ADD_TRANSLATOR (Dynamic_performer, - /*descr*/ "", - /* creats*/ "", - /* accepts */ "absolute-dynamic-event", - /* acks */ "", - /*reads */"dynamicAbsoluteVolumeFunction midiMaximumVolume midiMinimumVolume midiInstrument instrumentEqualizer", + /* doc */ "", + /* create */ "", + /* accept */ "absolute-dynamic-event", + /* read */ "dynamicAbsoluteVolumeFunction midiMaximumVolume midiMinimumVolume midiInstrument instrumentEqualizer", /*writes*/"");