]> git.donarmstrong.com Git - lilypond.git/blob - lily/score-performer.cc
release: 1.1.46
[lilypond.git] / lily / score-performer.cc
1 /*
2   score-performer.cc -- implement Score_performer
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 1996,  1997--1999 Jan Nieuwenhuizen <janneke@gnu.org>
7  */
8
9 #include "score-performer.hh"
10 #include "midi-def.hh"
11 #include "audio-column.hh"
12 #include "audio-item.hh"
13 #include "performance.hh"
14 #include "midi-stream.hh"
15 #include "string-convert.hh"
16 #include "debug.hh"
17 #include "score.hh"
18 #include "source-file.hh"
19 #include "source.hh"
20 #include "audio-staff.hh"
21
22
23 ADD_THIS_TRANSLATOR(Score_performer);
24
25
26 Score_performer::Score_performer()
27 {
28 }
29
30
31 Score_performer::~Score_performer()
32 {
33 }
34
35 void
36 Score_performer::play (Audio_element * p)
37 {
38   if  (Audio_item * i=dynamic_cast<Audio_item *> (p)) 
39     {
40       audio_column_l_->add_audio_item (i);
41     }
42   performance_p_->add_element (p);
43 }
44
45 void 
46 Score_performer::prepare (Moment m)
47 {
48   Global_translator::prepare (m);
49   audio_column_l_ = new Audio_column (m);
50   play (audio_column_l_);
51   post_move_processing ();
52 }
53
54
55 void 
56 Score_performer::process()
57 {
58   process_requests();
59   do_announces ();
60   pre_move_processing();
61   check_removal();
62 }
63
64 void
65 Score_performer::start()
66 {
67 }
68
69
70 int
71 Score_performer::get_tempo_i() const
72 {
73   return performance_p_->midi_l_->get_tempo_i (Moment (1, 4));
74 }
75
76 void
77 Score_performer::finish()
78 {
79   check_removal ();
80   removal_processing();
81 }
82
83 Music_output *
84 Score_performer::get_output_p ()
85 {
86   Music_output * o = performance_p_;
87   performance_p_ =0;
88   return o;
89 }
90
91 void
92 Score_performer::do_add_processing ()
93 {
94   Translator_group::do_add_processing ();
95   assert (dynamic_cast<Midi_def *> (output_def_l_));
96   performance_p_ = new Performance;
97   performance_p_->midi_l_ = dynamic_cast<Midi_def*>(output_def_l_); 
98 }