- if ((*x)->_out == orig) {
- if (! (*x)->covers(right->position())) {
- fade = new Crossfade( *(*x), (*x)->_in, right);
+
+ mr->read_at (evlist, start, dur, chan_n, _note_mode, tracker);
+
+#ifndef NDEBUG
+ DEBUG_TRACE (DEBUG::MidiPlaylistIO, string_compose ("After %1 (%2 .. %3) we now have %4\n", mr->name(), mr->position(), mr->last_frame(), evlist.size()));
+ for (Evoral::EventList<framepos_t>::iterator x = evlist.begin(); x != evlist.end(); ++x) {
+ DEBUG_TRACE (DEBUG::MidiPlaylistIO, string_compose ("\t%1\n", **x));
+ }
+ DEBUG_TRACE (DEBUG::MidiPlaylistIO, string_compose ("\tAFTER: tracker says there are %1 on notes\n", tracker->on()));
+#endif
+ if (find (ended.begin(), ended.end(), *i) != ended.end()) {
+
+ /* the region ended within the read range, so
+ * resolve any dangling notes (i.e. notes whose
+ * end is beyond the end of the region).
+ */
+
+ DEBUG_TRACE (DEBUG::MidiPlaylistIO, string_compose ("\t%1 ended in this read, resolve notes and delete (%2) tracker\n",
+ mr->name(), ((new_tracker) ? "new" : "old")));
+
+ tracker->resolve_notes (evlist, (*i)->last_frame());
+ delete tracker;
+ if (!new_tracker) {
+ _note_trackers.erase (t);
+ }
+