]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-1.1.35
authorfred <fred>
Tue, 26 Mar 2002 21:47:55 +0000 (21:47 +0000)
committerfred <fred>
Tue, 26 Mar 2002 21:47:55 +0000 (21:47 +0000)
lily/audio-staff.cc
lily/include/audio-staff.hh
lily/include/midi-walker.hh
lily/midi-walker.cc

index ae2afceaf410ec2b417379f81d41c7324d6794d2..a8d7682ce904261934e83db0d31d4efc3a1aef08 100644 (file)
 void
 Audio_staff::add_audio_item (Audio_item* l)
 {
-  audio_item_l_list_.bottom().add (l);
+  audio_item_l_arr_.push (l);
 }
 
+
 void
 Audio_staff::output (Midi_stream& midi_stream_r, int track_i)
 {
index 2bcaf94c979b9e7bf3bfc3051607a0841cf776ac..faf0eda84180db2a9a3b5c1aa063a6ed7f4391c5 100644 (file)
@@ -8,7 +8,7 @@
 #define AUDIO_STAFF_HH
 
 #include "proto.hh"
-#include "plist.hh"
+#include "parray.hh"
 #include "lily-proto.hh"
 #include "audio-element.hh"
 
@@ -16,8 +16,7 @@ struct Audio_staff : public Audio_element {
     void add_audio_item (Audio_item*  l);
     void output (Midi_stream& midi_stream_r, int track_i);
 
-    Link_list<Audio_item*> audio_item_l_list_;
-    
+    Link_array<Audio_item> audio_item_l_arr_;
 };
 
 #endif // AUDIO_STAFF_HH
index ad2d6db6fd8e3e8a9b667523f96d287e843b616f..30ec4764201bd9b126f4a626ba1d0cf4b5e488b4 100644 (file)
@@ -17,8 +17,8 @@
 
 struct Midi_note_event : PQueue_ent<Moment, Midi_note_off*>
 {
-    bool ignore_b_;
-    Midi_note_event();
+  bool ignore_b_;
+  Midi_note_event();
 };
 
 int compare (Midi_note_event const& left, Midi_note_event const& right);
@@ -26,22 +26,26 @@ int compare (Midi_note_event const& left, Midi_note_event const& right);
 /**
   walk audio and output midi
   */
-class Midi_walker : public PCursor<Audio_item*> 
+class Midi_walker// : public PCursor<Audio_item*> 
 {
 public:
-    Midi_walker (Audio_staff* audio_staff_l, Midi_track* midi_track_l);
-    ~Midi_walker();
-
-    void process();
+  Midi_walker (Audio_staff* audio_staff_l, Midi_track* midi_track_l);
+  ~Midi_walker();
 
+  void process();
+  void operator ++(int);
+  bool ok () const;
 private:
-    void do_start_note (Midi_note* note_p);
-    void do_stop_notes (Moment now_mom);
-    void output_event (Moment now_mom, Midi_item* l);
-
-    Midi_track* track_l_;
-    PQueue<Midi_note_event> stop_note_queue;
-    Moment last_mom_;
+  void do_start_note (Midi_note* note_p);
+  void do_stop_notes (Moment now_mom);
+  void output_event (Moment now_mom, Midi_item* l);
+
+  Midi_track* track_l_;
+  Audio_staff* staff_l_;
+  int index_;
+  Link_array<Audio_item> * item_l_arr_l_;
+  PQueue<Midi_note_event> stop_note_queue;
+  Moment last_mom_;
 };
 
 
index 3eb33c4e94dd965f3e127a011664273c6ebc1160..acbde20646c9bde827d12fc86b6d5b15ed1cbd62 100644 (file)
@@ -27,9 +27,10 @@ compare (Midi_note_event const& left, Midi_note_event const& right)
 }
 
 Midi_walker::Midi_walker (Audio_staff* audio_staff_l, Midi_track* track_l)
-  : PCursor<Audio_item*>(audio_staff_l->audio_item_l_list_)
 {
   track_l_ = track_l;
+  index_= 0;
+  item_l_arr_l_ = &audio_staff_l->audio_item_l_arr_;
   last_mom_ = 0;
 }
 
@@ -45,7 +46,8 @@ Midi_walker::~Midi_walker()
 void 
 Midi_walker::do_start_note (Midi_note* note_p)
 {
-  Moment stop_mom = note_p->length_mom () + ptr ()->audio_column_l_->at_mom ();
+  Audio_item* ptr = (*item_l_arr_l_)[index_];
+  Moment stop_mom = note_p->length_mom () + ptr->audio_column_l_->at_mom ();
   for (int i=0; i < stop_note_queue.size(); i++) 
     {
       if (stop_note_queue[i].val->pitch_i() == note_p->pitch_i ()) 
@@ -65,7 +67,7 @@ Midi_walker::do_start_note (Midi_note* note_p)
   e.key = stop_mom;
   stop_note_queue.insert (e);
   
-  output_event (ptr()->audio_column_l_->at_mom (), note_p);
+  output_event (ptr->audio_column_l_->at_mom (), note_p);
 }
 
 /**
@@ -104,9 +106,10 @@ Midi_walker::output_event (Moment now_mom, Midi_item* l)
 void
 Midi_walker::process()
 {
-  do_stop_notes (ptr()->audio_column_l_->at_mom ());
+  Audio_item* ptr = (*item_l_arr_l_)[index_];
+  do_stop_notes (ptr->audio_column_l_->at_mom ());
 
-  Midi_item* p = ptr()->midi_item_p ();
+  Midi_item* p = ptr->midi_item_p ();
   if (!p)
     return;
   p->channel_i_ = track_l_->number_i_;
@@ -114,6 +117,16 @@ Midi_walker::process()
   if (Midi_note *mi = dynamic_cast<Midi_note*>(p))
     do_start_note (mi);
   else
-    output_event (ptr()->audio_column_l_->at_mom (), p);
+    output_event (ptr->audio_column_l_->at_mom (), p);
+}
+bool
+Midi_walker::ok () const
+{
+  return index_ <item_l_arr_l_->size ();
+}
+void
+Midi_walker::operator ++(int)
+{
+  assert (ok());
+  index_++;
 }
-