mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-14 04:19:59 +02:00
Allow creating IEditController instances
Now `IPluginFactory::createInstance()` can create multiple (and in our case, all relevant) different types of objects.
This commit is contained in:
+15
-10
@@ -34,24 +34,29 @@ void Vst3Logger::log_unknown_interface(
|
||||
}
|
||||
|
||||
void Vst3Logger::log_request(bool is_host_vst,
|
||||
const Vst3PluginProxy::Construct& args) {
|
||||
const Vst3PluginProxy::Construct& request) {
|
||||
log_request_base(is_host_vst, [&](auto& message) {
|
||||
// TODO: When adding the enum class for instantiating different types,
|
||||
// make sure to reflect those in the constructor and destructor
|
||||
// logging
|
||||
message << "IPluginFactory::createComponent(cid = "
|
||||
<< format_uid(Steinberg::FUID::fromTUID(args.cid.data()))
|
||||
<< ", _iid = "
|
||||
"IComponent::iid, "
|
||||
"&obj)";
|
||||
<< format_uid(Steinberg::FUID::fromTUID(request.cid.data()))
|
||||
<< ", _iid = ";
|
||||
switch (request.requested_interface) {
|
||||
case Vst3PluginProxy::Construct::Interface::IComponent:
|
||||
message << "IComponent::iid";
|
||||
break;
|
||||
case Vst3PluginProxy::Construct::Interface::IEditController:
|
||||
message << "IEditController::iid";
|
||||
break;
|
||||
}
|
||||
message << ", &obj)";
|
||||
});
|
||||
}
|
||||
|
||||
void Vst3Logger::log_request(bool is_host_vst,
|
||||
const Vst3PluginProxy::Destruct& request) {
|
||||
log_request_base(is_host_vst, [&](auto& message) {
|
||||
message << "<IComponent* #" << request.instance_id
|
||||
<< ">::~IComponent()";
|
||||
// We don't know what class this instance was originally instantiated
|
||||
// as, but it also doesn't really matter
|
||||
message << "<FUnknown* #" << request.instance_id << ">::~FUnknown()";
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -93,20 +93,29 @@ class Vst3PluginProxy : public YaAudioProcessor,
|
||||
/**
|
||||
* Message to request the Wine plugin host to instantiate a new IComponent
|
||||
* to pass through a call to `IComponent::createInstance(cid,
|
||||
* IComponent::iid, ...)`.
|
||||
* <requested_interface>::iid, ...)`.
|
||||
*/
|
||||
struct Construct {
|
||||
using Response = std::variant<ConstructArgs, UniversalTResult>;
|
||||
|
||||
ArrayUID cid;
|
||||
|
||||
// TODO: Add an enum class to reify the type of object we want to
|
||||
// instantiate so we can initialize things other than
|
||||
// `IComponent`, like `IEditController.`
|
||||
/**
|
||||
* The interface the host was trying to instantiate an object for.
|
||||
* Technically the host can create any kind of object, but these are the
|
||||
* objects that are actually used.
|
||||
*/
|
||||
enum class Interface {
|
||||
IComponent,
|
||||
IEditController,
|
||||
};
|
||||
|
||||
Interface requested_interface;
|
||||
|
||||
template <typename S>
|
||||
void serialize(S& s) {
|
||||
s.container1b(cid);
|
||||
s.value4b(requested_interface);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user