diff --git a/README.md b/README.md index 08838056..f0fc1fa2 100644 --- a/README.md +++ b/README.md @@ -254,7 +254,7 @@ launch winedbg in a seperate detached terminal emulator so it doesn't terminate together with the plugin, and winedbg can be a bit picky about the arguments it accepts. I've already set this up behind a feature flag for use in KDE Plasma. Other desktop environments and window managers will require some slight -modifications in `src/plugin/host-bridge.cpp`. To enable this, simply run: +modifications in `src/plugin/plugin-bridge.cpp`. To enable this, simply run: ```shell meson configure build --buildtype=debug -Duse-winedbg=true diff --git a/meson.build b/meson.build index 04b5bcfe..6fb23517 100644 --- a/meson.build +++ b/meson.build @@ -60,8 +60,8 @@ shared_library( [ 'src/common/logging.cpp', 'src/common/serialization.cpp', - 'src/plugin/host-bridge.cpp', 'src/plugin/plugin.cpp', + 'src/plugin/plugin-bridge.cpp', version_header, ], native : true, diff --git a/src/common/events.h b/src/common/events.h index 7cd1740a..8fb19bb8 100644 --- a/src/common/events.h +++ b/src/common/events.h @@ -284,8 +284,8 @@ auto passthrough_event(AEffect* plugin, F callback) { // plugin. // These are the same fields written by bitsery in the - // initialization of `HostBridge`. I can't think of a way t - // oreuse the serializer without first having to serialize + // initialization of `PluginBridge`. I can't think of a way + // to reuse the serializer without first having to serialize // `updated_plugin` first though. plugin->magic = updated_plugin.magic; plugin->numPrograms = updated_plugin.numPrograms; diff --git a/src/common/serialization.h b/src/common/serialization.h index 2216fcda..8b3ed9de 100644 --- a/src/common/serialization.h +++ b/src/common/serialization.h @@ -348,7 +348,8 @@ struct Event { * gets passed along. * - A (short) string. * - Some binary blob stored as a byte vector. During `effGetChunk` this will - contain some chunk data that should be written to `HostBridge::chunk_data`. + contain some chunk data that should be written to + `PluginBridge::chunk_data`. * - A specific struct in response to an event such as `audioMasterGetTime` or * `audioMasterIOChanged`. * - An X11 window pointer for the editor window. diff --git a/src/plugin/host-bridge.cpp b/src/plugin/plugin-bridge.cpp similarity index 96% rename from src/plugin/host-bridge.cpp rename to src/plugin/plugin-bridge.cpp index 325d11d3..ae171911 100644 --- a/src/plugin/host-bridge.cpp +++ b/src/plugin/plugin-bridge.cpp @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#include "host-bridge.h" +#include "plugin-bridge.h" #include #include @@ -146,11 +146,11 @@ bp::environment set_wineprefix(); * is sadly needed as a workaround to avoid using globals since we need free * function pointers to interface with the VST C API. */ -HostBridge& get_bridge_instance(const AEffect& plugin) { - return *static_cast(plugin.ptr3); +PluginBridge& get_bridge_instance(const AEffect& plugin) { + return *static_cast(plugin.ptr3); } -HostBridge::HostBridge(audioMasterCallback host_callback) +PluginBridge::PluginBridge(audioMasterCallback host_callback) : vst_plugin_path(find_vst_plugin()), vst_plugin_arch(find_vst_architecture(vst_plugin_path)), vst_host_path(find_vst_host(vst_plugin_arch)), @@ -378,7 +378,7 @@ class DispatchDataConverter : DefaultDataConverter { } break; case effGetChunk: { // Write the chunk data to some publically accessible place in - // `HostBridge` and write a pointer to that struct to the data + // `PluginBridge` and write a pointer to that struct to the data // pointer const auto buffer = std::get>(response.payload); @@ -425,12 +425,12 @@ class DispatchDataConverter : DefaultDataConverter { VstRect& rect; }; -intptr_t HostBridge::dispatch(AEffect* /*plugin*/, - int opcode, - int index, - intptr_t value, - void* data, - float option) { +intptr_t PluginBridge::dispatch(AEffect* /*plugin*/, + int opcode, + int index, + intptr_t value, + void* data, + float option) { // HACK: Ardour 5.X has a bug in its VST implementation where it calls the // plugin's dispatcher before the plugin has even finished // initializing. This has been fixed back in 2018, but there has not @@ -533,10 +533,10 @@ intptr_t HostBridge::dispatch(AEffect* /*plugin*/, value, data, option); } -void HostBridge::process_replacing(AEffect* /*plugin*/, - float** inputs, - float** outputs, - int sample_frames) { +void PluginBridge::process_replacing(AEffect* /*plugin*/, + float** inputs, + float** outputs, + int sample_frames) { // The inputs and outputs arrays should be `[num_inputs][sample_frames]` and // `[num_outputs][sample_frames]` floats large respectfully. std::vector> input_buffers( @@ -575,7 +575,7 @@ void HostBridge::process_replacing(AEffect* /*plugin*/, incoming_midi_events.clear(); } -float HostBridge::get_parameter(AEffect* /*plugin*/, int index) { +float PluginBridge::get_parameter(AEffect* /*plugin*/, int index) { logger.log_get_parameter(index); const Parameter request{index, std::nullopt}; @@ -594,7 +594,7 @@ float HostBridge::get_parameter(AEffect* /*plugin*/, int index) { return response.value.value(); } -void HostBridge::set_parameter(AEffect* /*plugin*/, int index, float value) { +void PluginBridge::set_parameter(AEffect* /*plugin*/, int index, float value) { logger.log_set_parameter(index, value); const Parameter request{index, value}; @@ -613,9 +613,9 @@ void HostBridge::set_parameter(AEffect* /*plugin*/, int index, float value) { assert(!response.value.has_value()); } -void HostBridge::async_log_pipe_lines(patched_async_pipe& pipe, - boost::asio::streambuf& buffer, - std::string prefix) { +void PluginBridge::async_log_pipe_lines(patched_async_pipe& pipe, + boost::asio::streambuf& buffer, + std::string prefix) { boost::asio::async_read_until( pipe, buffer, '\n', [&, prefix](const auto&, size_t) { std::string line; diff --git a/src/plugin/host-bridge.h b/src/plugin/plugin-bridge.h similarity index 99% rename from src/plugin/host-bridge.h rename to src/plugin/plugin-bridge.h index 83195113..0d0a10c8 100644 --- a/src/plugin/host-bridge.h +++ b/src/plugin/plugin-bridge.h @@ -56,7 +56,7 @@ enum class PluginArchitecture { vst_32, vst_64 }; * Wine VST host. The functions below should be used as callback functions in an * `AEffect` object. */ -class HostBridge { +class PluginBridge { public: /** * Initializes the Wine VST bridge. This sets up the sockets for event @@ -68,7 +68,7 @@ class HostBridge { * @throw std::runtime_error Thrown when the VST host could not be found, or * if it could not locate and load a VST .dll file. */ - HostBridge(audioMasterCallback host_callback); + PluginBridge(audioMasterCallback host_callback); // The four below functions are the handlers from the VST2 API. They are // called through proxy functions in `plugin.cpp`. diff --git a/src/plugin/plugin.cpp b/src/plugin/plugin.cpp index beb07e9f..28b3c99f 100644 --- a/src/plugin/plugin.cpp +++ b/src/plugin/plugin.cpp @@ -19,7 +19,7 @@ #include #include -#include "host-bridge.h" +#include "plugin-bridge.h" #define VST_EXPORT __attribute__((visibility("default"))) @@ -51,7 +51,7 @@ VST_EXPORT AEffect* VSTPluginMain(audioMasterCallback host_callback) { // This is the only place where we have to use manual memory management. // The bridge's destructor is called when the `effClose` opcode is // received. - HostBridge* bridge = new HostBridge(host_callback); + PluginBridge* bridge = new PluginBridge(host_callback); return &bridge->plugin; } catch (const std::exception& error) {