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 "performer.hh"
11 #include "audio-item.hh"
13 #include "duration.hh"
15 class Tempo_performer : public Performer
18 TRANSLATOR_DECLARATIONS (Tempo_performer);
23 virtual bool try_music (Music *event);
24 void stop_translation_timestep ();
25 void process_music ();
32 Tempo_performer::Tempo_performer ()
38 Tempo_performer::~Tempo_performer ()
43 Tempo_performer::process_music ()
47 SCM met = tempo_event_->get_property ("metronome-count");
48 Duration *d = unsmob_duration (tempo_event_->get_property ("tempo-unit"));
50 Rational r = (d->get_length () / Moment (Rational (1, 4)) * Moment (scm_to_int (met))).main_part_;
52 audio_ = new Audio_tempo (r.to_int ());
54 Audio_element_info info (audio_, tempo_event_);
55 announce_element (info);
61 Tempo_performer::stop_translation_timestep ()
65 play_element (audio_);
71 Tempo_performer::try_music (Music *event)
80 #include "translator.icc"
82 ADD_TRANSLATOR (Tempo_performer, "", "",
83 "metronome-change-event",