]> git.donarmstrong.com Git - lilypond.git/blob - lily/score-performer.cc
patch::: 1.3.136.jcn3
[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--2001 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::one_time_step ()
69 {
70   // fixme: put this back.
71   // process_music ();
72   announces ();
73   pre_move_processing ();
74   check_removal ();
75 }
76
77 void
78 Score_performer::start ()
79 {
80 }
81
82
83 int
84 Score_performer::get_tempo_i () const
85 {
86   return performance_p_->midi_l_->get_tempo_i (Moment (1, 4));
87 }
88
89 void
90 Score_performer::finish ()
91 {
92   check_removal ();
93   removal_processing ();
94 }
95
96 Music_output *
97 Score_performer::get_output_p ()
98 {
99   Music_output * o = performance_p_;
100   performance_p_ =0;
101   return o;
102 }
103
104 void
105 Score_performer::initialize ()
106 {
107   unsmob_translator_def (definition_)->apply_property_operations (this);
108   assert (dynamic_cast<Midi_def *> (output_def_l_));
109   performance_p_ = new Performance;
110   performance_p_->midi_l_ = dynamic_cast<Midi_def*> (output_def_l_);
111
112   Translator_group::initialize ();
113 }