diff --git a/libs/ardour/midi_model.cc b/libs/ardour/midi_model.cc index eb69a2a906..06beb4fa48 100644 --- a/libs/ardour/midi_model.cc +++ b/libs/ardour/midi_model.cc @@ -719,15 +719,10 @@ MidiModel::get_state() boost::shared_ptr > MidiModel::find_note (boost::shared_ptr > other) { - for (Notes::iterator x = notes().begin(); x != notes().end(); ++x) { - if (**x == *other) { - return *x; + for (Notes::iterator l = notes().lower_bound(other); (*l)->time() == other->time(); ++l) { + if (*l == other) { + return *l; } - - /* XXX optimize by using a stored iterator and break out - when passed start time. - */ } - - return boost::shared_ptr > (); + return boost::shared_ptr >(); }