mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-06 19:40:10 +02:00
Connect to the unix socket from the Wine VST host
This commit is contained in:
+3
-1
@@ -23,6 +23,8 @@ endif
|
|||||||
boost_dep = dependency('boost', modules : ['filesystem'])
|
boost_dep = dependency('boost', modules : ['filesystem'])
|
||||||
msgpack_dep = dependency('msgpack')
|
msgpack_dep = dependency('msgpack')
|
||||||
threads_dep = dependency('threads')
|
threads_dep = dependency('threads')
|
||||||
|
# The built in threads dependency does not know how to handle winegcc
|
||||||
|
wine_threads_dep = declare_dependency(link_args : '-lpthread')
|
||||||
|
|
||||||
include_dir = include_directories('src/include')
|
include_dir = include_directories('src/include')
|
||||||
|
|
||||||
@@ -45,6 +47,6 @@ executable(
|
|||||||
],
|
],
|
||||||
native : false,
|
native : false,
|
||||||
include_directories : include_dir,
|
include_directories : include_dir,
|
||||||
dependencies : [msgpack_dep],
|
dependencies : [boost_dep, msgpack_dep, wine_threads_dep],
|
||||||
link_args : []
|
link_args : []
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ bp::environment set_wineprefix();
|
|||||||
Bridge::Bridge()
|
Bridge::Bridge()
|
||||||
: io_context(),
|
: io_context(),
|
||||||
socket_endpoint(generate_endpoint_name().string()),
|
socket_endpoint(generate_endpoint_name().string()),
|
||||||
|
socket_acceptor(io_context, socket_endpoint),
|
||||||
host_vst_dispatch(io_context),
|
host_vst_dispatch(io_context),
|
||||||
vst_stdin(),
|
vst_stdin(),
|
||||||
vst_stdout(),
|
vst_stdout(),
|
||||||
@@ -66,12 +67,9 @@ Bridge::Bridge()
|
|||||||
bp::std_in = vst_stdin,
|
bp::std_in = vst_stdin,
|
||||||
bp::std_out = vst_stdout,
|
bp::std_out = vst_stdout,
|
||||||
bp::env = set_wineprefix()) {
|
bp::env = set_wineprefix()) {
|
||||||
boost::asio::local::stream_protocol::acceptor acceptor(io_context,
|
|
||||||
socket_endpoint);
|
|
||||||
|
|
||||||
// It's very important that these sockets are connected to in the same order
|
// It's very important that these sockets are connected to in the same order
|
||||||
// in the Wine VST host
|
// in the Wine VST host
|
||||||
acceptor.accept(host_vst_dispatch);
|
socket_acceptor.accept(host_vst_dispatch);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -187,7 +185,8 @@ fs::path find_vst_plugin() {
|
|||||||
"VST plugin .dll file.");
|
"VST plugin .dll file.");
|
||||||
}
|
}
|
||||||
|
|
||||||
return plugin_path;
|
// Also resolve symlinks here, mostly for development purposes
|
||||||
|
return fs::canonical(plugin_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ class Bridge {
|
|||||||
private:
|
private:
|
||||||
boost::asio::io_context io_context;
|
boost::asio::io_context io_context;
|
||||||
boost::asio::local::stream_protocol::endpoint socket_endpoint;
|
boost::asio::local::stream_protocol::endpoint socket_endpoint;
|
||||||
|
boost::asio::local::stream_protocol::acceptor socket_acceptor;
|
||||||
|
|
||||||
// The naming convention for these sockets is `<from>_<to>_<event>`. For
|
// The naming convention for these sockets is `<from>_<to>_<event>`. For
|
||||||
// instance the socket named `host_vst_dispatch` forwards
|
// instance the socket named `host_vst_dispatch` forwards
|
||||||
|
|||||||
@@ -34,6 +34,8 @@
|
|||||||
#undef __WIN32__
|
#undef __WIN32__
|
||||||
#undef _WIN64
|
#undef _WIN64
|
||||||
|
|
||||||
|
#include <boost/asio/io_context.hpp>
|
||||||
|
#include <boost/asio/local/stream_protocol.hpp>
|
||||||
#include <msgpack.hpp>
|
#include <msgpack.hpp>
|
||||||
|
|
||||||
#pragma pop_macro("WIN32")
|
#pragma pop_macro("WIN32")
|
||||||
|
|||||||
@@ -65,7 +65,23 @@ int main(int argc, char* argv[]) {
|
|||||||
|
|
||||||
std::string plugin_title(buffer.data());
|
std::string plugin_title(buffer.data());
|
||||||
|
|
||||||
// TODO: The program should terminate automatically when stdin gets closed
|
// Connect to the sockets for communication once the plugin has finished
|
||||||
|
// loading
|
||||||
|
// TODO: The program should terminate gracefully when one of the sockets
|
||||||
|
// gets closed
|
||||||
|
// TODO: Remove debug and move most of these things to
|
||||||
|
// `wine-host/bridge.cpp`, similar to `plugin/bridge.cpp`
|
||||||
|
|
||||||
|
boost::asio::io_context io_context;
|
||||||
|
boost::asio::local::stream_protocol::endpoint socket_endpoint(
|
||||||
|
socket_endpoint_path);
|
||||||
|
|
||||||
|
// The naming convention for these sockets is `<from>_<to>_<event>`. For
|
||||||
|
// instance the socket named `host_vst_dispatch` forwards
|
||||||
|
// `AEffect.dispatch()` calls from the native VST host to the Windows VST
|
||||||
|
// plugin (through the Wine VST host).
|
||||||
|
boost::asio::local::stream_protocol::socket host_vst_dispatch(io_context);
|
||||||
|
host_vst_dispatch.connect(socket_endpoint);
|
||||||
|
|
||||||
// TODO: Remove debug, we're just reporting the plugin's name we retrieved
|
// TODO: Remove debug, we're just reporting the plugin's name we retrieved
|
||||||
// above
|
// above
|
||||||
|
|||||||
Reference in New Issue
Block a user