* python/lilylib.py (setup_temp): temporary directories are mode 700.
[lilypond.git] / lily / tempo-performer.cc
blobb963d593e86581f91aa8e0ae195f513117070f9e
1 /*
2 tempo-performer.cc -- implement Tempo_performer
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2003 Jan Nieuwenhuizen <janneke@gnu.org>
7 */
10 #include "audio-item.hh"
11 #include "performer.hh"
13 class Tempo_performer : public Performer
15 public:
16 TRANSLATOR_DECLARATIONS(Tempo_performer);
17 ~Tempo_performer ();
19 protected:
21 virtual bool try_music (Music* req);
22 virtual void stop_translation_timestep ();
23 virtual void create_audio_elements ();
25 private:
26 Music* tempo_req_;
27 Audio_tempo* audio_;
30 Tempo_performer::Tempo_performer ()
32 tempo_req_ = 0;
33 audio_ = 0;
36 Tempo_performer::~Tempo_performer ()
41 void
42 Tempo_performer::create_audio_elements ()
44 if (tempo_req_)
47 SCM met = tempo_req_->get_mus_property ("metronome-count");
48 Duration *d = unsmob_duration (tempo_req_->get_mus_property ("tempo-unit"));
50 Rational r = (d->get_length () / Moment (Rational (1, 4)) * Moment (gh_scm2int (met))).main_part_;
52 audio_ = new Audio_tempo (int (r));
54 Audio_element_info info (audio_, tempo_req_);
55 announce_element (info);
56 tempo_req_ = 0;
60 void
61 Tempo_performer::stop_translation_timestep ()
63 if (audio_)
65 play_element (audio_);
66 audio_ = 0;
70 bool
71 Tempo_performer::try_music (Music* req)
73 if (tempo_req_)
74 return false;
76 tempo_req_ = req;
77 return true;
83 ENTER_DESCRIPTION (Tempo_performer, "","",
84 "tempo-event",
85 "","","" );