]> git.donarmstrong.com Git - lilypond.git/blobdiff - mi2mu/midi-track-parser.cc
release: 1.1.39
[lilypond.git] / mi2mu / midi-track-parser.cc
index 2b34868c47df1a215f11bb8c9be99380e0ac7ee0..ff7d4453d49f55fd9cab08c386c9b33a53c6973f 100644 (file)
@@ -53,17 +53,19 @@ Midi_track_parser::note_end (Mudela_column* col_l, int channel_i, int pitch_i, i
 
   assert (col_l);
 
-  for (Cons<Mudela_note>** pp = &open_note_l_list_.head_cons_p_; *pp;)
+  for (PCursor<Mudela_note*> i (open_note_l_list_.top ()); i.ok (); )
     {
-      Cons<Mudela_note>* i = *pp;
-      if ((i->car_p_->pitch_i_ == pitch_i) && (i->car_p_->channel_i_ == channel_i))
+      if ((i->pitch_i_ == pitch_i) && (i->channel_i_ == channel_i))
        {
-         i->car_p_->end_column_l_ = col_l;
-         delete open_note_l_list_.remove_cons_p (pp);
+         i->end_column_l_ = col_l;
+         // LOGOUT(DEBUG_ver) << "Note: " << pitch_i;
+         // LOGOUT(DEBUG_ver) << "; " << i->mudela_column_l_->at_mom_;
+         // LOGOUT(DEBUG_ver) << ", " << i->end_column_l_->at_mom_ << '\n';
+         i.remove_p();
          return;
        }
       else
-       pp = &i->next_cons_p_;
+       i++;
     }
   warning (_f ("junking note-end event: channel = %d, pitch = %d", 
               channel_i, pitch_i));
@@ -74,11 +76,11 @@ Midi_track_parser::note_end_all (Mudela_column* col_l)
 {
   // find
   assert (col_l);
-  for (Cons<Mudela_note>* i = open_note_l_list_.head_cons_p_; i; i = i->next_cons_p_)
+  for (PCursor<Mudela_note*> i (open_note_l_list_.top ()); i.ok (); )
     {
-      i->car_p_->end_column_l_ = col_l;
+      i->end_column_l_ = col_l;
+      i.remove_p ();
     }
-  open_note_l_list_.init ();
 }
 
 Mudela_staff*
@@ -167,14 +169,13 @@ Midi_track_parser::parse_event (Mudela_column* col_l)
        {
          Mudela_note* p = new Mudela_note (col_l, channel_i, pitch_i, dyn_i);
          item_p = p;
-         open_note_l_list_.append (new Cons<Mudela_note> (p, 0));
+         open_note_l_list_.bottom ().add (p);
        }
       else
        {
          note_end (col_l, channel_i, pitch_i, dyn_i);
        }
     }
-    
   // POLYPHONIC_AFTERTOUCH     [\xa0-\xaf]
   else if ((byte >= 0xa0) && (byte <= 0xaf))
     {