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;
std::vector <Vst::IConnectionPoint*> _connections;
FUID _fuid;
IPluginFactory* _factory;
Vst::IComponent* _component;

View File

@ -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 <Vst::IConnectionPoint*>::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<Vst::IConnectionPoint> componentCP (_component);
FUnknownPtr<Vst::IConnectionPoint> 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 <Vst::IConnectionPoint*>::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;
}