mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-06-10 14:22:16 +02:00
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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user