From debcda25b40671b3476fbf22e58acec94d65486b Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sun, 27 Sep 2020 20:26:21 +0200 Subject: [PATCH] VST3: use a dedicated connection list --- libs/ardour/ardour/vst3_plugin.h | 2 ++ libs/ardour/vst3_plugin.cc | 28 +++++++++++++++++----------- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/libs/ardour/ardour/vst3_plugin.h b/libs/ardour/ardour/vst3_plugin.h index 2e09998ab0..78ee60f1c3 100644 --- a/libs/ardour/ardour/vst3_plugin.h +++ b/libs/ardour/ardour/vst3_plugin.h @@ -170,6 +170,8 @@ private: boost::shared_ptr _module; + std::vector _connections; + FUID _fuid; IPluginFactory* _factory; Vst::IComponent* _component; diff --git a/libs/ardour/vst3_plugin.cc b/libs/ardour/vst3_plugin.cc index 3f3ccf4dd6..93f53dbe00 100644 --- a/libs/ardour/vst3_plugin.cc +++ b/libs/ardour/vst3_plugin.cc @@ -1195,13 +1195,22 @@ VST3PI::disconnect_components () tresult VST3PI::connect (Vst::IConnectionPoint* other) { - return other ? kResultTrue : kInvalidArgument; + if (!other) { + return kInvalidArgument; + } + _connections.push_back (other); + return kResultTrue; } tresult VST3PI::disconnect (Vst::IConnectionPoint* other) { - return kResultTrue; + std::vector ::const_iterator i = std::find (_connections.begin(), _connections.end(), other); + if (i != _connections.end()) { + _connections.erase (i); + return kResultTrue; + } + return kInvalidArgument; } tresult @@ -1210,15 +1219,12 @@ VST3PI::notify (Vst::IMessage* msg) #ifndef NDEBUG std::cerr << "VST3PI::notify\n"; #endif - FUnknownPtr componentCP (_component); - FUnknownPtr controllerCP (_controller); - // XXX this bounces the message back.. - // we likely need a proxy here - if (componentCP) { - componentCP->notify (msg); - } - if (controllerCP) { - controllerCP->notify (msg); + for (std::vector ::const_iterator i = _connections.begin(); i != _connections.end(); ++i) { + /* TODO delegate to GUI thread if available + * see ./libs/pbd/pbd/event_loop.h ir->call_slot () + * and HostMessage() + */ + (*i)->notify (msg); } return kResultTrue; }