2 note-performer.cc -- implement Note_performer
4 source file of the GNU LilyPond music typesetter
6 (c) 1996--2000 Jan Nieuwenhuizen <janneke@gnu.org>
9 #include "note-performer.hh"
10 #include "musical-request.hh"
11 #include "audio-item.hh"
12 #include "audio-column.hh"
13 #include "global-translator.hh"
17 ADD_THIS_TRANSLATOR (Note_performer);
19 Note_performer::Note_performer ()
26 Note_performer::do_process_music ()
28 if (note_req_l_arr_.size ())
30 int transposing_i = 0;
32 SCM prop = get_property ("transposing");
33 if (gh_number_p(prop))
34 transposing_i = gh_scm2int (prop);
36 while (note_req_l_arr_.size ())
38 Note_req* n = note_req_l_arr_.pop ();
39 Audio_note* p = new Audio_note (n->pitch_, n->length_mom (), transposing_i);
40 Audio_element_info info (p, n);
41 announce_element (info);
48 Note_performer::process_acknowledged ()
53 Note_performer::global_translator_l ()
56 Global_translator *global_l =0;
59 t = t->daddy_trans_l_ ;
60 global_l = dynamic_cast<Global_translator*> (t);
69 Note_performer::do_pre_move_processing ()
72 // why don't grace notes show up here?
73 // --> grace notes effectively do not get delayed
74 Global_translator* global_l = global_translator_l ();
75 for (int i=0; i < note_p_arr_.size (); i++)
77 Audio_note* n = note_p_arr_[i];
78 if (Moment m= n->delayed_until_mom_)
80 global_l->add_moment_to_process (m);
81 delayed_p_arr_.push (n);
88 Moment now = now_mom ();
89 for (int i=0; i < note_p_arr_.size (); i++)
91 play_element (note_p_arr_[i]);
94 note_req_l_arr_.clear ();
95 for (int i=0; i < delayed_p_arr_.size (); i++)
97 Audio_note* n = delayed_p_arr_[i];
98 if (n->delayed_until_mom_ <= now)
101 delayed_p_arr_[i] = 0;
102 delayed_p_arr_.del (i);
109 Note_performer::do_try_music (Music* req_l)
111 if (Note_req *nr = dynamic_cast <Note_req *> (req_l))
113 note_req_l_arr_.push (nr);