Load the CLAP plugin factory

Creating the plugin still fails.
This commit is contained in:
Robbert van der Helm
2022-09-05 17:55:07 +02:00
parent c36590abf5
commit 6137fe32ce
2 changed files with 44 additions and 27 deletions
+23 -1
View File
@@ -73,6 +73,28 @@ ClapPluginBridge::~ClapPluginBridge() noexcept {
} }
const void* ClapPluginBridge::get_factory(const char* factory_id) { const void* ClapPluginBridge::get_factory(const char* factory_id) {
// FIXME: Implement assert(factory_id);
if (strcmp(factory_id, CLAP_PLUGIN_FACTORY_ID) == 0) {
// We'll initialize the factory the first time it's requested
if (!plugin_factory_) {
// If the plugin does not support this factory type, then we'll also
// return a null poitner
const clap::plugin_factory::ListResponse response =
send_main_thread_message(clap::plugin_factory::List{});
if (!response.descriptors) {
return nullptr; return nullptr;
} }
plugin_factory_ = std::make_unique<clap_plugin_factory_proxy>(
*this, *response.descriptors);
}
return &plugin_factory_->plugin_factory_vtable;
} else {
logger_.log_trace([factory_id]() {
return "Unknown factory type '" + std::string(factory_id) + "'";
});
return nullptr;
}
}
+20 -25
View File
@@ -22,6 +22,7 @@
#include "../../common/communication/clap.h" #include "../../common/communication/clap.h"
#include "../../common/logging/clap.h" #include "../../common/logging/clap.h"
#include "../../common/mutual-recursion.h" #include "../../common/mutual-recursion.h"
#include "clap-impls/plugin-factory-proxy.h"
#include "common.h" #include "common.h"
/** /**
@@ -108,21 +109,17 @@ class ClapPluginBridge : PluginBridge<ClapSockets<std::jthread>> {
// */ // */
// void unregister_plugin_proxy(ClapPluginProxyImpl& proxy_object); // void unregister_plugin_proxy(ClapPluginProxyImpl& proxy_object);
// // TODO: /**
// /** * Send a control message to the Wine plugin host and return the response.
// * Send a control message to the Wine plugin host and return the * This is intended for main thread function calls, and it's a shorthand for
// response. * `sockets_.host_plugin_control_.send_message()` for use in CLAP interface
// * This is intended for main thread function calls, and it's a shorthand * implementations.
// for */
// * `sockets_.host_plugin_control_.send_message()` for use in CLAP template <typename T>
// interface typename T::Response send_main_thread_message(const T& object) {
// * implementations. return sockets_.host_plugin_main_thread_control_.send_message(
// */ object, std::pair<ClapLogger&, bool>(logger_, true));
// template <typename T> }
// typename T::Response send_main_thread_message(const T& object) {
// return sockets_.host_plugin_control_.send_message(
// object, std::pair<ClapLogger&, bool>(logger_, true));
// }
// /** // /**
// * Send an a message to a plugin instance's audio thread. This is // * Send an a message to a plugin instance's audio thread. This is
@@ -206,16 +203,14 @@ class ClapPluginBridge : PluginBridge<ClapSockets<std::jthread>> {
*/ */
std::jthread host_callback_handler_; std::jthread host_callback_handler_;
// /** /**
// * Our plugin factory. All information about the plugin and its supported * Our plugin factory, containing information about all plugins supported by
// * classes are copied directly from the Windows CLAP plugin's factory on * the bridged CLAP plugin's factory. This is initialized the first time the
// the * host tries to query this in `clap_entry->get_factory()`.
// * Wine side, and we'll provide an implementation that can send control *
// * messages to the Wine plugin host. * @related get_factory
// * */
// * @related get_plugin_factory std::unique_ptr<clap_plugin_factory_proxy> plugin_factory_;
// */
// Steinberg::IPtr<ClapPluginFactoryProxyImpl> plugin_factory_ = nullptr;
// TODO: Implement // TODO: Implement
// /** // /**