Rename both Bridge classes to differentiate

Switching between them became a bit confusing.
This commit is contained in:
Robbert van der Helm
2020-03-01 01:17:15 +01:00
parent 5ace761ce9
commit cb6ad5f043
7 changed files with 63 additions and 46 deletions
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
#include "bridge.h"
#include "host-bridge.h"
#include <boost/dll/runtime_symbol_info.hpp>
#include <boost/filesystem.hpp>
@@ -51,7 +51,7 @@ bp::environment set_wineprefix();
// TODO: When adding debug information, print both the path to the VST host and
// the chosen wineprefix
Bridge::Bridge(AEffect* plugin, audioMasterCallback host_callback)
HostBridge::HostBridge(AEffect* plugin, audioMasterCallback host_callback)
: io_context(),
socket_endpoint(generate_endpoint_name().string()),
socket_acceptor(io_context, socket_endpoint),
@@ -78,12 +78,12 @@ Bridge::Bridge(AEffect* plugin, audioMasterCallback host_callback)
* Handle an event sent by the VST host. Most of these opcodes will be passed
* through to the winelib VST host.
*/
intptr_t Bridge::dispatch(AEffect* /*plugin*/,
int32_t opcode,
int32_t index,
intptr_t value,
void* data,
float option) {
intptr_t HostBridge::dispatch(AEffect* /*plugin*/,
int32_t opcode,
int32_t index,
intptr_t value,
void* data,
float option) {
// Some events need some extra handling
// TODO: Handle other things such as GUI itneraction
switch (opcode) {
@@ -106,20 +106,20 @@ intptr_t Bridge::dispatch(AEffect* /*plugin*/,
return send_event(host_vst_dispatch, opcode, index, value, data, option);
}
void Bridge::process(AEffect* /*plugin*/,
float** /*inputs*/,
float** /*outputs*/,
int32_t /*sample_frames*/) {
void HostBridge::process(AEffect* /*plugin*/,
float** /*inputs*/,
float** /*outputs*/,
int32_t /*sample_frames*/) {
// TODO: Unimplmemented
}
void Bridge::set_parameter(AEffect* /*plugin*/,
int32_t /*index*/,
float /*value*/) {
void HostBridge::set_parameter(AEffect* /*plugin*/,
int32_t /*index*/,
float /*value*/) {
// TODO: Unimplmemented
}
float Bridge::get_parameter(AEffect* /*plugin*/, int32_t /*index*/
float HostBridge::get_parameter(AEffect* /*plugin*/, int32_t /*index*/
) {
// TODO: Unimplmemented
return 0.0f;
@@ -223,7 +223,7 @@ fs::path generate_endpoint_name() {
// TODO: Replace blocking loop with async readers or threads for all of the
// sockets. Also extract this functionality somewhere since the host event
// callback needs to do exactly the same thing.
void Bridge::host_callback_loop(AEffect* plugin) {
void HostBridge::host_callback_loop(AEffect* plugin) {
while (true) {
passthrough_event(vst_host_callback, plugin, host_callback_function);
}
@@ -29,7 +29,7 @@
* Wine VST host. The functions below should be used as callback functions in an
* `AEffect` object.
*/
class Bridge {
class HostBridge {
public:
/**
* Initializes the Wine VST bridge. This sets up the sockets for event
@@ -45,7 +45,7 @@ class Bridge {
* if it could not locate and load a VST .dll file.
*/
// TODO: The plugin struct should be created here, not passed in
Bridge(AEffect* plugin, audioMasterCallback host_callback);
HostBridge(AEffect* plugin, audioMasterCallback host_callback);
// The four below functions are the handlers from the VST2 API. They are
// called through proxy functions in `plugin.cpp`.
+4 -4
View File
@@ -19,7 +19,7 @@
#include <iostream>
#include <memory>
#include "bridge.h"
#include "host-bridge.h"
#define VST_EXPORT __attribute__((visibility("default")))
@@ -48,8 +48,8 @@ float getParameter_proxy(AEffect*, int32_t);
* is sadly needed as a workaround to avoid using globals since we need free
* function pointers to interface with the VST C API.
*/
Bridge& get_bridge_instance(const AEffect& plugin) {
return *static_cast<Bridge*>(plugin.ptr3);
HostBridge& get_bridge_instance(const AEffect& plugin) {
return *static_cast<HostBridge*>(plugin.ptr3);
}
/**
@@ -67,7 +67,7 @@ VST_EXPORT AEffect* VSTPluginMain(audioMasterCallback host_callback) {
// parameters. We can then also use a smart pointer so we only
// have to manually delete the bridge instance.
AEffect* plugin = new AEffect();
Bridge* bridge = new Bridge(plugin, host_callback);
HostBridge* bridge = new HostBridge(plugin, host_callback);
plugin->ptr3 = bridge;
plugin->dispatcher = dispatch_proxy;