Fully implement IPlugInterfaceSupport

With this we support all VST 3.6.12 interfaces.
This commit is contained in:
Robbert van der Helm
2021-01-16 15:19:10 +01:00
parent 701271c273
commit 73fda0b568
7 changed files with 41 additions and 5 deletions
+1
View File
@@ -206,6 +206,7 @@ using CallbackRequest =
YaContextMenu::Popup, YaContextMenu::Popup,
YaHostApplication::GetName, YaHostApplication::GetName,
YaPlugFrame::ResizeView, YaPlugFrame::ResizeView,
YaPlugInterfaceSupport::IsPlugInterfaceSupported,
YaUnitHandler::NotifyUnitSelection, YaUnitHandler::NotifyUnitSelection,
YaUnitHandler::NotifyProgramListChange, YaUnitHandler::NotifyProgramListChange,
YaUnitHandler2::NotifyUnitByBusChange>; YaUnitHandler2::NotifyUnitByBusChange>;
@@ -111,6 +111,7 @@ YaPluginFactoryImpl::setHostContext(Steinberg::FUnknown* context) {
// Automatically converted smart pointers for when the plugin performs a // Automatically converted smart pointers for when the plugin performs a
// callback later // callback later
host_application = host_context; host_application = host_context;
plug_interface_support = host_context;
return bridge.send_message(YaPluginFactory::SetHostContext{ return bridge.send_message(YaPluginFactory::SetHostContext{
.host_context_args = Vst3HostContextProxy::ConstructArgs( .host_context_args = Vst3HostContextProxy::ConstructArgs(
@@ -32,6 +32,8 @@ class YaPluginFactoryImpl : public YaPluginFactory {
// `IPluginFactory3::setHostContext()` has been called // `IPluginFactory3::setHostContext()` has been called
Steinberg::FUnknownPtr<Steinberg::Vst::IHostApplication> host_application; Steinberg::FUnknownPtr<Steinberg::Vst::IHostApplication> host_application;
Steinberg::FUnknownPtr<Steinberg::Vst::IPlugInterfaceSupport>
plug_interface_support;
private: private:
Vst3PluginBridge& bridge; Vst3PluginBridge& bridge;
@@ -698,6 +698,7 @@ tresult PLUGIN_API Vst3PluginProxyImpl::initialize(FUnknown* context) {
// Automatically converted smart pointers for when the plugin performs a // Automatically converted smart pointers for when the plugin performs a
// callback later // callback later
host_application = host_context; host_application = host_context;
plug_interface_support = host_context;
return bridge.send_message(YaPluginBase::Initialize{ return bridge.send_message(YaPluginBase::Initialize{
.instance_id = instance_id(), .instance_id = instance_id(),
@@ -338,6 +338,8 @@ class Vst3PluginProxyImpl : public Vst3PluginProxy {
// `IPluginBase::initialize()` has been called // `IPluginBase::initialize()` has been called
Steinberg::FUnknownPtr<Steinberg::Vst::IHostApplication> host_application; Steinberg::FUnknownPtr<Steinberg::Vst::IHostApplication> host_application;
Steinberg::FUnknownPtr<Steinberg::Vst::IPlugInterfaceSupport>
plug_interface_support;
// The following pointers are cast from `component_handler` if // The following pointers are cast from `component_handler` if
// `IEditController::setComponentHandler()` has been called // `IEditController::setComponentHandler()` has been called
+22
View File
@@ -265,6 +265,28 @@ Vst3PluginBridge::Vst3PluginBridge()
return plug_view->plug_frame->resizeView(plug_view, return plug_view->plug_frame->resizeView(plug_view,
&request.new_size); &request.new_size);
}, },
[&](const YaPlugInterfaceSupport::IsPlugInterfaceSupported&
request) -> YaPlugInterfaceSupport::
IsPlugInterfaceSupported::Response {
// TODO: For correctness' sake we
// should automatically reject
// queries for interfaces we
// don't yet or can't implement,
// like the ARA interfaces.
if (request.owner_instance_id) {
return plugin_proxies
.at(*request.owner_instance_id)
.get()
.plug_interface_support
->isPlugInterfaceSupported(
request.iid.data());
} else {
return plugin_factory
->plug_interface_support
->isPlugInterfaceSupported(
request.iid.data());
}
},
[&](const YaUnitHandler::NotifyUnitSelection& request) [&](const YaUnitHandler::NotifyUnitSelection& request)
-> YaUnitHandler::NotifyUnitSelection::Response { -> YaUnitHandler::NotifyUnitSelection::Response {
return plugin_proxies.at(request.owner_instance_id) return plugin_proxies.at(request.owner_instance_id)
@@ -96,9 +96,16 @@ Vst3HostContextProxyImpl::createInstance(Steinberg::TUID /*cid*/,
tresult PLUGIN_API tresult PLUGIN_API
Vst3HostContextProxyImpl::isPlugInterfaceSupported(const Steinberg::TUID _iid) { Vst3HostContextProxyImpl::isPlugInterfaceSupported(const Steinberg::TUID _iid) {
// TODO: Implement if (_iid) {
std::cerr return bridge.send_message(
<< "TODO: Implement IPlugInterfaceSupport::isPlugInterfaceSupported()" YaPlugInterfaceSupport::IsPlugInterfaceSupported{
<< std::endl; .owner_instance_id = owner_instance_id(),
return Steinberg::kNotImplemented; .iid = std::to_array(
*reinterpret_cast<const Steinberg::TUID*>(&_iid))});
} else {
bridge.logger.log(
"WARNING: Null pointer passed to "
"'IPlugInterfaceSupport::isPlugInterfaceSupported()'");
return Steinberg::kInvalidArgument;
}
} }