lilypond-1.3.154
[lilypond.git] / lily / time-signature-performer.cc
bloba8ce824d564cfdb14fc7045d5c63b6dbd8bf40bf
1 /*
2 time-signature-performer.cc -- implement Time_signature_performer
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2001 Jan Nieuwenhuizen <janneke@gnu.org>
7 */
9 #include "audio-item.hh"
10 #include "lily-proto.hh"
11 #include "performer.hh"
14 class Time_signature_performer : public Performer
16 public:
17 VIRTUAL_COPY_CONS (Translator);
19 Time_signature_performer ();
20 ~Time_signature_performer ();
22 protected:
24 virtual void stop_translation_timestep ();
25 virtual void create_audio_elements ();
27 SCM prev_fraction_;
28 private:
30 Audio_time_signature* audio_p_;
34 Time_signature_performer::Time_signature_performer ()
36 prev_fraction_ = SCM_BOOL_F;
37 audio_p_ = 0;
40 Time_signature_performer::~Time_signature_performer ()
45 void
46 Time_signature_performer::create_audio_elements ()
48 SCM fr = get_property ("timeSignatureFraction");
49 if (gh_pair_p (fr) && !gh_equal_p (fr, prev_fraction_))
51 prev_fraction_ = fr;
52 int b = gh_scm2int (gh_car (fr));
53 int o = gh_scm2int (gh_cdr (fr));
55 audio_p_ = new Audio_time_signature (b,o);
56 Audio_element_info info (audio_p_, 0);
57 announce_element (info);
62 void
63 Time_signature_performer::stop_translation_timestep ()
65 if (audio_p_)
67 play_element (audio_p_);
68 audio_p_ = 0;
71 ADD_THIS_TRANSLATOR (Time_signature_performer);