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
+9 -7
View File
@@ -26,7 +26,9 @@ ComponentInstance::ComponentInstance() {}
ComponentInstance::ComponentInstance(
Steinberg::IPtr<Steinberg::Vst::IComponent> component)
: component(component), audio_processor(component) {}
: component(component),
plugin_base(component),
audio_processor(component) {}
Vst3Bridge::Vst3Bridge(MainContext& main_context,
std::string plugin_dll_path,
@@ -86,8 +88,8 @@ void Vst3Bridge::run() {
return Ack{};
},
[&](YaComponent::Initialize& request)
-> YaComponent::Initialize::Response {
[&](YaPluginBase::Initialize& request)
-> YaPluginBase::Initialize::Response {
// If we got passed a host context, we'll create a proxy object
// and pass that to the initialize function. This object should
// be cleaned up again during `YaComponent::Destruct`.
@@ -103,12 +105,12 @@ void Vst3Bridge::run() {
}
return component_instances[request.instance_id]
.component->initialize(context);
.plugin_base->initialize(context);
},
[&](const YaComponent::Terminate& request)
-> YaComponent::Terminate::Response {
[&](const YaPluginBase::Terminate& request)
-> YaPluginBase::Terminate::Response {
return component_instances[request.instance_id]
.component->terminate();
.plugin_base->terminate();
},
[&](const YaComponent::SetIoMode& request)
-> YaComponent::SetIoMode::Response {
+5 -1
View File
@@ -28,6 +28,9 @@
* A holder for an `IComponent` instance created from the factory along with any
* host context proxy objects belonging to it, and several predefined
* `FUnknownPtrs` so we don't have to do these dynamic casts all the times..
*
* TODO: When implementing `IEditController`, change this to use `IPluginBase`
* as the base interface.
*/
struct ComponentInstance {
ComponentInstance();
@@ -37,7 +40,7 @@ struct ComponentInstance {
/**
* If the host passes an `IHostApplication` during
* `IPluginBase::initialize()`, we'll store a proxy object here and then
* pass it to `component->initialize()`.
* pass it to `plugin_base->initialize()`.
*/
Steinberg::IPtr<YaHostApplication> hsot_application_context;
@@ -49,6 +52,7 @@ struct ComponentInstance {
// All smart pointers below are created from `component`. They will be null
// pointers if `component` did not implement the interface.
Steinberg::FUnknownPtr<Steinberg::IPluginBase> plugin_base;
Steinberg::FUnknownPtr<Steinberg::Vst::IAudioProcessor> audio_processor;
};