lilypond-1.3.118
[lilypond.git] / lily / time-signature-performer.cc
blob0f65b322b4b56f02d2375555a337e2d0d1b94975
1 /*
2 time-signature-performer.cc -- implement Time_signature_performer
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2000 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:
29 Time_signature_change_req* time_signature_req_l_;
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)
50 && scm_equal_p (fr, prev_fraction_) != SCM_BOOL_T)
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);
58 time_signature_req_l_ = 0;
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);