13
0

Use logarithmic search for MidiModel::find_note (used by DiffCommand).

git-svn-id: svn://localhost/ardour2/branches/3.0@5800 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
David Robillard 2009-10-19 15:44:58 +00:00
parent a2c434d5cd
commit 5c1dccaca5

View File

@ -719,15 +719,10 @@ MidiModel::get_state()
boost::shared_ptr<Evoral::Note<MidiModel::TimeType> > boost::shared_ptr<Evoral::Note<MidiModel::TimeType> >
MidiModel::find_note (boost::shared_ptr<Evoral::Note<TimeType> > other) MidiModel::find_note (boost::shared_ptr<Evoral::Note<TimeType> > other)
{ {
for (Notes::iterator x = notes().begin(); x != notes().end(); ++x) { for (Notes::iterator l = notes().lower_bound(other); (*l)->time() == other->time(); ++l) {
if (**x == *other) { if (*l == other) {
return *x; return *l;
} }
/* XXX optimize by using a stored iterator and break out
when passed start time.
*/
} }
return boost::shared_ptr<Evoral::Note<TimeType> >();
return boost::shared_ptr<Evoral::Note<TimeType> > ();
} }