diff --git a/src/common/serialization/vst3/host-context-proxy.h b/src/common/serialization/vst3/host-context-proxy.h index e2afe641..0aab8530 100644 --- a/src/common/serialization/vst3/host-context-proxy.h +++ b/src/common/serialization/vst3/host-context-proxy.h @@ -97,6 +97,15 @@ class Vst3HostContextProxy : public YaHostApplication { return arguments.owner_instance_id; } + /** + * Used to shortcut calls to + * `IHostApplication::createInstance(IMessage::iid, IMessage::iid, &obj)` + * when two objects (a processor and a controller instance, for example) are + * directly connected. This way we don't have to proxy the message created + * by the host, which can save a lot of resoruces. + */ + std::atomic_bool are_objects_directly_connected = false; + private: ConstructArgs arguments; }; diff --git a/src/wine-host/bridges/vst3.cpp b/src/wine-host/bridges/vst3.cpp index 756f948e..ae60b580 100644 --- a/src/wine-host/bridges/vst3.cpp +++ b/src/wine-host/bridges/vst3.cpp @@ -170,9 +170,19 @@ void Vst3Bridge::run() { }, [&](const YaConnectionPoint::Connect& request) -> YaConnectionPoint::Connect::Response { - // We can directly connect the underlying objects + // We can directly connect the underlying objects. We'll mark + // that we're using a direct connection on our host context + // proxy so that when the plugin wants to create an `IMessage` + // object, we can keep everything local and we Don't have to go + // through the host. // TODO: Add support for connecting objects through a proxy // object provided by the host + if (object_instances[request.instance_id].host_context_proxy) { + object_instances[request.instance_id] + .host_context_proxy->are_objects_directly_connected = + true; + } + return object_instances[request.instance_id] .connection_point->connect( object_instances[request.other_instance_id]