Fix loading plugins expecting COM to be available

The `LoadLibrary()` call for PSPaudioware InfiniStrip would fail because
the plugin would always expect COM to be initialized. Now if loading a
VST2 or VST3 module fails, we'll initialize COM and try again before
throwing an error. This may fix #94.
This commit is contained in:
Robbert van der Helm
2021-04-25 21:52:41 +02:00
parent d55f07e962
commit 86bd19cd80
3 changed files with 22 additions and 1 deletions
+3
View File
@@ -16,6 +16,9 @@ Versioning](https://semver.org/spec/v2.0.0.html).
### Fixed
- _PSPaudioware InifniStrip_ would fail to initialize because the plugin expects
the host to always be using Microsoft COM and it won't initialize it by
itself. InfiniStrip loads as expected now.
- Prevent _Native Instruments' FM7_ from crashing when processing MIDI. As a
fix, MIDI events are now deallocated later then when they normally would have
to be.
+9 -1
View File
@@ -73,7 +73,15 @@ Vst2Bridge::Vst2Bridge(MainContext& main_context,
main_context(main_context),
plugin_handle(LoadLibrary(plugin_dll_path.c_str()), FreeLibrary),
sockets(main_context.context, endpoint_base_dir, false) {
// Got to love these C APIs
// HACK: If the plugin library was unable to load, then there's a tiny
// chance that the plugin expected the COM library to already be
// initialized. I've only seen PSPaudioware's InfiniStrip do this. In
// that case, we'll initialize the COM library for them and try again.
if (!plugin_handle) {
OleInitialize(nullptr);
plugin_handle.reset(LoadLibrary(plugin_dll_path.c_str()));
}
if (!plugin_handle) {
throw std::runtime_error("Could not load the Windows .dll file at '" +
plugin_dll_path + "'");
+10
View File
@@ -99,6 +99,16 @@ Vst3Bridge::Vst3Bridge(MainContext& main_context,
sockets(main_context.context, endpoint_base_dir, false) {
std::string error;
module = VST3::Hosting::Win32Module::create(plugin_dll_path, error);
// HACK: If the plugin library was unable to load, then there's a tiny
// chance that the plugin expected the COM library to already be
// initialized. I've only seen PSPaudioware's InfiniStrip do this. In
// that case, we'll initialize the COM library for them and try again.
if (!module) {
OleInitialize(nullptr);
module = VST3::Hosting::Win32Module::create(plugin_dll_path, error);
}
if (!module) {
throw std::runtime_error("Could not load the VST3 module for '" +
plugin_dll_path + "': " + error);