2 tempo-performer.cc -- implement Tempo_performer
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2002 Jan Nieuwenhuizen <janneke@gnu.org>
9 #include "command-request.hh"
10 #include "audio-item.hh"
11 #include "performer.hh"
13 class Tempo_performer : public Performer
16 TRANSLATOR_DECLARATIONS(Tempo_performer);
21 virtual bool try_music (Music* req_l);
22 virtual void stop_translation_timestep ();
23 virtual void create_audio_elements ();
26 Tempo_req* tempo_req_l_;
27 Audio_tempo* audio_p_;
30 ENTER_DESCRIPTION (Tempo_performer, "","","","","" );
33 Tempo_performer::Tempo_performer ()
39 Tempo_performer::~Tempo_performer ()
45 Tempo_performer::create_audio_elements ()
50 SCM met = tempo_req_l_->get_mus_property ("metronome-count");
51 Duration *d = unsmob_duration (tempo_req_l_->get_mus_property ("duration"));
53 Rational r = (d->length_mom () / Moment (Rational (1, 4)) * Moment (gh_scm2int (met))).main_part_;
55 audio_p_ = new Audio_tempo (int (r));
57 Audio_element_info info (audio_p_, tempo_req_l_);
58 announce_element (info);
64 Tempo_performer::stop_translation_timestep ()
68 play_element (audio_p_);
74 Tempo_performer::try_music (Music* req_l)
80 dynamic_cast <Tempo_req *> (req_l))