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"
14 #include "performer.hh"
16 class Tie_performer : public Performer
20 Array<Audio_element_info> now_heads_;
21 Array<Audio_element_info> heads_to_tie_;
26 virtual void stop_translation_timestep ();
27 virtual void start_translation_timestep ();
28 virtual void acknowledge_grob (Audio_element_info);
29 virtual bool try_music (Music*);
30 virtual void process_music ();
32 TRANSLATOR_DECLARATIONS(Tie_performer);
37 Tie_performer::Tie_performer ()
45 Tie_performer::try_music (Music *mus)
47 if (mus->is_mus_type ("tie-event"))
56 Tie_performer::process_music ()
59 daddy_context_->set_property ("tieMelismaBusy", SCM_BOOL_T);
63 Tie_performer::acknowledge_grob (Audio_element_info inf)
65 if (Audio_note * an = dynamic_cast<Audio_note *> (inf.elem_))
67 now_heads_.push (inf);
68 for (int i = heads_to_tie_.size (); i--;)
70 Music * right_mus = inf.event_;
72 Audio_note *th = dynamic_cast<Audio_note*> (heads_to_tie_[i].elem_);
73 Music * left_mus = heads_to_tie_[i].event_;
75 if (right_mus && left_mus
76 && gh_equal_p (right_mus->get_property ("pitch"),
77 left_mus->get_property ("pitch")))
86 Tie_performer::start_translation_timestep ()
88 daddy_context_->set_property ("tieMelismaBusy",
89 gh_bool2scm (heads_to_tie_.size ()));
94 Tie_performer::stop_translation_timestep ()
98 heads_to_tie_.clear ();
104 heads_to_tie_ = now_heads_;
105 last_event_ = event_;
111 ENTER_DESCRIPTION(Tie_performer,
112 /* descr */ "Generate ties between noteheads of equal pitch.",
114 /* accepts */ "tie-event",
116 /* reads */ "tieMelismaBusy",