]> git.donarmstrong.com Git - lilypond.git/blob - lily/lyric-performer.cc
patch::: 1.3.96.jcn7
[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   // FIXME: won't work with fancy lyrics
25   if (lreq_arr_.size () && gh_string_p (lreq_arr_[0]->text_)
26       && ly_scm2string (lreq_arr_[0]->text_).length_i ())
27     {
28       audio_p_ = new Audio_text (Audio_text::LYRIC,
29                                  ly_scm2string (lreq_arr_[0]->text_));
30       Audio_element_info info (audio_p_, lreq_arr_[0]);
31       announce_element (info);
32     }
33   lreq_arr_.clear();
34 }
35
36 void
37 Lyric_performer::do_pre_move_processing ()
38 {
39   if (audio_p_)
40     {
41       play_element (audio_p_);
42       audio_p_ = 0;
43     }
44   lreq_arr_.clear();
45 }
46
47 bool
48 Lyric_performer::do_try_music (Music* req_l)
49 {
50   if (Lyric_req *lr = dynamic_cast <Lyric_req *> (req_l))
51     {
52       lreq_arr_.push (lr);
53       return true;
54     }
55   return false;
56 }
57