13
0

NO-OP: simplify code

find_next_ac_event, needs to find the next event *after* (but not
at) start.

std::upper_bound returns an iterator pointing to the first element
in the range [first, last) that is greater than value.
This is equivalent to using std::lower_bound an iterating until
finding the first element greater than.
This commit is contained in:
Robin Gareus 2019-11-18 15:09:43 +01:00
parent f49d11d5e3
commit 3b2b946d4e
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -661,18 +661,13 @@ Automatable::find_next_ac_event (boost::shared_ptr<AutomationControl> c, double
sc->find_next_event (start, end, next_event);
}
Evoral::ControlList::const_iterator i;
boost::shared_ptr<const Evoral::ControlList> alist (c->list());
Evoral::ControlEvent cp (start, 0.0f);
if (!alist) {
return;
}
for (i = lower_bound (alist->begin(), alist->end(), &cp, Evoral::ControlList::time_comparator); i != alist->end() && (*i)->when < end; ++i) {
if ((*i)->when > start) {
break;
}
}
Evoral::ControlList::const_iterator i = upper_bound (alist->begin(), alist->end(), &cp, Evoral::ControlList::time_comparator);
if (i != alist->end() && (*i)->when < end) {
if ((*i)->when < next_event.when) {