]> git.donarmstrong.com Git - lilypond.git/blob - lily/score-performer.cc
release: 1.3.110
[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--2000 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 "translator-def.hh"
18
19 ADD_THIS_TRANSLATOR (Score_performer);
20
21
22 Score_performer::Score_performer ()
23 {
24   performance_p_ = 0;
25 }
26
27
28 Score_performer::~Score_performer ()
29 {
30 }
31
32 void
33 Score_performer::play_element (Audio_element * p)
34 {
35   if  (Audio_item * i=dynamic_cast<Audio_item *> (p)) 
36     {
37       audio_column_l_->add_audio_item (i);
38     }
39   performance_p_->add_element (p);
40 }
41
42 void
43 Score_performer::announce_element (Audio_element_info info)
44 {
45   announce_info_arr_.push (info);
46
47
48   /*
49     huh?
50     copied from score-engraver, but
51     this way staff gets in list twice
52   if (Audio_item* i = dynamic_cast<Audio_item*> (info.elem_l_))
53     performance_p_->add_element (i);
54   */
55 }
56
57 void 
58 Score_performer::prepare (Moment m)
59 {
60   Global_translator::prepare (m);
61   audio_column_l_ = new Audio_column (m);
62   play_element (audio_column_l_);
63   post_move_processing ();
64 }
65
66
67 void 
68 Score_performer::process()
69 {
70   //process_music();
71   announces ();
72   pre_move_processing();
73   check_removal();
74 }
75
76 void
77 Score_performer::start()
78 {
79 }
80
81
82 int
83 Score_performer::get_tempo_i() const
84 {
85   return performance_p_->midi_l_->get_tempo_i (Moment (1, 4));
86 }
87
88 void
89 Score_performer::finish()
90 {
91   check_removal ();
92   removal_processing();
93 }
94
95 Music_output *
96 Score_performer::get_output_p ()
97 {
98   Music_output * o = performance_p_;
99   performance_p_ =0;
100   return o;
101 }
102
103 void
104 Score_performer::initialize ()
105 {
106   unsmob_translator_def (definition_)->apply_property_operations (this);
107   assert (dynamic_cast<Midi_def *> (output_def_l_));
108   performance_p_ = new Performance;
109   performance_p_->midi_l_ = dynamic_cast<Midi_def*>(output_def_l_);
110
111   Translator_group::initialize ();
112 }