mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-10 04:30:12 +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:
@@ -16,6 +16,9 @@ Versioning](https://semver.org/spec/v2.0.0.html).
|
|||||||
|
|
||||||
### Fixed
|
### 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
|
- Prevent _Native Instruments' FM7_ from crashing when processing MIDI. As a
|
||||||
fix, MIDI events are now deallocated later then when they normally would have
|
fix, MIDI events are now deallocated later then when they normally would have
|
||||||
to be.
|
to be.
|
||||||
|
|||||||
@@ -73,7 +73,15 @@ Vst2Bridge::Vst2Bridge(MainContext& main_context,
|
|||||||
main_context(main_context),
|
main_context(main_context),
|
||||||
plugin_handle(LoadLibrary(plugin_dll_path.c_str()), FreeLibrary),
|
plugin_handle(LoadLibrary(plugin_dll_path.c_str()), FreeLibrary),
|
||||||
sockets(main_context.context, endpoint_base_dir, false) {
|
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) {
|
if (!plugin_handle) {
|
||||||
throw std::runtime_error("Could not load the Windows .dll file at '" +
|
throw std::runtime_error("Could not load the Windows .dll file at '" +
|
||||||
plugin_dll_path + "'");
|
plugin_dll_path + "'");
|
||||||
|
|||||||
@@ -99,6 +99,16 @@ Vst3Bridge::Vst3Bridge(MainContext& main_context,
|
|||||||
sockets(main_context.context, endpoint_base_dir, false) {
|
sockets(main_context.context, endpoint_base_dir, false) {
|
||||||
std::string error;
|
std::string error;
|
||||||
module = VST3::Hosting::Win32Module::create(plugin_dll_path, 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) {
|
if (!module) {
|
||||||
throw std::runtime_error("Could not load the VST3 module for '" +
|
throw std::runtime_error("Could not load the VST3 module for '" +
|
||||||
plugin_dll_path + "': " + error);
|
plugin_dll_path + "': " + error);
|
||||||
|
|||||||
Reference in New Issue
Block a user