2 new-tie-engraver.cc -- implement Tie_performer
4 source file of the GNU LilyPond music typesetter
6 (c) 1998--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
11 #include "audio-item.hh"
13 #include "performer.hh"
15 class Tie_performer : public Performer
19 Array<Audio_element_info> now_heads_;
20 Array<Audio_element_info> heads_to_tie_;
25 virtual void stop_translation_timestep ();
26 virtual void start_translation_timestep ();
27 virtual void acknowledge_audio_element (Audio_element_info);
28 virtual bool try_music (Music*);
29 virtual void process_music ();
31 TRANSLATOR_DECLARATIONS (Tie_performer);
34 Tie_performer::Tie_performer ()
38 ties_created_ = false;
42 Tie_performer::try_music (Music *mus)
44 if (mus->is_mus_type ("tie-event"))
53 Tie_performer::process_music ()
56 context ()->set_property ("tieMelismaBusy", SCM_BOOL_T);
60 Tie_performer::acknowledge_audio_element (Audio_element_info inf)
62 if (Audio_note * an = dynamic_cast<Audio_note *> (inf.elem_))
64 now_heads_.push (inf);
65 for (int i = heads_to_tie_.size (); i--;)
67 Music * right_mus = inf.event_;
69 Audio_note *th = dynamic_cast<Audio_note*> (heads_to_tie_[i].elem_);
70 Music * left_mus = heads_to_tie_[i].event_;
72 if (right_mus && left_mus
73 && ly_c_equal_p (right_mus->get_property ("pitch"),
74 left_mus->get_property ("pitch")))
84 Tie_performer::start_translation_timestep ()
86 context ()->set_property ("tieMelismaBusy",
87 ly_bool2scm (heads_to_tie_.size ()));
92 Tie_performer::stop_translation_timestep ()
96 heads_to_tie_.clear ();
98 ties_created_ = false;
103 heads_to_tie_ = now_heads_;
104 last_event_ = event_;
110 ADD_TRANSLATOR (Tie_performer,
111 /* descr */ "Generate ties between noteheads of equal pitch.",
113 /* accepts */ "tie-event",
115 /* reads */ "tieMelismaBusy",