13
0

VST3: use a dedicated connection list

This commit is contained in:
Robin Gareus 2020-09-27 20:26:21 +02:00
parent 1d6d4dc7b8
commit debcda25b4
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 19 additions and 11 deletions

View File

@ -170,6 +170,8 @@ private:
boost::shared_ptr<ARDOUR::VST3PluginModule> _module; boost::shared_ptr<ARDOUR::VST3PluginModule> _module;
std::vector <Vst::IConnectionPoint*> _connections;
FUID _fuid; FUID _fuid;
IPluginFactory* _factory; IPluginFactory* _factory;
Vst::IComponent* _component; Vst::IComponent* _component;

View File

@ -1195,13 +1195,22 @@ VST3PI::disconnect_components ()
tresult tresult
VST3PI::connect (Vst::IConnectionPoint* other) VST3PI::connect (Vst::IConnectionPoint* other)
{ {
return other ? kResultTrue : kInvalidArgument; if (!other) {
return kInvalidArgument;
}
_connections.push_back (other);
return kResultTrue;
} }
tresult tresult
VST3PI::disconnect (Vst::IConnectionPoint* other) VST3PI::disconnect (Vst::IConnectionPoint* other)
{ {
return kResultTrue; std::vector <Vst::IConnectionPoint*>::const_iterator i = std::find (_connections.begin(), _connections.end(), other);
if (i != _connections.end()) {
_connections.erase (i);
return kResultTrue;
}
return kInvalidArgument;
} }
tresult tresult
@ -1210,15 +1219,12 @@ VST3PI::notify (Vst::IMessage* msg)
#ifndef NDEBUG #ifndef NDEBUG
std::cerr << "VST3PI::notify\n"; std::cerr << "VST3PI::notify\n";
#endif #endif
FUnknownPtr<Vst::IConnectionPoint> componentCP (_component); for (std::vector <Vst::IConnectionPoint*>::const_iterator i = _connections.begin(); i != _connections.end(); ++i) {
FUnknownPtr<Vst::IConnectionPoint> controllerCP (_controller); /* TODO delegate to GUI thread if available
// XXX this bounces the message back.. * see ./libs/pbd/pbd/event_loop.h ir->call_slot ()
// we likely need a proxy here * and HostMessage()
if (componentCP) { */
componentCP->notify (msg); (*i)->notify (msg);
}
if (controllerCP) {
controllerCP->notify (msg);
} }
return kResultTrue; return kResultTrue;
} }