mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-17 14:10:02 +02:00
Allow disabling ad-hoc socket spawning
We'll need this for handling `IAudioProcessor` method calls in VST3. We basically want a `Vst3MessageHandler` per `IAudioProcessor` instance, but without the additional socket spawning or extra thread.
This commit is contained in:
@@ -38,9 +38,14 @@
|
||||
* @tparam Thread The thread implementation to use. On the Linux side this
|
||||
* should be `std::jthread` and on the Wine side this should be `Win32Thread`.
|
||||
* @tparam Request Either `ControlRequest` or `CallbackRequest`.
|
||||
* @tparam ad_hoc_sockets Whether new sockets should be created on demand to be
|
||||
* able to handle multiple function calls at the same time. If this is set to
|
||||
* false, then simultaneous `send_message()` calls will have to wait for the
|
||||
* earlier call to finish. This also means that the listening side does not
|
||||
* have to spawn a thread to constantly listen for new connections.
|
||||
*/
|
||||
template <typename Thread, typename Request>
|
||||
class Vst3MessageHandler : public AdHocSocketHandler<Thread> {
|
||||
template <typename Thread, typename Request, bool ad_hoc_sockets>
|
||||
class Vst3MessageHandler : public AdHocSocketHandler<Thread, ad_hoc_sockets> {
|
||||
public:
|
||||
/**
|
||||
* Sets up a single main socket for this type of events. The sockets won't
|
||||
@@ -59,7 +64,9 @@ class Vst3MessageHandler : public AdHocSocketHandler<Thread> {
|
||||
Vst3MessageHandler(boost::asio::io_context& io_context,
|
||||
boost::asio::local::stream_protocol::endpoint endpoint,
|
||||
bool listen)
|
||||
: AdHocSocketHandler<Thread>(io_context, endpoint, listen) {}
|
||||
: AdHocSocketHandler<Thread, ad_hoc_sockets>(io_context,
|
||||
endpoint,
|
||||
listen) {}
|
||||
|
||||
/**
|
||||
* Serialize and send an event over a socket and return the appropriate
|
||||
@@ -272,12 +279,12 @@ class Vst3Sockets : public Sockets {
|
||||
* This will be listened on by the Wine plugin host when it calls
|
||||
* `receive_multi()`.
|
||||
*/
|
||||
Vst3MessageHandler<Thread, ControlRequest> host_vst_control;
|
||||
Vst3MessageHandler<Thread, ControlRequest, true> host_vst_control;
|
||||
|
||||
/**
|
||||
* For sending callbacks from the plugin back to the host. After we have a
|
||||
* better idea of what our communication model looks like we'll probably
|
||||
* want to provide an abstraction similar to `EventHandler`.
|
||||
*/
|
||||
Vst3MessageHandler<Thread, CallbackRequest> vst_host_callback;
|
||||
Vst3MessageHandler<Thread, CallbackRequest, true> vst_host_callback;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user