diff --git a/libs/evoral/ControlList.cc b/libs/evoral/ControlList.cc index 6ef47917b0..26ac4b3e2f 100644 --- a/libs/evoral/ControlList.cc +++ b/libs/evoral/ControlList.cc @@ -2350,4 +2350,15 @@ ControlList::dump (ostream& o) } } +bool +ControlList::has_event_at (Temporal::timepos_t const & pos) const +{ + const ControlEvent fake (pos, 0.); + EventList::const_iterator i = std::lower_bound (_events.begin(), _events.end(), &fake, time_comparator); + if ((i == _events.end()) || ((*i)->when != pos)) { + return false; + } + return true; +} + } // namespace Evoral diff --git a/libs/evoral/evoral/ControlList.h b/libs/evoral/evoral/ControlList.h index b4b38da14b..0fc55cc6a2 100644 --- a/libs/evoral/evoral/ControlList.h +++ b/libs/evoral/evoral/ControlList.h @@ -213,6 +213,8 @@ public: std::shared_ptr cut (Temporal::timepos_t const &, Temporal::timepos_t const &); std::shared_ptr copy (Temporal::timepos_t const &, Temporal::timepos_t const &); + bool has_event_at (Temporal::timepos_t const &) const; + /** Remove all events in the given time range from this list. * * @param start start of range (inclusive) in audio samples