source file of the GNU LilyPond music typesetter
- (c) 1996--2002 Jan Nieuwenhuizen <janneke@gnu.org>
- */
+ (c) 1996--2006 Jan Nieuwenhuizen <janneke@gnu.org>
+*/
#include "score-performer.hh"
-#include "midi-def.hh"
+
#include "audio-column.hh"
#include "audio-item.hh"
#include "performance.hh"
#include "midi-stream.hh"
#include "string-convert.hh"
#include "warn.hh"
-#include "translator-def.hh"
-
-
-
-ENTER_DESCRIPTION(Score_performer,
-/* descr */ "",
-/* creats*/ "",
-/* acks */ "",
-/* reads */ "",
-/* write */ "");
+#include "context-def.hh"
+#include "output-def.hh"
+#include "context.hh"
+ADD_TRANSLATOR_GROUP (Score_performer,
+ /* doc */ "",
+ /* create */ "",
+ /* accept */ "",
+ /* read */ "",
+ /* write */ "");
Score_performer::Score_performer ()
{
performance_ = 0;
}
-
Score_performer::~Score_performer ()
{
}
void
-Score_performer::play_element (Audio_element * p)
+Score_performer::play_element (Audio_element *p)
{
- if (Audio_item * i=dynamic_cast<Audio_item *> (p))
- {
- audio_column_->add_audio_item (i);
- }
+ if (Audio_item *i = dynamic_cast<Audio_item *> (p))
+ audio_column_->add_audio_item (i);
performance_->add_element (p);
}
Score_performer::announce_element (Audio_element_info info)
{
announce_infos_.push (info);
-
-
- /*
- huh?
- copied from score-engraver, but
- this way staff gets in list twice
- if (Audio_item* i = dynamic_cast<Audio_item*> (info.elem_))
- performance_->add_element (i);
- */
}
-void
+void
Score_performer::prepare (Moment m)
{
- Global_translator::prepare (m);
audio_column_ = new Audio_column (m);
play_element (audio_column_);
- start_translation_timestep ();
+ precomputed_recurse_over_translators (context (), START_TRANSLATION_TIMESTEP, UP);
}
-
-void
-Score_performer::one_time_step ()
+void
+Score_performer::finish ()
{
- // fixme: put this back.
- // process_music ();
- do_announces ();
- stop_translation_timestep ();
- check_removal ();
+ recurse_over_translators (context (),
+ &Translator::finalize,
+ &Translator_group::finalize,
+ UP);
}
void
-Score_performer::start ()
+Score_performer::one_time_step ()
{
+ precomputed_recurse_over_translators (context (), PROCESS_MUSIC, UP);
+ do_announces ();
+ precomputed_recurse_over_translators (context (), STOP_TRANSLATION_TIMESTEP, UP);
}
-
int
Score_performer::get_tempo () const
{
- return performance_->midi_->get_tempo (Moment (Rational (1, 4)));
+ return ::get_tempo (performance_->midi_, Moment (Rational (1, 4)));
}
-void
-Score_performer::finish ()
+SCM
+Score_performer::get_output ()
{
- check_removal ();
- removal_processing ();
+ Music_output *o = performance_;
+ performance_ = 0;
+ return o->self_scm ();
}
-Music_output *
-Score_performer::get_output ()
+void
+Score_performer::derived_mark () const
{
- Music_output * o = performance_;
- performance_ =0;
- return o;
+ if (performance_)
+ scm_gc_mark (performance_->self_scm ());
+
+ Score_translator::derived_mark ();
+ Performer_group::derived_mark ();
}
void
Score_performer::initialize ()
{
- unsmob_translator_def (definition_)->apply_property_operations (this);
- assert (dynamic_cast<Midi_def *> (output_def_));
performance_ = new Performance;
- performance_->midi_ = dynamic_cast<Midi_def*> (output_def_);
+ performance_->unprotect ();
+ performance_->midi_ = context ()->get_output_def ();
Translator_group::initialize ();
}