]> git.donarmstrong.com Git - lilypond.git/blob - lily/time-signature-performer.cc
patch::: 1.3.108.jcn3
[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 "audio-item.hh"
10 #include "lily-proto.hh"
11 #include "performer.hh"
12
13
14 class Time_signature_performer : public Performer
15 {
16 public:
17   VIRTUAL_COPY_CONS(Translator);
18   
19   Time_signature_performer();
20   ~Time_signature_performer();
21
22 protected:
23
24   void deprecated_process_music();
25   virtual void do_pre_move_processing ();
26
27   SCM prev_fraction_;
28 private:
29   Time_signature_change_req* time_signature_req_l_;
30   Audio_time_signature* audio_p_;
31 };
32
33
34 Time_signature_performer::Time_signature_performer ()
35 {
36   prev_fraction_ = SCM_BOOL_F;
37   audio_p_ = 0;
38 }
39
40 Time_signature_performer::~Time_signature_performer ()
41 {
42 }
43
44
45 void
46 Time_signature_performer::deprecated_process_music ()
47 {
48   SCM fr = get_property ("timeSignatureFraction");
49   if (gh_pair_p (fr)
50       && scm_equal_p (fr, prev_fraction_) != SCM_BOOL_T)
51     {
52       int b = gh_scm2int (gh_car (fr));
53       int o = gh_scm2int (gh_cdr (fr));
54       
55       audio_p_ = new Audio_time_signature (b,o);
56       Audio_element_info info (audio_p_, 0);
57       announce_element (info);
58       time_signature_req_l_ = 0;
59     }
60 }
61
62 void
63 Time_signature_performer::do_pre_move_processing ()
64 {
65   if (audio_p_)
66     {
67       play_element (audio_p_);
68       audio_p_ = 0;
69     }
70 }
71 ADD_THIS_TRANSLATOR (Time_signature_performer);
72