Partially implement IHostApplication

For now only works for directly connected components.
This commit is contained in:
Robbert van der Helm
2020-12-24 13:48:31 +01:00
parent 1be9f53bb3
commit a86c37a21d
2 changed files with 47 additions and 7 deletions
@@ -18,6 +18,8 @@
#include <iostream>
#include <public.sdk/source/vst/hosting/hostclasses.h>
Vst3HostContextProxyImpl::Vst3HostContextProxyImpl(
Vst3Bridge& bridge,
Vst3HostContextProxy::ConstructArgs&& args)
@@ -54,10 +56,48 @@ Vst3HostContextProxyImpl::getName(Steinberg::Vst::String128 name) {
}
tresult PLUGIN_API
Vst3HostContextProxyImpl::createInstance(Steinberg::TUID cid,
Vst3HostContextProxyImpl::createInstance(Steinberg::TUID /*cid*/,
Steinberg::TUID _iid,
void** obj) {
// TODO: Implement
std::cerr << "TODO: IHostApplication::createInstance()" << std::endl;
return Steinberg::kNotImplemented;
// Class IDs don't have a meaning here, they just mirrored the interface
// from `IPlugFactory::createInstance()`
constexpr size_t uid_size = sizeof(Steinberg::TUID);
if (!_iid || strnlen(_iid, uid_size) < uid_size) {
return Steinberg::kInvalidArgument;
}
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;
}
} else {
// TODO: Implement for objects that are not directly connected
std::cerr
<< "TODO: Creating <IMessage*> and <IAttributeList*> instances in "
"IHostApplication::createInstance() for indirectly "
"connected objects has not yet been implemented"
<< std::endl;
return Steinberg::kNotImplemented;
}
}