Add stubs for IPlugInterfaceSupport

This commit is contained in:
Robbert van der Helm
2021-01-16 14:38:27 +01:00
parent a8699eed18
commit 6c40cd5ad1
5 changed files with 34 additions and 5 deletions
@@ -21,10 +21,13 @@ Vst3HostContextProxy::ConstructArgs::ConstructArgs() {}
Vst3HostContextProxy::ConstructArgs::ConstructArgs( Vst3HostContextProxy::ConstructArgs::ConstructArgs(
Steinberg::IPtr<Steinberg::FUnknown> object, Steinberg::IPtr<Steinberg::FUnknown> object,
std::optional<size_t> owner_instance_id) std::optional<size_t> 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) Vst3HostContextProxy::Vst3HostContextProxy(const ConstructArgs&& args)
: YaHostApplication(std::move(args.host_application_args)), : YaHostApplication(std::move(args.host_application_args)),
YaPlugInterfaceSupport(std::move(args.plug_interface_support_args)),
arguments(std::move(args)){FUNKNOWN_CTOR} arguments(std::move(args)){FUNKNOWN_CTOR}
Vst3HostContextProxy::~Vst3HostContextProxy() { Vst3HostContextProxy::~Vst3HostContextProxy() {
@@ -44,6 +47,10 @@ Vst3HostContextProxy::queryInterface(Steinberg::FIDString _iid, void** obj) {
QUERY_INTERFACE(_iid, obj, Steinberg::Vst::IHostApplication::iid, QUERY_INTERFACE(_iid, obj, Steinberg::Vst::IHostApplication::iid,
Steinberg::Vst::IHostApplication) Steinberg::Vst::IHostApplication)
} }
if (YaPlugInterfaceSupport::supported()) {
QUERY_INTERFACE(_iid, obj, Steinberg::Vst::IPlugInterfaceSupport::iid,
Steinberg::Vst::IPlugInterfaceSupport)
}
*obj = nullptr; *obj = nullptr;
return Steinberg::kNoInterface; return Steinberg::kNoInterface;
@@ -18,6 +18,7 @@
#include "../common.h" #include "../common.h"
#include "host-context/host-application.h" #include "host-context/host-application.h"
#include "host-context/plug-interface-support.h"
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wnon-virtual-dtor" #pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
@@ -32,7 +33,8 @@
* `IPluginBase::initialize()` we'll keep track of the object instance ID the * `IPluginBase::initialize()` we'll keep track of the object instance ID the
* actual context object belongs to. * actual context object belongs to.
*/ */
class Vst3HostContextProxy : public YaHostApplication { class Vst3HostContextProxy : public YaHostApplication,
public YaPlugInterfaceSupport {
public: public:
/** /**
* These are the arguments for constructing a * These are the arguments for constructing a
@@ -56,6 +58,7 @@ class Vst3HostContextProxy : public YaHostApplication {
std::optional<native_size_t> owner_instance_id; std::optional<native_size_t> owner_instance_id;
YaHostApplication::ConstructArgs host_application_args; YaHostApplication::ConstructArgs host_application_args;
YaPlugInterfaceSupport::ConstructArgs plug_interface_support_args;
template <typename S> template <typename S>
void serialize(S& s) { void serialize(S& s) {
@@ -64,6 +67,7 @@ class Vst3HostContextProxy : public YaHostApplication {
s.value8b(instance_id); s.value8b(instance_id);
}); });
s.object(host_application_args); s.object(host_application_args);
s.object(plug_interface_support_args);
} }
}; };
@@ -93,3 +93,12 @@ Vst3HostContextProxyImpl::createInstance(Steinberg::TUID /*cid*/,
return response; return response;
} }
tresult PLUGIN_API
Vst3HostContextProxyImpl::isPlugInterfaceSupported(const Steinberg::TUID _iid) {
// TODO: Implement
std::cerr
<< "TODO: Implement IPlugInterfaceSupport::isPlugInterfaceSupported()"
<< std::endl;
return Steinberg::kNotImplemented;
}
@@ -36,6 +36,10 @@ class Vst3HostContextProxyImpl : public Vst3HostContextProxy {
Steinberg::TUID _iid, Steinberg::TUID _iid,
void** obj) override; void** obj) override;
// From `IPlugInterfaceSupport`
tresult PLUGIN_API
isPlugInterfaceSupported(const Steinberg::TUID _iid) override;
private: private:
Vst3Bridge& bridge; Vst3Bridge& bridge;
}; };
+7 -2
View File
@@ -804,10 +804,12 @@ void Vst3Bridge::run() {
// start timers from here. // start timers from here.
return main_context return main_context
.run_in_context<tresult>([&]() { .run_in_context<tresult>([&]() {
// This static cast is required to upcast to `FUnknown*`
return object_instances[request.instance_id] return object_instances[request.instance_id]
.plugin_base->initialize( .plugin_base->initialize(
static_cast<YaHostApplication*>(
object_instances[request.instance_id] object_instances[request.instance_id]
.host_context_proxy); .host_context_proxy));
}) })
.get(); .get();
}, },
@@ -876,7 +878,10 @@ void Vst3Bridge::run() {
module->getFactory().get()); module->getFactory().get());
assert(factory_3); 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<YaHostApplication*>(
plugin_factory_host_context));
}, },
[&](const YaUnitInfo::GetUnitCount& request) [&](const YaUnitInfo::GetUnitCount& request)
-> YaUnitInfo::GetUnitCount::Response { -> YaUnitInfo::GetUnitCount::Response {