X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Ftie-performer.cc;h=f415317ae7fee72df7843ac3198ed67285613f54;hb=951e47c99cccf317207848412262b9c6c37e01aa;hp=bfb0435eeacae31f50eea602839b5954e7a52165;hpb=969b3b0a27bbdaa721cb6b78a9ce82a9b0300277;p=lilypond.git diff --git a/lily/tie-performer.cc b/lily/tie-performer.cc index bfb0435eea..f415317ae7 100644 --- a/lily/tie-performer.cc +++ b/lily/tie-performer.cc @@ -1,15 +1,13 @@ -/* - new-tie-engraver.cc -- implement Tie_performer - +/* + tie-performer.cc -- implement Tie_performer + source file of the GNU LilyPond music typesetter - - (c) 1998--2004 Han-Wen Nienhuys - - */ + + (c) 1998--2005 Han-Wen Nienhuys +*/ #include "context.hh" #include "audio-item.hh" -#include "event.hh" #include "pqueue.hh" #include "performer.hh" @@ -21,26 +19,24 @@ class Tie_performer : public Performer Array heads_to_tie_; bool ties_created_; - + protected: virtual void stop_translation_timestep (); virtual void start_translation_timestep (); virtual void acknowledge_audio_element (Audio_element_info); - virtual bool try_music (Music*); + virtual bool try_music (Music *); virtual void process_music (); public: - TRANSLATOR_DECLARATIONS(Tie_performer); + TRANSLATOR_DECLARATIONS (Tie_performer); }; - - Tie_performer::Tie_performer () { event_ = 0; - last_event_ = 0; + last_event_ = 0; + ties_created_ = false; } - bool Tie_performer::try_music (Music *mus) { @@ -48,7 +44,7 @@ Tie_performer::try_music (Music *mus) { event_ = mus; } - + return true; } @@ -56,27 +52,28 @@ void Tie_performer::process_music () { if (event_) - daddy_context_->set_property ("tieMelismaBusy", SCM_BOOL_T); + context ()->set_property ("tieMelismaBusy", SCM_BOOL_T); } void Tie_performer::acknowledge_audio_element (Audio_element_info inf) { - if (Audio_note * an = dynamic_cast (inf.elem_)) + if (Audio_note *an = dynamic_cast (inf.elem_)) { now_heads_.push (inf); - for (int i = heads_to_tie_.size (); i--;) + for (int i = heads_to_tie_.size (); i--;) { - Music * right_mus = inf.event_; - - Audio_note *th = dynamic_cast (heads_to_tie_[i].elem_); - Music * left_mus = heads_to_tie_[i].event_; + Music *right_mus = inf.event_; + + Audio_note *th = dynamic_cast (heads_to_tie_[i].elem_); + Music *left_mus = heads_to_tie_[i].event_; if (right_mus && left_mus - && gh_equal_p (right_mus->get_property ("pitch"), - left_mus->get_property ("pitch"))) + && ly_c_equal_p (right_mus->get_property ("pitch"), + left_mus->get_property ("pitch"))) { an->tie_to (th); + ties_created_ = true; } } } @@ -85,9 +82,8 @@ Tie_performer::acknowledge_audio_element (Audio_element_info inf) void Tie_performer::start_translation_timestep () { - daddy_context_->set_property ("tieMelismaBusy", - gh_bool2scm (heads_to_tie_.size ())); - + context ()->set_property ("tieMelismaBusy", + ly_bool2scm (heads_to_tie_.size ())); } void @@ -97,8 +93,9 @@ Tie_performer::stop_translation_timestep () { heads_to_tie_.clear (); last_event_ = 0; + ties_created_ = false; } - + if (event_) { heads_to_tie_ = now_heads_; @@ -108,10 +105,10 @@ Tie_performer::stop_translation_timestep () now_heads_.clear (); } -ENTER_DESCRIPTION(Tie_performer, -/* descr */ "Generate ties between noteheads of equal pitch.", -/* creats*/ "", -/* accepts */ "tie-event", -/* acks */ "", -/* reads */ "tieMelismaBusy", -/* write */ ""); +ADD_TRANSLATOR (Tie_performer, + /* descr */ "Generate ties between noteheads of equal pitch.", + /* creats*/ "", + /* accepts */ "tie-event", + /* acks */ "", + /* reads */ "tieMelismaBusy", + /* write */ "");