+bool
+Automatable::find_next_event (double start, double end, Evoral::ControlEvent& next_event, bool only_active) const
+{
+ next_event.when = std::numeric_limits<double>::max();
+
+ if (only_active) {
+ boost::shared_ptr<ControlList> cl = _automated_controls.reader ();
+ for (ControlList::const_iterator ci = cl->begin(); ci != cl->end(); ++ci) {
+ if ((*ci)->automation_playback()) {
+ find_next_ac_event (*ci, start, end, next_event);
+ }
+ }
+ } else {
+ for (Controls::const_iterator li = _controls.begin(); li != _controls.end(); ++li) {
+ boost::shared_ptr<AutomationControl> c
+ = boost::dynamic_pointer_cast<AutomationControl>(li->second);
+ if (c) {
+ find_next_ac_event (c, start, end, next_event);
+ }
+ }
+ }
+ return next_event.when != std::numeric_limits<double>::max();
+}
+
+void
+Automatable::find_next_ac_event (boost::shared_ptr<AutomationControl> c, double start, double end, Evoral::ControlEvent& next_event) const