]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/midi-walker.cc
Issue 5167/6: Changes: show \markup xxx = ... \etc assignments
[lilypond.git] / lily / midi-walker.cc
index f287f2a7883f00a7aadf4cf94c6cfdee2561f655..d9765c681450931fe85acca5c81213a90a153001 100644 (file)
@@ -1,7 +1,7 @@
 /*
   This file is part of LilyPond, the GNU music typesetter.
 
-  Copyright (C) 1997--2011 Han-Wen Nienhuys <hanwen@xs4all.nl>
+  Copyright (C) 1997--2015 Han-Wen Nienhuys <hanwen@xs4all.nl>
   Jan Nieuwenhuizen <janneke@gnu.org>
 
   LilyPond is free software: you can redistribute it and/or modify
@@ -52,13 +52,15 @@ audio_item_less (Audio_item *const a,
   return a->get_column ()->when_ < b->get_column ()->when_;
 }
 
-Midi_walker::Midi_walker (Audio_staff *audio_staff, Midi_track *track)
+Midi_walker::Midi_walker (Audio_staff *audio_staff, Midi_track *track, int start_tick)
 {
   track_ = track;
   index_ = 0;
   items_ = audio_staff->audio_items_;
   vector_sort (items_, audio_item_less);
-  last_tick_ = 0;
+  //Scores that begin with grace notes start at negative times. This
+  //is OK - MIDI output doesn't use absolute ticks, only differences.
+  last_tick_ = start_tick;
   percussion_ = audio_staff->percussion_;
   merge_unisons_ = audio_staff->merge_unisons_;
 }
@@ -87,8 +89,9 @@ Midi_walker::do_start_note (Midi_note *note)
                         Real (384 * 4)) + now_ticks;
   for (vsize i = 0; i < stop_note_queue.size (); i++)
     {
-      /* if this pitch already in queue */
-      if (stop_note_queue[i].val->get_semitone_pitch ()
+      /* if this pitch already in queue, and is not already ignored */
+      if (!stop_note_queue[i].ignore_ &&
+          stop_note_queue[i].val->get_semitone_pitch ()
           == note->get_semitone_pitch ())
         {
           int queued_ticks
@@ -178,7 +181,8 @@ void
 Midi_walker::process ()
 {
   Audio_item *audio = items_[index_];
-  do_stop_notes (audio->audio_column_->ticks ());
+  Audio_column *col = audio->get_column ();
+  do_stop_notes (col->ticks ());
 
   if (Midi_item *midi = get_midi (audio))
     {