]> git.donarmstrong.com Git - lilypond.git/blob - lily/lyric-performer.cc
release: 1.3.93
[lilypond.git] / lily / lyric-performer.cc
1 /*
2   lyric-performer.cc -- implement Lyric_performer
3
4   source file of the GNU LilyPond music typesetter
5
6   (c)  1997--2000 Jan Nieuwenhuizen <janneke@gnu.org>
7 */
8
9 #include "lyric-performer.hh"
10 #include "musical-request.hh"
11 #include "audio-item.hh"
12
13 ADD_THIS_TRANSLATOR (Lyric_performer);
14
15 Lyric_performer::Lyric_performer ()
16 {
17   audio_p_ = 0;
18 }
19
20
21 void
22 Lyric_performer::do_process_music ()
23 {
24   if (lreq_arr_.size () && lreq_arr_[0]->text_str_.length_i ())
25     {
26       audio_p_ = new Audio_text (Audio_text::LYRIC, lreq_arr_[0]->text_str_);
27       Audio_element_info info (audio_p_, lreq_arr_[0]);
28       announce_element (info);
29     }
30   lreq_arr_.clear();
31 }
32
33 void
34 Lyric_performer::do_pre_move_processing ()
35 {
36   if (audio_p_)
37     {
38       play_element (audio_p_);
39       audio_p_ = 0;
40     }
41   lreq_arr_.clear();
42 }
43
44 bool
45 Lyric_performer::do_try_music (Music* req_l)
46 {
47   if (Lyric_req *lr = dynamic_cast <Lyric_req *> (req_l))
48     {
49       lreq_arr_.push (lr);
50       return true;
51     }
52   return false;
53 }
54