💥 Rename PluginBridge to WineBridge

I had swapped these names around once before but I think going with
PluginBridge for the plugin and WineBridge for the Wine VST host is the
least ambiguous it can get.
This commit is contained in:
Robbert van der Helm
2020-05-07 13:04:00 +02:00
parent 8b3f5286b4
commit 2d0998047c
7 changed files with 36 additions and 36 deletions
+1 -1
View File
@@ -369,7 +369,7 @@ as the _Windows VST plugin_. The whole process works as follows:
in the `DispatchDataConverter` and `HostCallbackDataCovnerter` classes for in the `DispatchDataConverter` and `HostCallbackDataCovnerter` classes for
the `dispatcher()` and `audioMaster()` functions respectively. For operations the `dispatcher()` and `audioMaster()` functions respectively. For operations
involving the plugin editor there is also some extra glue in involving the plugin editor there is also some extra glue in
`PluginBridge::dispatch_wrapper`. On the receiving end of the function calls, `WineBridge::dispatch_wrapper`. On the receiving end of the function calls,
the `passthrough_event()` function calls the callback functions and handles the `passthrough_event()` function calls the callback functions and handles
the marshalling between our data types created by the `*DataConverter` the marshalling between our data types created by the `*DataConverter`
classes and the VST API's different pointer types. This behaviour is classes and the VST API's different pointer types. This behaviour is
+1 -1
View File
@@ -76,8 +76,8 @@ host_sources = [
'src/common/serialization.cpp', 'src/common/serialization.cpp',
'src/wine-host/editor.cpp', 'src/wine-host/editor.cpp',
'src/wine-host/editor.cpp', 'src/wine-host/editor.cpp',
'src/wine-host/plugin-bridge.cpp',
'src/wine-host/vst-host.cpp', 'src/wine-host/vst-host.cpp',
'src/wine-host/wine-bridge.cpp',
'src/wine-host/utils.cpp', 'src/wine-host/utils.cpp',
version_header, version_header,
] ]
+1 -1
View File
@@ -260,7 +260,7 @@ HostBridge::HostBridge(audioMasterCallback host_callback)
try { try {
while (true) { while (true) {
// TODO: Think of a nicer way to structure this and the similar // TODO: Think of a nicer way to structure this and the similar
// handler in `PluginBridge::handle_dispatch_midi_events` // handler in `WineBridge::handle_dispatch_midi_events`
receive_event( receive_event(
vst_host_callback, std::pair<Logger&, bool>(logger, false), vst_host_callback, std::pair<Logger&, bool>(logger, false),
[&](Event& event) { [&](Event& event) {
+1 -1
View File
@@ -87,7 +87,7 @@ class HostBridge {
* Ask the VST plugin to process audio for us. If the plugin somehow does * Ask the VST plugin to process audio for us. If the plugin somehow does
* not support `processReplacing()` and only supports the old `process()` * not support `processReplacing()` and only supports the old `process()`
* function, then this will be handled implicitely in * function, then this will be handled implicitely in
* `PluginBridge::handle_process_replacing()`. * `WineBridge::handle_process_replacing()`.
*/ */
void process_replacing(AEffect* plugin, void process_replacing(AEffect* plugin,
float** inputs, float** inputs,
+2 -2
View File
@@ -20,7 +20,7 @@
#include <src/common/config/config.h> #include <src/common/config/config.h>
#include <src/common/config/version.h> #include <src/common/config/version.h>
#include "plugin-bridge.h" #include "wine-bridge.h"
int main(int argc, char* argv[]) { int main(int argc, char* argv[]) {
// We pass the name of the VST plugin .dll file to load and the Unix domain // We pass the name of the VST plugin .dll file to load and the Unix domain
@@ -47,7 +47,7 @@ int main(int argc, char* argv[]) {
#endif #endif
<< std::endl; << std::endl;
try { try {
PluginBridge bridge(plugin_dll_path, socket_endpoint_path); WineBridge bridge(plugin_dll_path, socket_endpoint_path);
std::cerr << "Finished initializing '" << plugin_dll_path << "'" std::cerr << "Finished initializing '" << plugin_dll_path << "'"
<< std::endl; << std::endl;
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
#include "plugin-bridge.h" #include "wine-bridge.h"
#include <iostream> #include <iostream>
@@ -34,7 +34,7 @@ using VstEntryPoint = AEffect*(VST_CALL_CONV*)(audioMasterCallback);
* This ugly global is needed so we can get the instance of a `Brdige` class * This ugly global is needed so we can get the instance of a `Brdige` class
* from an `AEffect` when it performs a host callback during its initialization. * from an `AEffect` when it performs a host callback during its initialization.
*/ */
PluginBridge* current_bridge_instance = nullptr; WineBridge* current_bridge_instance = nullptr;
intptr_t VST_CALL_CONV intptr_t VST_CALL_CONV
host_callback_proxy(AEffect*, int, int, intptr_t, void*, float); host_callback_proxy(AEffect*, int, int, intptr_t, void*, float);
@@ -47,12 +47,12 @@ uint32_t WINAPI handle_parameters_proxy(void*);
uint32_t WINAPI handle_process_replacing_proxy(void*); uint32_t WINAPI handle_process_replacing_proxy(void*);
/** /**
* Fetch the Pluginbridge instance stored in one of the two pointers reserved * Fetch the WineBridge instance stored in one of the two pointers reserved
* for the host of the hosted VST plugin. This is sadly needed as a workaround * for the host of the hosted VST plugin. This is sadly needed as a workaround
* to avoid using globals since we need free function pointers to interface with * to avoid using globals since we need free function pointers to interface with
* the VST C API. * the VST C API.
*/ */
PluginBridge& get_bridge_instance(const AEffect* plugin) { WineBridge& get_bridge_instance(const AEffect* plugin) {
// This is needed during the initialization of the plugin since we can only // This is needed during the initialization of the plugin since we can only
// add our own pointer after it's done initializing // add our own pointer after it's done initializing
if (current_bridge_instance != nullptr) { if (current_bridge_instance != nullptr) {
@@ -61,10 +61,10 @@ PluginBridge& get_bridge_instance(const AEffect* plugin) {
return *current_bridge_instance; return *current_bridge_instance;
} }
return *static_cast<PluginBridge*>(plugin->ptr1); return *static_cast<WineBridge*>(plugin->ptr1);
} }
PluginBridge::PluginBridge(std::string plugin_dll_path, WineBridge::WineBridge(std::string plugin_dll_path,
std::string socket_endpoint_path) std::string socket_endpoint_path)
: plugin_handle(LoadLibrary(plugin_dll_path.c_str()), FreeLibrary), : plugin_handle(LoadLibrary(plugin_dll_path.c_str()), FreeLibrary),
io_context(), io_context(),
@@ -139,7 +139,7 @@ PluginBridge::PluginBridge(std::string plugin_dll_path,
Win32Thread(handle_process_replacing_proxy, this); Win32Thread(handle_process_replacing_proxy, this);
} }
void PluginBridge::handle_dispatch() { void WineBridge::handle_dispatch() {
using namespace std::placeholders; using namespace std::placeholders;
// For our communication we use simple threads and blocking operations // For our communication we use simple threads and blocking operations
@@ -149,7 +149,7 @@ void PluginBridge::handle_dispatch() {
while (true) { while (true) {
receive_event(host_vst_dispatch, std::nullopt, receive_event(host_vst_dispatch, std::nullopt,
passthrough_event( passthrough_event(
plugin, std::bind(&PluginBridge::dispatch_wrapper, plugin, std::bind(&WineBridge::dispatch_wrapper,
this, _1, _2, _3, _4, _5, _6))); this, _1, _2, _3, _4, _5, _6)));
// Because of the way the Win32 API works we have to process events // Because of the way the Win32 API works we have to process events
@@ -178,7 +178,7 @@ void PluginBridge::handle_dispatch() {
} }
} }
[[noreturn]] void PluginBridge::handle_dispatch_midi_events() { [[noreturn]] void WineBridge::handle_dispatch_midi_events() {
while (true) { while (true) {
receive_event( receive_event(
host_vst_dispatch_midi_events, std::nullopt, [&](Event& event) { host_vst_dispatch_midi_events, std::nullopt, [&](Event& event) {
@@ -219,14 +219,14 @@ void PluginBridge::handle_dispatch() {
// Maybe this should just be a hard error instead, since it // Maybe this should just be a hard error instead, since it
// should never happen // should never happen
return passthrough_event( return passthrough_event(
plugin, std::bind(&PluginBridge::dispatch_wrapper, this, plugin, std::bind(&WineBridge::dispatch_wrapper, this,
_1, _2, _3, _4, _5, _6))(event); _1, _2, _3, _4, _5, _6))(event);
} }
}); });
} }
} }
[[noreturn]] void PluginBridge::handle_parameters() { [[noreturn]] void WineBridge::handle_parameters() {
while (true) { while (true) {
// Both `getParameter` and `setParameter` functions are passed // Both `getParameter` and `setParameter` functions are passed
// through on this socket since they have a lot of overlap. The // through on this socket since they have a lot of overlap. The
@@ -249,7 +249,7 @@ void PluginBridge::handle_dispatch() {
} }
} }
[[noreturn]] void PluginBridge::handle_process_replacing() { [[noreturn]] void WineBridge::handle_process_replacing() {
std::vector<std::vector<float>> output_buffers(plugin->numOutputs); std::vector<std::vector<float>> output_buffers(plugin->numOutputs);
while (true) { while (true) {
@@ -306,7 +306,7 @@ void PluginBridge::handle_dispatch() {
} }
} }
intptr_t PluginBridge::dispatch_wrapper(AEffect* plugin, intptr_t WineBridge::dispatch_wrapper(AEffect* plugin,
int opcode, int opcode,
int index, int index,
intptr_t value, intptr_t value,
@@ -420,7 +420,7 @@ class HostCallbackDataConverter : DefaultDataConverter {
std::optional<VstTimeInfo>& time_info; std::optional<VstTimeInfo>& time_info;
}; };
intptr_t PluginBridge::host_callback(AEffect* effect, intptr_t WineBridge::host_callback(AEffect* effect,
int opcode, int opcode,
int index, int index,
intptr_t value, intptr_t value,
@@ -442,13 +442,13 @@ intptr_t VST_CALL_CONV host_callback_proxy(AEffect* effect,
} }
uint32_t WINAPI handle_dispatch_midi_events_proxy(void* instance) { uint32_t WINAPI handle_dispatch_midi_events_proxy(void* instance) {
static_cast<PluginBridge*>(instance)->handle_dispatch_midi_events(); static_cast<WineBridge*>(instance)->handle_dispatch_midi_events();
} }
uint32_t WINAPI handle_parameters_proxy(void* instance) { uint32_t WINAPI handle_parameters_proxy(void* instance) {
static_cast<PluginBridge*>(instance)->handle_parameters(); static_cast<WineBridge*>(instance)->handle_parameters();
} }
uint32_t WINAPI handle_process_replacing_proxy(void* instance) { uint32_t WINAPI handle_process_replacing_proxy(void* instance) {
static_cast<PluginBridge*>(instance)->handle_process_replacing(); static_cast<WineBridge*>(instance)->handle_process_replacing();
} }
@@ -38,7 +38,7 @@
* Wine VST host. The functions below should be used as callback functions in an * Wine VST host. The functions below should be used as callback functions in an
* `AEffect` object. * `AEffect` object.
*/ */
class PluginBridge { class WineBridge {
public: public:
/** /**
* Initializes the Windows VST plugin and set up communication with the * Initializes the Windows VST plugin and set up communication with the
@@ -52,7 +52,7 @@ class PluginBridge {
* @throw std::runtime_error Thrown when the VST plugin could not be loaded, * @throw std::runtime_error Thrown when the VST plugin could not be loaded,
* or if communication could not be set up. * or if communication could not be set up.
*/ */
PluginBridge(std::string plugin_dll_path, std::string socket_endpoint_path); WineBridge(std::string plugin_dll_path, std::string socket_endpoint_path);
/** /**
* Handle events on the main thread until the plugin quits. This can't be * Handle events on the main thread until the plugin quits. This can't be