From: fred Date: Tue, 26 Mar 2002 21:47:55 +0000 (+0000) Subject: lilypond-1.1.35 X-Git-Tag: release/1.5.59~2544 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=029cf73977d5646c90d94b291d06b93e8814eef6;p=lilypond.git lilypond-1.1.35 --- diff --git a/lily/audio-staff.cc b/lily/audio-staff.cc index ae2afceaf4..a8d7682ce9 100644 --- a/lily/audio-staff.cc +++ b/lily/audio-staff.cc @@ -15,9 +15,10 @@ 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) { diff --git a/lily/include/audio-staff.hh b/lily/include/audio-staff.hh index 2bcaf94c97..faf0eda841 100644 --- a/lily/include/audio-staff.hh +++ b/lily/include/audio-staff.hh @@ -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_l_list_; - + Link_array audio_item_l_arr_; }; #endif // AUDIO_STAFF_HH diff --git a/lily/include/midi-walker.hh b/lily/include/midi-walker.hh index ad2d6db6fd..30ec476420 100644 --- a/lily/include/midi-walker.hh +++ b/lily/include/midi-walker.hh @@ -17,8 +17,8 @@ struct Midi_note_event : PQueue_ent { - 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 +class Midi_walker// : public PCursor { 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 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 * item_l_arr_l_; + PQueue stop_note_queue; + Moment last_mom_; }; diff --git a/lily/midi-walker.cc b/lily/midi-walker.cc index 3eb33c4e94..acbde20646 100644 --- a/lily/midi-walker.cc +++ b/lily/midi-walker.cc @@ -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_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(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_ size (); +} +void +Midi_walker::operator ++(int) +{ + assert (ok()); + index_++; } -