]> git.donarmstrong.com Git - lilypond.git/blob - lily/time-signature-performer.cc
* configure.in: Test for and accept lmodern if EC fonts not found.
[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--2004 Jan Nieuwenhuizen <janneke@gnu.org>
7 */
8
9 #include "audio-item.hh"
10 #include "performer.hh"
11
12 class Time_signature_performer : public Performer
13 {
14 public:
15   TRANSLATOR_DECLARATIONS (Time_signature_performer);
16   ~Time_signature_performer ();
17
18 protected:
19
20   virtual void stop_translation_timestep ();
21   virtual void create_audio_elements ();
22
23   SCM prev_fraction_;
24 private:
25
26   Audio_time_signature* audio_;
27 };
28
29
30 Time_signature_performer::Time_signature_performer ()
31 {
32   prev_fraction_ = SCM_BOOL_F;
33   audio_ = 0;
34 }
35
36 Time_signature_performer::~Time_signature_performer ()
37 {
38 }
39
40
41 void
42 Time_signature_performer::create_audio_elements ()
43 {
44   SCM fr = get_property ("timeSignatureFraction");
45   if (scm_is_pair (fr) && !ly_c_equal_p (fr, prev_fraction_))
46     {
47       prev_fraction_ = fr;
48       int b = scm_to_int (scm_car (fr));
49       int o = scm_to_int (scm_cdr (fr));
50       
51       audio_ = new Audio_time_signature (b,o);
52       Audio_element_info info (audio_, 0);
53       announce_element (info);
54
55     }
56 }
57
58 void
59 Time_signature_performer::stop_translation_timestep ()
60 {
61   if (audio_)
62     {
63       play_element (audio_);
64       audio_ = 0;
65     }
66 }
67
68 ENTER_DESCRIPTION (Time_signature_performer,"","","","","","");