diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2017-06-09 17:54:10 -0400 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2017-06-09 17:55:11 -0400 |
commit | d0307e10c9364882c868e2c1586e64d37996315b (patch) | |
tree | 48044c0a9c368802ada264d0351a2db19b8b6a45 | |
parent | 18db6e3f508cb124b8fb034d335a24afb4935ca3 (diff) |
set first selected stripable for control protocols before they are instantiated
-rw-r--r-- | libs/ardour/control_protocol_manager.cc | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/libs/ardour/control_protocol_manager.cc b/libs/ardour/control_protocol_manager.cc index 2f4b187fec..b510bd5aa7 100644 --- a/libs/ardour/control_protocol_manager.cc +++ b/libs/ardour/control_protocol_manager.cc @@ -32,7 +32,8 @@ #include "ardour/control_protocol_manager.h" #include "ardour/search_paths.h" - +#include "ardour/selection.h" +#include "ardour/session.h" using namespace ARDOUR; using namespace std; @@ -87,8 +88,25 @@ ControlProtocolManager::set_session (Session* s) SessionHandlePtr::set_session (s); if (_session) { + + /* get selection info and set it before instantiating any + * control protocols. + */ + + CoreSelection::StripableAutomationControls sac; + _session->selection().get_stripables (sac); + + for (CoreSelection::StripableAutomationControls::iterator i = sac.begin(); i != sac.end(); ++i) { + if ((*i).stripable) { + cerr << "First selected being set to " << (*i).stripable->name() << endl; + ControlProtocol::set_first_selected_stripable ((*i).stripable); + break; + } + } + Glib::Threads::RWLock::ReaderLock lm (protocols_lock); + for (list<ControlProtocolInfo*>::iterator i = control_protocol_info.begin(); i != control_protocol_info.end(); ++i) { if ((*i)->requested || (*i)->mandatory) { (void) activate (**i); |