- for (li = _controls.begin(); li != _controls.end(); ++li) {
- boost::shared_ptr<AutomationControl> c
- = boost::dynamic_pointer_cast<AutomationControl>(li->second);
-
- if (only_active && (!c || !c->automation_playback())) {
- continue;
+ 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);
+ }