Commit Graph

10 Commits

Author SHA1 Message Date
Robbert van der Helm 6746b2b924 Add missing <optional> include for GCC 11 2021-04-14 17:09:43 +02:00
Robbert van der Helm d5e4424463 Also sync VST3 audio thread scheduling priorities
The exact same thing as the last commit, but for VST3 plugins.
2021-01-23 15:22:10 +01:00
Robbert van der Helm f03b9b1497 Sync VST2 audio thread scheduling priorities
We'll periodically copy the scheduling priorities from the host's audio
threads to the Wine plugin host's audio threads. The overhead of doing
this is about 1 microsecond on my system, so doing this every cycle
really adds up. But getting the Unix epoch time and comparing some
timestamps has a neglegible overhead, so this should give you the best
of both worlds.

Next we'll do the same thing for VST3 plugins.

As suggested by @jhernberg
2021-01-23 15:14:52 +01:00
Robbert van der Helm 33dd469d36 Allow setting different priorities than 5 2021-01-23 14:24:01 +01:00
Robbert van der Helm 4812757f1a Add a function for getting the current priority 2021-01-22 00:44:43 +01:00
Robbert van der Helm e3ea1dd2fe Allow an option set_realtime_priority() to revert 2021-01-11 14:04:54 +01:00
Robbert van der Helm 34f8d3b1d2 Update the copyright notices for 2021 2021-01-01 18:54:02 +01:00
Robbert van der Helm c1e7f53cd0 💥 Major refactor of initialization plumbing
To account for the differences in VST2 plugins and VST3 modules we had
to wrap most of our old functions from `src/plugin/utils.h` in a new
`PluginInfo` struct that gathers all of this information while taking
into account the differences between VST2 and VST3 plugins.

With this change things are also a lot more organized. We can just query
the plugin information we need rather than having to store things
separately or having to recalculate things. This also moved the
responsibility of all the weird `WINEPREFIX` behaviour to a single place
instead of having it spread around `utils.pp`, the initialisation
message, and `host-procoess.cpp`.
2020-12-07 18:28:16 +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 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