]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/midi-walker.cc
Imported Upstream version 2.19.45
[lilypond.git] / lily / midi-walker.cc
index b97630b0d147ed8ebc05d63c111b8928c3667cad..bc6c93dc56344f0a5a8b3b96078dfcdf0ac6d7c0 100644 (file)
@@ -1,7 +1,7 @@
 /*
   This file is part of LilyPond, the GNU music typesetter.
 
-  Copyright (C) 1997--2012 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_;
 }