]> git.donarmstrong.com Git - lilypond.git/blob - lily/time-signature-performer.cc
Docs: Fix fixed IR compilation (copy @q and @qq from macros.itely)
[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--2007 Jan Nieuwenhuizen <janneke@gnu.org>
7 */
8
9 #include "audio-item.hh"
10 #include "performer.hh"
11 #include "protected-scm.hh"
12
13 class Time_signature_performer : public Performer
14 {
15 public:
16   TRANSLATOR_DECLARATIONS (Time_signature_performer);
17   ~Time_signature_performer ();
18
19 protected:
20
21   void stop_translation_timestep ();
22   void process_music ();
23   virtual void derived_mark () const;
24   SCM prev_fraction_;
25 private:
26
27   Audio_time_signature *audio_;
28 };
29
30 void
31 Time_signature_performer::derived_mark () const
32 {
33   scm_gc_mark (prev_fraction_);
34 }
35
36 Time_signature_performer::Time_signature_performer ()
37 {
38   prev_fraction_ = SCM_BOOL_F;
39   audio_ = 0;
40 }
41
42 Time_signature_performer::~Time_signature_performer ()
43 {
44 }
45
46 void
47 Time_signature_performer::process_music ()
48 {
49   SCM fr = get_property ("timeSignatureFraction");
50   if (scm_is_pair (fr) && !ly_is_equal (fr, prev_fraction_))
51     {
52       prev_fraction_ = fr;
53       int b = scm_to_int (scm_car (fr));
54       int o = scm_to_int (scm_cdr (fr));
55
56       audio_ = new Audio_time_signature (b, o);
57       Audio_element_info info (audio_, 0);
58       announce_element (info);
59     }
60 }
61
62 void
63 Time_signature_performer::stop_translation_timestep ()
64 {
65   if (audio_)
66     {
67       audio_ = 0;
68     }
69 }
70
71 #include "translator.icc"
72
73 ADD_TRANSLATOR (Time_signature_performer,
74                 /* doc */
75                 "",
76
77                 /* create */
78                 "",
79
80                 /* read */
81                 "",
82
83                 /* write */
84                 ""
85                 );