]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/score-performer.cc
release: 1.5.13
[lilypond.git] / lily / score-performer.cc
index b06e4286e2b7af7f9d9988058de3fa1e70b63f8a..ea2926c5bc45b176a162f5c4d065587201b8c85a 100644 (file)
@@ -3,7 +3,7 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c) 1996,  1997--1999 Jan Nieuwenhuizen <janneke@gnu.org>
+  (c) 1996--2001 Jan Nieuwenhuizen <janneke@gnu.org>
  */
 
 #include "score-performer.hh"
 #include "midi-stream.hh"
 #include "string-convert.hh"
 #include "debug.hh"
-#include "score.hh"
-#include "source-file.hh"
-#include "source.hh"
-#include "audio-staff.hh"
+#include "translator-def.hh"
 
 
-ADD_THIS_TRANSLATOR(Score_performer);
 
+ENTER_DESCRIPTION(Score_performer,
+/* descr */       "",
+/* creats*/       "",
+/* acks  */       "",
+/* reads */       "",
+/* write */       "");
 
-Score_performer::Score_performer()
+
+Score_performer::Score_performer ()
 {
+  performance_p_ = 0;
 }
 
 
-Score_performer::~Score_performer()
+Score_performer::~Score_performer ()
 {
 }
 
 void
-Score_performer::play (Audio_element * p)
+Score_performer::play_element (Audio_element * p)
 {
-  if  (Audio_item * i=dynamic_cast<Audio_item *> (p)) 
+  if (Audio_item * i=dynamic_cast<Audio_item *> (p)) 
     {
       audio_column_l_->add_audio_item (i);
     }
-  else if (Audio_staff*s=dynamic_cast<Audio_staff *> (p)) 
-    {
-      performance_p_->add_staff (s);
-    }
   performance_p_->add_element (p);
 }
 
+void
+Score_performer::announce_element (Audio_element_info info)
+{
+  announce_info_arr_.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_l_))
+    performance_p_->add_element (i);
+  */
+}
+
 void 
 Score_performer::prepare (Moment m)
 {
   Global_translator::prepare (m);
   audio_column_l_ = new Audio_column (m);
-  performance_p_->add_column (audio_column_l_);
-  post_move_processing ();
+  play_element (audio_column_l_);
+  start_translation_timestep ();
 }
 
 
 void 
-Score_performer::process()
+Score_performer::one_time_step ()
 {
-  process_requests();
-  pre_move_processing();
-  check_removal();
+  // fixme: put this back.
+  // process_music ();
+  announces ();
+  stop_translation_timestep ();
+  check_removal ();
 }
 
 void
-Score_performer::start()
+Score_performer::start ()
 {
 }
 
 
 int
-Score_performer::get_tempo_i() const
+Score_performer::get_tempo_i () const
 {
-  return performance_p_->midi_l_->get_tempo_i (Moment (1, 4));
+  return performance_p_->midi_l_->get_tempo_i (Moment (Rational (1, 4)));
 }
 
 void
-Score_performer::finish()
+Score_performer::finish ()
 {
   check_removal ();
-  removal_processing();
+  removal_processing ();
 }
 
 Music_output *
@@ -92,10 +109,12 @@ Score_performer::get_output_p ()
 }
 
 void
-Score_performer::do_add_processing ()
+Score_performer::initialize ()
 {
-  Translator_group::do_add_processing ();
+  unsmob_translator_def (definition_)->apply_property_operations (this);
   assert (dynamic_cast<Midi_def *> (output_def_l_));
   performance_p_ = new Performance;
-  performance_p_->midi_l_ = dynamic_cast<Midi_def*>(output_def_l_); 
+  performance_p_->midi_l_ = dynamic_cast<Midi_def*> (output_def_l_);
+
+  Translator_group::initialize ();
 }