2 score-performer.cc -- implement Score_performer
4 source file of the GNU LilyPond music typesetter
6 (c) 1996--2005 Jan Nieuwenhuizen <janneke@gnu.org>
9 #include "score-performer.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"
17 #include "context-def.hh"
18 #include "output-def.hh"
20 ADD_TRANSLATOR (Score_performer,
28 Score_performer::Score_performer ()
33 Score_performer::~Score_performer ()
38 Score_performer::play_element (Audio_element *p)
40 if (Audio_item *i = dynamic_cast<Audio_item *> (p))
42 audio_column_->add_audio_item (i);
44 performance_->add_element (p);
48 Score_performer::announce_element (Audio_element_info info)
50 announce_infos_.push (info);
54 Score_performer::prepare (Moment m)
56 audio_column_ = new Audio_column (m);
57 play_element (audio_column_);
58 recurse_over_translators (context (), &Translator::start_translation_timestep, UP);
62 Score_performer::finish ()
64 recurse_over_translators (context (), &Translator::finalize, UP);
68 Score_performer::one_time_step ()
70 recurse_over_translators (context (), &Performer::process_music, UP);
71 recurse_over_translators (context (), &Performer::do_announces, UP);
72 recurse_over_translators (context (), &Translator::stop_translation_timestep, UP);
76 Score_performer::get_tempo () const
78 return ::get_tempo (performance_->midi_, Moment (Rational (1, 4)));
82 Score_performer::get_output ()
84 Music_output *o = performance_;
86 return o->self_scm ();
90 Score_performer::derived_mark () const
93 scm_gc_mark (performance_->self_scm ());
95 Score_translator::derived_mark ();
96 Performer_group_performer::derived_mark ();
100 Score_performer::initialize ()
102 performance_ = new Performance;
103 scm_gc_unprotect_object (performance_->self_scm ());
104 performance_->midi_ = get_output_def ();
106 Translator_group::initialize ();