]> git.donarmstrong.com Git - lilypond.git/blob - lily/tempo-performer.cc
patch::: 1.3.108.jcn3
[lilypond.git] / lily / tempo-performer.cc
1 /*
2   tempo-performer.cc -- implement Tempo_performer
3
4   source file of the GNU LilyPond music typesetter
5
6   (c)  1997--2000 Jan Nieuwenhuizen <janneke@gnu.org>
7 */
8
9 #include "tempo-performer.hh"
10 #include "command-request.hh"
11 #include "audio-item.hh"
12
13 ADD_THIS_TRANSLATOR (Tempo_performer);
14
15 Tempo_performer::Tempo_performer ()
16 {
17   tempo_req_l_ = 0;
18   audio_p_ = 0;
19 }
20
21 Tempo_performer::~Tempo_performer ()
22 {
23 }
24
25
26 void
27 Tempo_performer::deprecated_process_music ()
28 {
29   if (tempo_req_l_)
30     {
31
32       SCM met = tempo_req_l_->get_mus_property ("metronome-count");
33       audio_p_ = new Audio_tempo (tempo_req_l_->dur_.length_mom () /
34                                   Moment (1, 4) 
35                                   * Moment(gh_scm2int (met)));
36
37       Audio_element_info info (audio_p_, tempo_req_l_);
38       announce_element (info);
39       tempo_req_l_ = 0;
40     }
41 }
42
43 void
44 Tempo_performer::do_pre_move_processing ()
45 {
46   if (audio_p_)
47     {
48       play_element (audio_p_);
49       audio_p_ = 0;
50     }
51 }
52
53 bool
54 Tempo_performer::do_try_music (Music* req_l)
55 {
56   if (tempo_req_l_)
57     return false;
58
59   if (Tempo_req *t =
60       dynamic_cast <Tempo_req *> (req_l))
61     {
62       tempo_req_l_ = t;
63       return true;
64     }
65
66   return false;
67 }
68