Commit Graph

801 Commits

Author SHA1 Message Date
Robbert van der Helm 28fe0ecd60 Add [[maybe_unused]] to our constexpr constants 2020-12-07 18:28:16 +01:00
Robbert van der Helm 9c8b543d5d Split serialization.h into common and VST2 parts 2020-12-07 18:28:16 +01:00
Robbert van der Helm 4291083a46 Rename PluginBridge to Vst2PluginBridge 2020-12-07 18:28:16 +01:00
Robbert van der Helm 9d40e04a62 Update all references to libyabridge.so 2020-12-07 18:28:16 +01:00
Robbert van der Helm 84d00b568b Add a more distinct wrapper around chunk data 2020-12-07 02:43:23 +01:00
Robbert van der Helm 7f7da50282 Log processing cycles on verbosity level 2 2020-12-07 02:08:03 +01:00
Robbert van der Helm 23d5567e72 Add a time info caching compatibility option #62
This is needed to get good performance out of SWAM Cello until this
issue is fixed by the plugin.
2020-11-30 14:49:02 +01:00
Robbert van der Helm f0b4232239 Add more debug printing for audioMasterGetTime() 2020-11-23 16:38:46 +01:00
Robbert van der Helm ed5f0c42d9 Fix off-by-one error in speaker arrangement read
This is why you don't do pointer arithmetic. Fixes an error message in
Renoise when trying to load a plugin as an effect.
2020-11-14 19:37:04 +01:00
Robbert van der Helm 5486d91201 Fix style 2020-11-07 23:17:00 +01:00
Robbert van der Helm a0c0a86e2c Drop the separate effProcessEvents socket
Now that event handling is fully concurrent and thus no longer gets
blocked by the Win32 message loop.
2020-11-07 20:54:33 +01:00
Robbert van der Helm 5087b49cc4 Simplify EventHandler::receive_events 2020-11-06 17:49:16 +01:00
Robbert van der Helm 1c7e866609 No longer return a lambda in passthrough_event()
Now that it's no longer used directly this is no longer needed, and it's
much clearer without the lambda.
2020-11-06 17:17:36 +01:00
Robbert van der Helm c285ba0bd2 Mention passthrough_event() in Event*Payload 2020-11-06 17:02:13 +01:00
Robbert van der Helm ba6381e3ae Rename EventHandler::{send,receive} to *_event(s?)
Since it does something way more involved than
`SocketHandler::{send,receive_multi}`, and that makes it a bit confusing
if you don't already know about that (and even if you do).
2020-11-01 12:01:50 +01:00
Robbert van der Helm fa01ac843b Replace all non-group sockets with SocketHandler
This greatly reduces the amount of boilerplate and potential for error.
2020-10-30 13:30:08 +01:00
Robbert van der Helm 42792a883d Add EventHandler-like wrapper for simple sockets
This will greatly reduce boilerplate.
2020-10-30 12:58:31 +01:00
Robbert van der Helm 3788c1226b Take buffers by reference in {read,write}_object()
This was how it originally worked (and how it should work, since
otherwise there's no reason to reuse buffers), but for some reason this
got removed at some point.
2020-10-30 12:52:02 +01:00
Robbert van der Helm 9633a70745 Use 'concurrent' instead of 'asynchronous'
While asynchronous is technically also correct, this makes it a bit
clearer what's going on.
2020-10-29 20:49:46 +01:00
Robbert van der Helm 93e01dacef Explicitly close all sockets on shutdown
This way we're sure to break out of any blocking loops.
2020-10-28 20:38:01 +01:00
Robbert van der Helm 28886e7073 Replace all threads with Win32Thread in Wine host 2020-10-27 18:29:38 +01:00
Robbert van der Helm e51c7f7ae3 Get rid of hack_reaper_update_display
It is now no longer necessary.
2020-10-27 11:13:39 +01:00
Robbert van der Helm 5b00ddb0c4 Fall back to waiting when socket is not yet ready
This can happen with plugin groups.
2020-10-27 11:13:39 +01:00
Robbert van der Helm e12a56978d Reintroduce the additional IO contexts
Having these bound to the main context was not a good idea since that
would prevent sockets from being accepted on the Wine side while the
message loop is running.

Partial revert of ac17539ef3
2020-10-26 20:39:16 +01:00
Robbert van der Helm ca2b95e7aa Handle dispatch() directly during event handling
When the message loop is active and we get an incoming dispatch() event,
we'll just handle it directly. In practice this would only be needed
when the event is a response to an `audioMaster()` call made during the
event loop, but we can't know that. This allows the `getProgram()`
during `audioMasterUpdateDisplay()` in REAPER and Renoise to work
correctly. Hopefully this doesn't cause random rare breakage.
2020-10-26 20:03:54 +01:00
Robbert van der Helm c95e8aa63c Add a TODO for removing hack_reaper_update_display 2020-10-26 18:00:24 +01:00
Robbert van der Helm e067bbbfbc Don't stop the whole IO context
This would break plugin groups since the different plugins share a
single IO context.
2020-10-26 17:44:34 +01:00
Robbert van der Helm ac17539ef3 Drop all additional IO contexts
Not really needed (since the only other thing happening in the IO
context is processing stdio from the Wine process) and it was causing
some impossible to debug malloc failures in Boost.Asio.
2020-10-26 17:32:37 +01:00
Robbert van der Helm cde7b4ec67 Properly move the sockets to the handler threads
At times like this you really wish you were writing Rust right now.
2020-10-26 15:48:57 +01:00
Robbert van der Helm 8d7826f1df Handle incoming events from off-threads separately
On the Wine side we want to handle most events on the main UI thread.
We'll assume any events coming in from a secondary socket are safe and
can be handled directly.
2020-10-26 13:45:37 +01:00
Robbert van der Helm 81efa6febe Listen for incoming secondary event requests 2020-10-26 12:58:03 +01:00
Robbert van der Helm 2f6883977f Create secondary sockets for sending nested events 2020-10-26 12:13:27 +01:00
Robbert van der Helm d82f8463d9 Use simple numerical IDs for plugins in groups
We'll be using a similar approach to identify threads for event
handlers.
2020-10-26 11:51:13 +01:00
Robbert van der Helm 74c3cab046 Move event handling logic to a dedicated class
Now all pieces are in place to allow handling events over multiple
socket connections.
2020-10-26 11:40:38 +01:00
Robbert van der Helm 54ed69c408 Merge events.h into communication.h 2020-10-25 21:37:04 +01:00
Robbert van der Helm 4b53342514 💥 Encapsulate and rework all socket logic
This is a pretty huge change that will be important for being able to
handle nested or mutually recursive `dispatch()` and `audioMaster()`
calls. This sadly all had to be done in a single commit, so here's a
summary:

- `src/common/sockets.h:Sockets` contains all sockets on both the plugin
  and the Wine host side, and is used to both listen on and connect to
  the sockets.
- Sockets and other temporary files respect `$XDG_RUNTIME_DIR` instead
  of being dumped in `/tmp`.
- All sockets now have a unique endpoint in
  `/run/user/<uid>/yabridge-<plugin_name>-<random_id>/`. This is
  important for when we want to have multiple socket connections for
  handling `dispatch()` and `audioMaster()`.
- Because of the above, we no longer clean up the socket endpoint files
  after the connection gets established during initialization. Instead
  we'll remove the socket base directory when shutting down.
2020-10-25 21:24:56 +01:00
Robbert van der Helm a1162c2256 Print invalid and unknown options on startup 2020-10-13 15:04:33 +02:00
Robbert van der Helm 7fbbb48c54 Fix parsing order of yabridge.toml #37
Since tomlplusplus uses `std::map` instead of `std::unordered_map`
internally the tables were actually being read in lexicographical order.
2020-09-27 19:42:07 +02:00
Robbert van der Helm f1b1f20fdb Update tomlplusplus 2020-09-27 17:48:43 +02:00
Robbert van der Helm 504102ef79 Increase the maximum number of audio channels #35
Not sure why it's doing this, but Renoise seems to report 112 speakers
per audio channel, so the 256 audio channel limit would be exceeded when
using more than 2 output channels.
2020-08-31 23:42:24 +02:00
Robbert van der Helm 8198a73742 Add support for double precision audio #34
So far I've only seen REAPER running iZotope Rx plugins utilize this.
2020-08-24 16:13:29 +02:00
Robbert van der Helm b452f961db Add option to work around bugs in REAPER/Renoise
This is not ideal since it requires the user to know about this option
and to create a config file, but I think it's the best we can do without
compromising on yabridge's transparency and 'zero hacks' philosophy.

See #29 and #32.
2020-08-17 15:49:16 +02:00
Robbert van der Helm c64fdb21d7 Don't print calls to effIdle with debug level 1
REAPER seems to be the only DAW that uses this.
2020-08-11 15:26:11 +02:00
Robbert van der Helm e3282df7cd Lower the realtime priority to 5
JACK runs with priority 10 by default, so that should probably be
getting priority here.
2020-07-24 23:27:37 +02:00
Robbert van der Helm 6f5dae90a6 Set realtime priorities if available
This significantly reduces the latency with no real drawbacks from what
I've noticed. Wineserver is still run using the normal scheduling
policies because from my testing running that with realtime priority
that can actually increase latencies, although doing so will greatly
reduce the variance in processing time.
2020-07-23 19:57:50 +02:00
Robbert van der Helm 967856fc1b Add a configuration option for double embedding
Only plugin that needs this so far is PSPaudioware's E27 (and likely
other PSP plugins with expandable GUIs).
2020-07-23 15:59:00 +02:00
Robbert van der Helm 523f77d334 Use designated initializers for complex structs
This was one of the main reasons why I wanted to switch to C++20, I just
forgot to do it.
2020-07-23 14:12:07 +02:00
Robbert van der Helm 44044324f3 Add serialization support for plugin configuration 2020-07-22 17:05:24 +02:00
Robbert van der Helm 479852a4d0 Add a bitsery extension for serializing paths 2020-07-22 17:05:05 +02:00
Robbert van der Helm 2e77c03464 Move the configuration object to src/common/ 2020-07-22 13:55:29 +02:00