2 piano-pedal-performer.cc -- implement Piano_pedal_performer
4 source file of the GNU LilyPond music typesetter
6 (c) 2000 Jan Nieuwenhuizen <janneke@gnu.org>
9 #include "performer.hh"
10 #include "command-request.hh"
11 #include "musical-request.hh"
12 #include "audio-item.hh"
24 class Piano_pedal_performer : public Performer
27 VIRTUAL_COPY_CONS (Translator);
29 Piano_pedal_performer ();
32 virtual bool do_try_music (Music*);
33 virtual void do_process_music ();
34 virtual void do_pre_move_processing ();
35 virtual void do_post_move_processing ();
38 Link_array<Audio_piano_pedal> audio_p_arr_;
39 Span_req* span_start_req_l_;
40 Drul_array<Span_req*> span_req_l_drul_;
43 ADD_THIS_TRANSLATOR (Piano_pedal_performer);
45 Piano_pedal_performer::Piano_pedal_performer ()
47 span_req_l_drul_[START] = 0;
48 span_req_l_drul_[STOP] = 0;
49 span_start_req_l_ = 0;
53 Piano_pedal_performer::do_process_music ()
55 if (span_req_l_drul_[STOP])
57 if (!span_start_req_l_)
59 span_req_l_drul_[STOP]->warning (_ ("can't find start of piano_pedal"));
63 Audio_piano_pedal* p = new Audio_piano_pedal;
65 audio_p_arr_.push (p);
67 span_start_req_l_ = 0;
70 if (span_req_l_drul_[START])
72 span_start_req_l_ = span_req_l_drul_[START];
73 Audio_piano_pedal* p = new Audio_piano_pedal;
75 audio_p_arr_.push (p);
80 Piano_pedal_performer::do_pre_move_processing ()
82 for (int i=0; i < audio_p_arr_.size (); i++)
83 play_element (audio_p_arr_[i]);
84 audio_p_arr_.clear ();
88 Piano_pedal_performer::do_post_move_processing ()
90 span_req_l_drul_[STOP] = 0;
91 span_req_l_drul_[START] = 0;
95 Piano_pedal_performer::do_try_music (Music* r)
97 if (Span_req * s = dynamic_cast<Span_req*>(r))
99 if (s-> span_type_str_ == "sustain")
101 span_req_l_drul_[s->span_dir_] = s;