13
0

VST3: initialize controller even if it is-a component

This commit is contained in:
Robin Gareus 2021-10-06 21:35:08 +02:00
parent cc084ef0a7
commit bbbfadb832
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -1056,23 +1056,29 @@ VST3PI::VST3PI (boost::shared_ptr<ARDOUR::VST3PluginModule> m, std::string uniqu
throw failed_constructor ();
}
if (_component->initialize (HostApplication::getHostContext ()) != kResultOk) {
if (!_component || _component->initialize (HostApplication::getHostContext ()) != kResultOk) {
throw failed_constructor ();
}
_controller = FUnknownPtr<Vst::IEditController> (_component);
if (!_controller) {
TUID controllerCID;
if (_component->getControllerClassId (controllerCID) == kResultTrue) {
if (factory->createInstance (controllerCID, Vst::IEditController::iid, (void**)&_controller) != kResultTrue) {
throw failed_constructor ();
}
if (_controller && (_controller->initialize (HostApplication::getHostContext ()) != kResultOk)) {
_component->terminate ();
_component->release ();
throw failed_constructor ();
}
}
}
if (_controller && (_controller->initialize (HostApplication::getHostContext ()) != kResultOk)) {
_component->terminate ();
_component->release ();
throw failed_constructor ();
}
if (!_controller) {
_component->terminate ();
_component->release ();