]> git.donarmstrong.com Git - lilypond.git/commitdiff
Fix spurious error playing initial grace notes (issue 1412)
authorDevon Schudy <dschudy@gmail.com>
Fri, 29 Nov 2013 03:00:02 +0000 (19:00 -0800)
committerKeith OHara <k-ohara5a5a@oco.net>
Fri, 29 Nov 2013 19:44:44 +0000 (11:44 -0800)
This happens because the MIDI output starts at tick 0, regardless of
when the first event is. Initial grace notes start start at negative
ticks, so midi_walker::output_event thinks they're out of order. Fixed
by starting at the first event.

lily/midi-walker.cc

index b97630b0d147ed8ebc05d63c111b8928c3667cad..0ae5265bd370dd92aa93fb25b381fab1ad87f9cf 100644 (file)
@@ -58,7 +58,9 @@ Midi_walker::Midi_walker (Audio_staff *audio_staff, Midi_track *track)
   index_ = 0;
   items_ = audio_staff->audio_items_;
   vector_sort (items_, audio_item_less);
-  last_tick_ = 0;
+  //Pieces that begin with grace notes start at negative times. This
+  //is OK - MIDI output doesn't use absolute ticks, only differences.
+  last_tick_ = items_.empty () ? 0 : items_[0]->audio_column_->ticks ();
   percussion_ = audio_staff->percussion_;
   merge_unisons_ = audio_staff->merge_unisons_;
 }