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_audio_element (Audio_element_info
);
29 virtual bool try_music (Music
*);
30 virtual void process_music ();
32 TRANSLATOR_DECLARATIONS (Tie_performer
);
37 Tie_performer::Tie_performer ()
41 ties_created_
= false;
46 Tie_performer::try_music (Music
*mus
)
48 if (mus
->is_mus_type ("tie-event"))
57 Tie_performer::process_music ()
60 daddy_context_
->set_property ("tieMelismaBusy", SCM_BOOL_T
);
64 Tie_performer::acknowledge_audio_element (Audio_element_info inf
)
66 if (Audio_note
* an
= dynamic_cast<Audio_note
*> (inf
.elem_
))
68 now_heads_
.push (inf
);
69 for (int i
= heads_to_tie_
.size (); i
--;)
71 Music
* right_mus
= inf
.event_
;
73 Audio_note
*th
= dynamic_cast<Audio_note
*> (heads_to_tie_
[i
].elem_
);
74 Music
* left_mus
= heads_to_tie_
[i
].event_
;
76 if (right_mus
&& left_mus
77 && ly_equal_p (right_mus
->get_property ("pitch"),
78 left_mus
->get_property ("pitch")))
88 Tie_performer::start_translation_timestep ()
90 daddy_context_
->set_property ("tieMelismaBusy",
91 ly_bool2scm (heads_to_tie_
.size ()));
96 Tie_performer::stop_translation_timestep ()
100 heads_to_tie_
.clear ();
106 heads_to_tie_
= now_heads_
;
107 last_event_
= event_
;
113 ENTER_DESCRIPTION (Tie_performer
,
114 /* descr */ "Generate ties between noteheads of equal pitch.",
116 /* accepts */ "tie-event",
118 /* reads */ "tieMelismaBusy",