added vst main fallback

This commit is contained in:
itsmattkc
2019-02-10 05:11:20 -08:00
parent 97548f1ff5
commit 57e038afc4
+14 -4
View File
@@ -144,10 +144,20 @@ void VSTHost::loadPlugin() {
return;
}
vstPluginFuncPtr mainEntryPoint =
reinterpret_cast<vstPluginFuncPtr>(LibAddress(modulePtr, "VSTPluginMain"));
// Instantiate the plugin
plugin = mainEntryPoint(hostCallback);
vstPluginFuncPtr mainEntryPoint = reinterpret_cast<vstPluginFuncPtr>(LibAddress(modulePtr, "VSTPluginMain"));
if (mainEntryPoint == nullptr) {
// if there's no VSTPluginMain(), fallback to main()
mainEntryPoint = reinterpret_cast<vstPluginFuncPtr>(LibAddress(modulePtr, "main"));
}
if (mainEntryPoint == nullptr) {
QMessageBox::critical(nullptr, tr("Error loading VST plugin"), tr("Failed to locate entry point for dynamic library."));
LibClose(modulePtr);
} else {
// Instantiate the plugin
plugin = mainEntryPoint(hostCallback);
}
#endif
}