💥 Major refactor of initialization plumbing

To account for the differences in VST2 plugins and VST3 modules we had
to wrap most of our old functions from `src/plugin/utils.h` in a new
`PluginInfo` struct that gathers all of this information while taking
into account the differences between VST2 and VST3 plugins.

With this change things are also a lot more organized. We can just query
the plugin information we need rather than having to store things
separately or having to recalculate things. This also moved the
responsibility of all the weird `WINEPREFIX` behaviour to a single place
instead of having it spread around `utils.pp`, the initialisation
message, and `host-procoess.cpp`.
This commit is contained in:
Robbert van der Helm
2020-12-04 18:13:52 +01:00
parent 0819e9fda9
commit c1e7f53cd0
11 changed files with 464 additions and 261 deletions
+10 -12
View File
@@ -17,18 +17,16 @@
#include "vst3.h"
Vst3PluginBridge::Vst3PluginBridge()
: PluginBridge(PluginType::vst3,
// TODO: This is incorrect for VST3 modules
find_vst_plugin(),
[](boost::asio::io_context& io_context) {
return Vst3Sockets<std::jthread>(
io_context,
generate_endpoint_base(find_vst_plugin()
.filename()
.replace_extension("")
.string()),
true);
}),
: PluginBridge(
PluginType::vst3,
[](boost::asio::io_context& io_context, const PluginInfo& info) {
return Vst3Sockets<std::jthread>(
io_context,
generate_endpoint_base(info.native_library_path.filename()
.replace_extension("")
.string()),
true);
}),
// TODO: This is UB, use composition with `generic_logger` instead
logger(static_cast<Vst3Logger&&>(Logger::create_from_environment(
create_logger_prefix(sockets.base_dir)))) {