* lily/slur-performer.cc (Slur_performer): add inits
[lilypond.git] / lily / beam-performer.cc
blob868397641fba0906c1576f070fd94971ce647a9f
1 /*
2 beam-performer.cc -- implement Beam_performer
4 source file of the GNU LilyPond music typesetter
6 (c) 1996--2004 Jan Nieuwenhuizen <janneke@gnu.org>
7 */
9 #include "performer.hh"
10 #include "event.hh"
11 #include "audio-item.hh"
12 #include "audio-column.hh"
13 #include "global-context.hh"
14 #include "warn.hh"
16 class Beam_performer : public Performer {
17 public:
18 TRANSLATOR_DECLARATIONS (Beam_performer);
20 protected:
21 virtual bool try_music (Music *ev) ;
22 virtual void start_translation_timestep ();
23 virtual void process_music ();
24 void set_melisma (bool);
25 private:
26 Music *start_ev_;
27 Music *now_stop_ev_;
28 bool beam_;
31 Beam_performer::Beam_performer ()
33 beam_ = false;
34 start_ev_ = 0;
35 now_stop_ev_ = 0;
38 void
39 Beam_performer::process_music ()
41 if (now_stop_ev_)
43 beam_ = false;
44 set_melisma (false);
47 if (start_ev_)
49 beam_ = true;
50 set_melisma (true);
55 void
56 Beam_performer::set_melisma (bool ml)
58 SCM b = get_property ("autoBeaming");
59 if (!to_boolean (b))
60 daddy_context_->set_property ("beamMelismaBusy", ml ? SCM_BOOL_T :SCM_BOOL_F);
63 void
64 Beam_performer::start_translation_timestep ()
66 start_ev_ = 0;
67 now_stop_ev_ = 0;
70 bool
71 Beam_performer::try_music (Music *m)
73 if (m->is_mus_type ("beam-event"))
75 Direction d = to_dir (m->get_property ("span-direction"));
77 if (d == START)
79 start_ev_ = m;
81 else if (d==STOP)
83 now_stop_ev_ = m;
85 return true;
87 return false;
90 ENTER_DESCRIPTION (Beam_performer,"","",
91 "beam-event","","","");