Log a warning when encountering unknown interfaces

This commit is contained in:
Robbert van der Helm
2020-12-07 22:16:34 +01:00
parent 7b3a6af7d1
commit f1fe0fa8a4
3 changed files with 28 additions and 10 deletions
-3
View File
@@ -208,9 +208,6 @@ class Vst3MessageHandler : public AdHocSocketHandler<Thread> {
* sockets, and the call to `connect()` will then accept any incoming
* connections.
*
* TODO: I have no idea what the best approach here is yet, so this is very much
* subject to change
*
* @tparam Thread The thread implementation to use. On the Linux side this
* should be `std::jthread` and on the Wine side this should be `Win32Thread`.
*/
+22 -1
View File
@@ -16,6 +16,8 @@
#include "vst3-impls.h"
#include <pluginterfaces/vst/ivstcomponent.h>
YaPluginFactoryPluginImpl::YaPluginFactoryPluginImpl(Vst3PluginBridge& bridge)
: bridge(bridge) {}
@@ -49,7 +51,26 @@ YaPluginFactoryPluginImpl::createInstance(Steinberg::FIDString cid,
// `createInstance()` will have a reference to `Vst3PluginBridge`,
// they can also send control messages themselves.
return Steinberg::kNotImplemented;
if (Steinberg::FIDStringsEqual(_iid, Steinberg::Vst::IComponent::iid)) {
// TODO: Instantiate an IComponent as described above
return Steinberg::kNotImplemented;
} else {
// When the host requests an interface we do not (yet) implement, we'll
// print a recognizable log message. I don't think they include a safe
// way to convert a `FIDString/char*` into a `FUID`, so this will have
// to do.
char iid_string[128] = "<invalid_pointer>";
constexpr size_t uid_size = sizeof(Steinberg::TUID);
if (_iid && strnlen(_iid, uid_size + 1) == uid_size) {
Steinberg::FUID iid = Steinberg::FUID::fromTUID(
*reinterpret_cast<const Steinberg::TUID*>(&_iid));
iid.print(iid_string, Steinberg::FUID::UIDPrintStyle::kCLASS_UID);
}
bridge.logger.log("[Unknown interface] " + std::string(iid_string));
return Steinberg::kNotImplemented;
}
}
tresult PLUGIN_API
+6 -6
View File
@@ -63,6 +63,12 @@ class Vst3PluginBridge : PluginBridge<Vst3Sockets<std::jthread>> {
*/
Steinberg::IPluginFactory* get_plugin_factory();
/**
* The logging facility used for this instance of yabridge. Wraps around
* `PluginBridge::generic_logger`.
*/
Vst3Logger logger;
private:
/**
* Handles callbacks from the plugin to the host over the
@@ -70,12 +76,6 @@ class Vst3PluginBridge : PluginBridge<Vst3Sockets<std::jthread>> {
*/
std::jthread host_callback_handler;
/**
* The logging facility used for this instance of yabridge. Wraps around
* `PluginBridge::generic_logger`.
*/
Vst3Logger logger;
/**
* Our plugin factory. All information about the plugin and its supported
* classes are copied directly from the Windows VST3 plugin's factory on the