From b0fc8f2c5f8bab7a6a528693cde8da61419ce6fe Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Thu, 24 Dec 2020 14:39:25 +0100 Subject: [PATCH] Remove are_objects_directly_connected check It's not necessary, since all of these objects are simple data objects that will be passed as arguments to other functions. When we have to pass through one of those functions we can just serialize the objects at that point. --- README.md | 1 - .../serialization/vst3/host-context-proxy.h | 9 ---- .../bridges/vst3-impls/host-context-proxy.cpp | 48 +++++++------------ src/wine-host/bridges/vst3.cpp | 15 +----- 4 files changed, 18 insertions(+), 55 deletions(-) diff --git a/README.md b/README.md index 58df5366..c216d4b9 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,6 @@ This branch is still very far removed from being in a usable state. Below is an incomplete list of things that still have to be done before this can be used: - Interfaces left to implement: - - `IHostApplication::createComponent()` for indirectly connected objects - `IConnectionPoint::notify()`, and support for indirectly connecting objects through connction proxies - `IEditController2` diff --git a/src/common/serialization/vst3/host-context-proxy.h b/src/common/serialization/vst3/host-context-proxy.h index 0aab8530..e2afe641 100644 --- a/src/common/serialization/vst3/host-context-proxy.h +++ b/src/common/serialization/vst3/host-context-proxy.h @@ -97,15 +97,6 @@ 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-impls/host-context-proxy.cpp b/src/wine-host/bridges/vst3-impls/host-context-proxy.cpp index 0930c697..38e9af6d 100644 --- a/src/wine-host/bridges/vst3-impls/host-context-proxy.cpp +++ b/src/wine-host/bridges/vst3-impls/host-context-proxy.cpp @@ -66,40 +66,26 @@ Vst3HostContextProxyImpl::createInstance(Steinberg::TUID /*cid*/, return Steinberg::kInvalidArgument; } + // These objects don't have to be created by the actual host since they'll + // only be used as an argument to other functions. We can just serialize + // them at that point. Steinberg::FUID iid = Steinberg::FUID::fromTUID(_iid); - // If an objects wants to create an `IMessage` object to send it to some - // object it is directly connected to, then we can keep everything local - // on the Wine side. This is mostly an optimization, because it saves a - // lot of unnecessary back and forth communication. - if (are_objects_directly_connected) { - if (iid == Steinberg::Vst::IMessage::iid) { - // TODO: Add logging for this on verbosity level 1 - *obj = new Steinberg::Vst::HostMessage{}; - return Steinberg::kResultTrue; - } else if (iid == Steinberg::Vst::IAttributeList::iid) { - // TODO: Add logging for this on verbosity level 1 - *obj = new Steinberg::Vst::HostAttributeList{}; - return Steinberg::kResultTrue; - } else { - // When the host requests an interface we do not (yet) implement, - // we'll print a recognizable log message - const Steinberg::FUID uid = Steinberg::FUID::fromTUID(_iid); - std::cerr - << "TODO: Implement unknown interface logging on Wine side " - "for Vst3HostContextProxyImpl::createInstance" - << std::endl; - - return Steinberg::kNotImplemented; - } + if (iid == Steinberg::Vst::IMessage::iid) { + // TODO: Add logging for this on verbosity level 1 + *obj = new Steinberg::Vst::HostMessage{}; + return Steinberg::kResultTrue; + } else if (iid == Steinberg::Vst::IAttributeList::iid) { + // TODO: Add logging for this on verbosity level 1 + *obj = new Steinberg::Vst::HostAttributeList{}; + return Steinberg::kResultTrue; } else { - // TODO: Implement for objects that are not directly connected - std::cerr - << "TODO: Creating and instances in " - "IHostApplication::createInstance() for indirectly " - "connected objects has not yet been implemented" - << std::endl; + // When the host requests an interface we do not (yet) implement, + // we'll print a recognizable log message + const Steinberg::FUID uid = Steinberg::FUID::fromTUID(_iid); + std::cerr << "TODO: Implement unknown interface logging on Wine side " + "for Vst3HostContextProxyImpl::createInstance" + << std::endl; - *obj = nullptr; return Steinberg::kNotImplemented; } } diff --git a/src/wine-host/bridges/vst3.cpp b/src/wine-host/bridges/vst3.cpp index 64a77552..756f948e 100644 --- a/src/wine-host/bridges/vst3.cpp +++ b/src/wine-host/bridges/vst3.cpp @@ -170,22 +170,9 @@ void Vst3Bridge::run() { }, [&](const YaConnectionPoint::Connect& request) -> YaConnectionPoint::Connect::Response { - // 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. + // We can directly connect the underlying objects // 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; - object_instances[request.other_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]