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:
parent
f49d11d5e3
commit
3b2b946d4e
@ -661,18 +661,13 @@ Automatable::find_next_ac_event (boost::shared_ptr<AutomationControl> c, double
|
|||||||
sc->find_next_event (start, end, next_event);
|
sc->find_next_event (start, end, next_event);
|
||||||
}
|
}
|
||||||
|
|
||||||
Evoral::ControlList::const_iterator i;
|
|
||||||
boost::shared_ptr<const Evoral::ControlList> alist (c->list());
|
boost::shared_ptr<const Evoral::ControlList> alist (c->list());
|
||||||
Evoral::ControlEvent cp (start, 0.0f);
|
Evoral::ControlEvent cp (start, 0.0f);
|
||||||
if (!alist) {
|
if (!alist) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = lower_bound (alist->begin(), alist->end(), &cp, Evoral::ControlList::time_comparator); i != alist->end() && (*i)->when < end; ++i) {
|
Evoral::ControlList::const_iterator i = upper_bound (alist->begin(), alist->end(), &cp, Evoral::ControlList::time_comparator);
|
||||||
if ((*i)->when > start) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (i != alist->end() && (*i)->when < end) {
|
if (i != alist->end() && (*i)->when < end) {
|
||||||
if ((*i)->when < next_event.when) {
|
if ((*i)->when < next_event.when) {
|
||||||
|
Loading…
Reference in New Issue
Block a user