2 note-performer.cc -- implement Note_performer
4 source file of the GNU LilyPond music typesetter
6 (c) 1996, 1997--1999 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 ()
24 Note_performer::do_print () const
27 if (note_req_l_arr_
.size()>0)
28 for(int i
=0;i
<note_req_l_arr_
.size();i
++)
29 note_req_l_arr_
[i
]->print ();
34 Note_performer::do_process_requests ()
36 if (note_req_l_arr_
.size ())
38 int transposing_i
= 0;
40 SCM prop
= get_property ("transposing", 0);
41 if (gh_number_p(prop
))
42 transposing_i
= gh_scm2int (prop
);
44 while (note_req_l_arr_
.size ())
46 Note_req
* n
= note_req_l_arr_
.pop ();
47 Audio_note
* p
= new Audio_note (n
->pitch_
, n
->length_mom (), transposing_i
);
48 Audio_element_info
info (p
, n
);
49 announce_element (info
);
56 Note_performer::process_acknowledged ()
61 Note_performer::global_translator_l ()
64 Global_translator
*global_l
=0;
67 t
= t
->daddy_trans_l_
;
68 global_l
= dynamic_cast<Global_translator
*> (t
);
77 Note_performer::do_pre_move_processing ()
80 // why don't grace notes show up here?
81 // --> grace notes effectively do not get delayed
82 Global_translator
* global_l
= global_translator_l ();
83 for (int i
=0; i
< note_p_arr_
.size (); i
++)
85 Audio_note
* n
= note_p_arr_
[i
];
86 if (Moment m
= n
->delayed_until_mom_
)
88 global_l
->add_moment_to_process (m
);
89 delayed_p_arr_
.push (n
);
96 Moment now
= now_mom ();
97 for (int i
=0; i
< note_p_arr_
.size (); i
++)
99 play_element (note_p_arr_
[i
]);
101 note_p_arr_
.clear ();
102 note_req_l_arr_
.clear ();
103 for (int i
=0; i
< delayed_p_arr_
.size (); i
++)
105 Audio_note
* n
= delayed_p_arr_
[i
];
106 if (n
->delayed_until_mom_
<= now
)
109 delayed_p_arr_
[i
] = 0;
110 delayed_p_arr_
.del (i
);
117 Note_performer::do_try_music (Music
* req_l
)
119 if (Note_req
*nr
= dynamic_cast <Note_req
*> (req_l
))
121 note_req_l_arr_
.push (nr
);