Split IPluginBase from IComponent

We're also going to need this for `IEditController`. Separating all of
these classes will also keep everything much more maintainable with all
of these associated structs.
This commit is contained in:
Robbert van der Helm
2020-12-16 23:46:47 +01:00
parent 97570a47ba
commit 6809e73d6b
14 changed files with 257 additions and 150 deletions
+29 -29
View File
@@ -40,35 +40,6 @@ YaComponentPluginImpl::queryInterface(const Steinberg::TUID _iid, void** obj) {
return result;
}
tresult PLUGIN_API YaComponentPluginImpl::initialize(FUnknown* context) {
// This `context` will likely be an `IHostApplication`. If it is, we will
// store it here, and we'll proxy through all calls to it made from the Wine
// side. Otherwise we'll still call `IPluginBase::initialize()` but with a
// null pointer instead.
host_application_context = context;
std::optional<YaHostApplication::ConstructArgs>
host_application_context_args = std::nullopt;
if (host_application_context) {
host_application_context_args = YaHostApplication::ConstructArgs(
host_application_context, arguments.instance_id);
} else {
bridge.logger.log_unknown_interface(
"In IPluginBase::initialize()",
context ? std::optional(context->iid) : std::nullopt);
}
return bridge.send_message(
YaComponent::Initialize{.instance_id = arguments.instance_id,
.host_application_context_args =
std::move(host_application_context_args)});
}
tresult PLUGIN_API YaComponentPluginImpl::terminate() {
return bridge.send_message(
YaComponent::Terminate{.instance_id = arguments.instance_id});
}
tresult PLUGIN_API
YaComponentPluginImpl::setIoMode(Steinberg::Vst::IoMode mode) {
return bridge.send_message(YaComponent::SetIoMode{
@@ -143,6 +114,35 @@ tresult PLUGIN_API YaComponentPluginImpl::getState(Steinberg::IBStream* state) {
return response.result;
}
tresult PLUGIN_API YaComponentPluginImpl::initialize(FUnknown* context) {
// This `context` will likely be an `IHostApplication`. If it is, we will
// store it here, and we'll proxy through all calls to it made from the Wine
// side. Otherwise we'll still call `IPluginBase::initialize()` but with a
// null pointer instead.
host_application_context = context;
std::optional<YaHostApplication::ConstructArgs>
host_application_context_args = std::nullopt;
if (host_application_context) {
host_application_context_args = YaHostApplication::ConstructArgs(
host_application_context, arguments.instance_id);
} else {
bridge.logger.log_unknown_interface(
"In IPluginBase::initialize()",
context ? std::optional(context->iid) : std::nullopt);
}
return bridge.send_message(
YaPluginBase::Initialize{.instance_id = arguments.instance_id,
.host_application_context_args =
std::move(host_application_context_args)});
}
tresult PLUGIN_API YaComponentPluginImpl::terminate() {
return bridge.send_message(
YaPluginBase::Terminate{.instance_id = arguments.instance_id});
}
tresult PLUGIN_API YaComponentPluginImpl::setBusArrangements(
Steinberg::Vst::SpeakerArrangement* inputs,
int32 numIns,