diff --git a/libs/ardour/ardour/vst3_plugin.h b/libs/ardour/ardour/vst3_plugin.h index 584cd23ae4..9fd87f250d 100644 --- a/libs/ardour/ardour/vst3_plugin.h +++ b/libs/ardour/ardour/vst3_plugin.h @@ -214,10 +214,6 @@ private: void foward_signal (Presonus::IContextInfoHandler2*, FIDString) const; - PBD::ScopedConnectionList _strip_connections; - PBD::ScopedConnectionList _ac_connection_list; - std::set _ac_subscriptions; - boost::shared_ptr _module; std::vector _connections; @@ -270,9 +266,14 @@ private: std::vector _enabled_audio_in; std::vector _enabled_audio_out; - boost::optional _plugin_latency; + /* PSL extensions, control protocol */ + ARDOUR::SessionObject* _owner; + PBD::ScopedConnectionList _strip_connections; + PBD::ScopedConnectionList _ac_connection_list; + std::set _ac_subscriptions; + bool _add_to_selection; - ARDOUR::SessionObject* _owner; + boost::optional _plugin_latency; int _n_inputs; int _n_outputs; diff --git a/libs/ardour/vst3_plugin.cc b/libs/ardour/vst3_plugin.cc index 7afc3de7e3..ecacf609e6 100644 --- a/libs/ardour/vst3_plugin.cc +++ b/libs/ardour/vst3_plugin.cc @@ -43,6 +43,8 @@ #include "ardour/vst3_module.h" #include "ardour/vst3_plugin.h" +#include "control_protocol/control_protocol.h" + #include "pbd/i18n.h" using namespace PBD; @@ -974,6 +976,7 @@ VST3PI::VST3PI (boost::shared_ptr m, std::string uniqu , _block_size (0) , _port_id_bypass (UINT32_MAX) , _owner (0) + , _add_to_selection (false) , _n_factory_presets (0) { using namespace std; @@ -2520,8 +2523,8 @@ VST3PI::getContextInfoValue (int32& value, FIDString id) } else if (0 == strcmp (id, ContextInfo::kSelected)) { value = s->is_selected () ? 1 : 0; } else if (0 == strcmp (id, ContextInfo::kFocused)) { - value = s->is_selected () ? 1 : 0; // XXX - //consider ControlProtocol::first_selected_stripable () == s; + boost::shared_ptr stripable = ControlProtocol::first_selected_stripable (); + value = stripable && stripable.get () == s ? 1 : 0; } else if (0 == strcmp (id, ContextInfo::kSendCount)) { value = 0; while (s->send_enable_controllable (value)) { @@ -2675,10 +2678,17 @@ VST3PI::setContextInfoValue (FIDString id, int32 value) #endif s->presentation_info ().set_color(value); } else if (0 == strcmp (id, ContextInfo::kSelected)) { - DEBUG_TRACE (DEBUG::VST3Callbacks, string_compose ("VST3PI::setContextInfoValue: NOT IMPLEMENTED (%1)\n", id)); - return kNotImplemented; + boost::shared_ptr stripable = s->session().stripable_by_id (s->id ()); + assert (stripable); + if (value == 0) { + ControlProtocol::RemoveStripableFromSelection (stripable); + } else if (_add_to_selection) { + ControlProtocol::AddStripableToSelection (stripable); + } else { + ControlProtocol::SetStripableSelection (stripable); + } } else if (0 == strcmp (id, ContextInfo::kMultiSelect)) { - //_add_to_selection = value != 0; + _add_to_selection = value != 0; } else if (0 == strcmp (id, ContextInfo::kMute)) { boost::shared_ptr ac = lookup_ac (_owner, id); if (ac) {