2 tempo-performer.cc -- implement Tempo_performer
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2005 Jan Nieuwenhuizen <janneke@gnu.org>
9 #include "audio-item.hh"
10 #include "performer.hh"
12 class Tempo_performer : public Performer
15 TRANSLATOR_DECLARATIONS (Tempo_performer);
20 virtual bool try_music (Music *req);
21 virtual void stop_translation_timestep ();
22 virtual void create_audio_elements ();
29 Tempo_performer::Tempo_performer ()
35 Tempo_performer::~Tempo_performer ()
40 Tempo_performer::create_audio_elements ()
45 SCM met = tempo_req_->get_property ("metronome-count");
46 Duration *d = unsmob_duration (tempo_req_->get_property ("tempo-unit"));
48 Rational r = (d->get_length () / Moment (Rational (1, 4)) * Moment (scm_to_int (met))).main_part_;
50 audio_ = new Audio_tempo (int (r));
52 Audio_element_info info (audio_, tempo_req_);
53 announce_element (info);
59 Tempo_performer::stop_translation_timestep ()
63 play_element (audio_);
69 Tempo_performer::try_music (Music *req)
78 ADD_TRANSLATOR (Tempo_performer, "", "",
79 "metronome-change-event",