]> git.donarmstrong.com Git - lilypond.git/blob - lily/time-signature-performer.cc
release: 1.3.105
[lilypond.git] / lily / time-signature-performer.cc
1 /*
2   time-signature-performer.cc -- implement Time_signature_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 "time-signature-performer.hh"
10 #include "command-request.hh"
11 #include "audio-item.hh"
12
13 ADD_THIS_TRANSLATOR (Time_signature_performer);
14
15 Time_signature_performer::Time_signature_performer ()
16 {
17   time_signature_req_l_ = 0;
18   audio_p_ = 0;
19 }
20
21 Time_signature_performer::~Time_signature_performer ()
22 {
23 }
24
25
26 void
27 Time_signature_performer::do_process_music ()
28 {
29   if (time_signature_req_l_)
30     {
31       int b = gh_scm2int (time_signature_req_l_->get_mus_property ("beats"));
32       int o = gh_scm2int (time_signature_req_l_->get_mus_property ("one-beat"));      
33       
34       audio_p_ = new Audio_time_signature (b,o);
35       Audio_element_info info (audio_p_, time_signature_req_l_);
36       announce_element (info);
37       time_signature_req_l_ = 0;
38     }
39 }
40
41 void
42 Time_signature_performer::do_pre_move_processing ()
43 {
44   if (audio_p_)
45     {
46       play_element (audio_p_);
47       audio_p_ = 0;
48     }
49 }
50
51 bool
52 Time_signature_performer::do_try_music (Music* req_l)
53 {
54   if (time_signature_req_l_)
55     return false;
56
57   if (Time_signature_change_req *t =
58       dynamic_cast <Time_signature_change_req *> (req_l))
59     {
60       time_signature_req_l_ = t;
61       return true;
62     }
63
64   return false;
65 }
66