From 6cec57bf0989098fce173703b894f7718bf9c10d Mon Sep 17 00:00:00 2001 From: Devon Schudy Date: Thu, 28 Nov 2013 19:00:02 -0800 Subject: [PATCH] Fix spurious error playing initial grace notes (issue 1412) 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 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lily/midi-walker.cc b/lily/midi-walker.cc index b97630b0d1..0ae5265bd3 100644 --- a/lily/midi-walker.cc +++ b/lily/midi-walker.cc @@ -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_; } -- 2.39.2