diff --git a/src/common/serialization/vst3/host-context-proxy.cpp b/src/common/serialization/vst3/host-context-proxy.cpp index a4fef9f9..39f674d0 100644 --- a/src/common/serialization/vst3/host-context-proxy.cpp +++ b/src/common/serialization/vst3/host-context-proxy.cpp @@ -21,10 +21,13 @@ Vst3HostContextProxy::ConstructArgs::ConstructArgs() {} Vst3HostContextProxy::ConstructArgs::ConstructArgs( Steinberg::IPtr object, std::optional owner_instance_id) - : owner_instance_id(owner_instance_id), host_application_args(object) {} + : owner_instance_id(owner_instance_id), + host_application_args(object), + plug_interface_support_args(object) {} Vst3HostContextProxy::Vst3HostContextProxy(const ConstructArgs&& args) : YaHostApplication(std::move(args.host_application_args)), + YaPlugInterfaceSupport(std::move(args.plug_interface_support_args)), arguments(std::move(args)){FUNKNOWN_CTOR} Vst3HostContextProxy::~Vst3HostContextProxy() { @@ -44,6 +47,10 @@ Vst3HostContextProxy::queryInterface(Steinberg::FIDString _iid, void** obj) { QUERY_INTERFACE(_iid, obj, Steinberg::Vst::IHostApplication::iid, Steinberg::Vst::IHostApplication) } + if (YaPlugInterfaceSupport::supported()) { + QUERY_INTERFACE(_iid, obj, Steinberg::Vst::IPlugInterfaceSupport::iid, + Steinberg::Vst::IPlugInterfaceSupport) + } *obj = nullptr; return Steinberg::kNoInterface; diff --git a/src/common/serialization/vst3/host-context-proxy.h b/src/common/serialization/vst3/host-context-proxy.h index 7f583310..24fd04fa 100644 --- a/src/common/serialization/vst3/host-context-proxy.h +++ b/src/common/serialization/vst3/host-context-proxy.h @@ -18,6 +18,7 @@ #include "../common.h" #include "host-context/host-application.h" +#include "host-context/plug-interface-support.h" #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wnon-virtual-dtor" @@ -32,7 +33,8 @@ * `IPluginBase::initialize()` we'll keep track of the object instance ID the * actual context object belongs to. */ -class Vst3HostContextProxy : public YaHostApplication { +class Vst3HostContextProxy : public YaHostApplication, + public YaPlugInterfaceSupport { public: /** * These are the arguments for constructing a @@ -56,6 +58,7 @@ class Vst3HostContextProxy : public YaHostApplication { std::optional owner_instance_id; YaHostApplication::ConstructArgs host_application_args; + YaPlugInterfaceSupport::ConstructArgs plug_interface_support_args; template void serialize(S& s) { @@ -64,6 +67,7 @@ class Vst3HostContextProxy : public YaHostApplication { s.value8b(instance_id); }); s.object(host_application_args); + s.object(plug_interface_support_args); } }; 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 220faa58..343e86d1 100644 --- a/src/wine-host/bridges/vst3-impls/host-context-proxy.cpp +++ b/src/wine-host/bridges/vst3-impls/host-context-proxy.cpp @@ -93,3 +93,12 @@ Vst3HostContextProxyImpl::createInstance(Steinberg::TUID /*cid*/, return response; } + +tresult PLUGIN_API +Vst3HostContextProxyImpl::isPlugInterfaceSupported(const Steinberg::TUID _iid) { + // TODO: Implement + std::cerr + << "TODO: Implement IPlugInterfaceSupport::isPlugInterfaceSupported()" + << std::endl; + return Steinberg::kNotImplemented; +} diff --git a/src/wine-host/bridges/vst3-impls/host-context-proxy.h b/src/wine-host/bridges/vst3-impls/host-context-proxy.h index 472ebd02..ca33011f 100644 --- a/src/wine-host/bridges/vst3-impls/host-context-proxy.h +++ b/src/wine-host/bridges/vst3-impls/host-context-proxy.h @@ -36,6 +36,10 @@ class Vst3HostContextProxyImpl : public Vst3HostContextProxy { Steinberg::TUID _iid, void** obj) override; + // From `IPlugInterfaceSupport` + tresult PLUGIN_API + isPlugInterfaceSupported(const Steinberg::TUID _iid) override; + private: Vst3Bridge& bridge; }; diff --git a/src/wine-host/bridges/vst3.cpp b/src/wine-host/bridges/vst3.cpp index 81e89898..148e585b 100644 --- a/src/wine-host/bridges/vst3.cpp +++ b/src/wine-host/bridges/vst3.cpp @@ -804,10 +804,12 @@ void Vst3Bridge::run() { // start timers from here. return main_context .run_in_context([&]() { + // This static cast is required to upcast to `FUnknown*` return object_instances[request.instance_id] .plugin_base->initialize( - object_instances[request.instance_id] - .host_context_proxy); + static_cast( + object_instances[request.instance_id] + .host_context_proxy)); }) .get(); }, @@ -876,7 +878,10 @@ void Vst3Bridge::run() { module->getFactory().get()); assert(factory_3); - return factory_3->setHostContext(plugin_factory_host_context); + // This static cast is required to upcast to `FUnknown*` + return factory_3->setHostContext( + static_cast( + plugin_factory_host_context)); }, [&](const YaUnitInfo::GetUnitCount& request) -> YaUnitInfo::GetUnitCount::Response {