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(
Steinberg::IPtr<Steinberg::FUnknown> object,
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)
: 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;
@@ -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<native_size_t> owner_instance_id;
YaHostApplication::ConstructArgs host_application_args;
YaPlugInterfaceSupport::ConstructArgs plug_interface_support_args;
template <typename S>
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);
}
};
@@ -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;
}
@@ -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;
};
+8 -3
View File
@@ -804,10 +804,12 @@ void Vst3Bridge::run() {
// start timers from here.
return main_context
.run_in_context<tresult>([&]() {
// 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<YaHostApplication*>(
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<YaHostApplication*>(
plugin_factory_host_context));
},
[&](const YaUnitInfo::GetUnitCount& request)
-> YaUnitInfo::GetUnitCount::Response {