]> git.donarmstrong.com Git - lilypond.git/blob - lily/lyric-performer.cc
e07fe0f4fe1df5dfd3495d024f494861ff69da71
[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 void 
21 Lyric_performer::do_print () const
22 {
23 #ifndef NPRINT
24   if (lreq_arr_.size ())
25     lreq_arr_[0]->print ();
26 #endif
27 }
28
29 void
30 Lyric_performer::do_process_music ()
31 {
32   if (lreq_arr_.size () && lreq_arr_[0]->text_str_.length_i ())
33     {
34       audio_p_ = new Audio_text (Audio_text::LYRIC, lreq_arr_[0]->text_str_);
35       Audio_element_info info (audio_p_, lreq_arr_[0]);
36       announce_element (info);
37     }
38   lreq_arr_.clear();
39 }
40
41 void
42 Lyric_performer::do_pre_move_processing ()
43 {
44   if (audio_p_)
45     {
46       play_element (audio_p_);
47       audio_p_ = 0;
48     }
49   lreq_arr_.clear();
50 }
51
52 bool
53 Lyric_performer::do_try_music (Music* req_l)
54 {
55   if (Lyric_req *lr = dynamic_cast <Lyric_req *> (req_l))
56     {
57       lreq_arr_.push (lr);
58       return true;
59     }
60   return false;
61 }
62