Commit Graph

27 Commits

Author SHA1 Message Date
Robbert van der Helm 8873c11e1d Move watchdog timer disable check to common/utils
We may also want to check this from the plugin.
2021-06-22 17:15:47 +02:00
Robbert van der Helm c2b8626ec5 Rearrange declarations to match implementations 2021-06-22 17:15:47 +02:00
Robbert van der Helm 7c9cd7b9e5 Fix uninitialized timed caches
This could prevent resizeable plugins from being resizeable in Ardour if
the initialized timestamp just happened to be greater than the current
time, since the returned result would then likely be some invalid value.
2021-06-09 12:31:03 +02:00
Robbert van der Helm 0d3850e837 Add a function for fetching the RTTIME limit
We can use this to more easily diagnose issues caused by PipeWire.
2021-05-27 13:58:19 +02:00
Robbert van der Helm 6c58f4e305 Fix the return type constraint
Apparently T is only convertible to T if it can be copy constructed.
2021-05-20 00:10:00 +02:00
Robbert van der Helm 35cc47d021 Add a concept for invocables with a return type
Because for some reason this is not part of the standard library.
2021-05-19 23:30:42 +02:00
Robbert van der Helm 59ba2aeb5f Add noexcept qualifications in src/common
Apparently this can actually make a difference in some cases, and the
C++ Core Guideliens recommend doing this on all default constructors,
destructors, and all functions that can not throw (and thus also don't
allocate).
2021-05-14 17:12:24 +02:00
Robbert van der Helm 22d74e8b70 Add a helper for temporarily caching a value 2021-05-05 19:38:46 +02:00
Robbert van der Helm 071bb157ad Move the pid_running() function to common utils
We're going to need this for our watchdog.
2021-05-01 17:08:47 +02:00
Robbert van der Helm 167784f93b Prevent unnecessary copies in ScopedValueCache 2021-05-01 16:28:14 +02:00
Robbert van der Helm 22f94dd22f Prevent unnecessary copies in ScopedValueCache 2021-04-29 02:58:05 +02:00
Robbert van der Helm dee964ec89 Add a helper for scope-bound caching of values 2021-04-29 00:31:11 +02:00
Robbert van der Helm 160c6acb85 Properly handle move semantics in the scoped FTZ 2021-04-28 12:55:58 +02:00
Robbert van der Helm 2be41da9b6 Add compatibility option to force flushing to zero
This prevents Kush Audio REDDI from taking down the DAW when the host
passes it denormalized audio to process. I've discovered that the issue
with this plugin had to do with denormals in the issue linked below, but
I didn't realize that we can just enable the FTZ flag for plugins that
don't already do so.

https://github.com/osxmidi/LinVst/issues/174
2021-04-27 23:33:50 +02:00
Robbert van der Helm 3aac8e3483 Add a RAII wrapper for enabling flush-to-zero 2021-04-27 23:00:41 +02:00
Robbert van der Helm ab56115c87 Add Bitwig+Chromaphone 3 as a hide_daw candidate
Under Bitwig, the plugin will crash when trying to enter text unless you
hide the DAW the plugin is being hosted under.
2021-04-27 18:57:09 +02:00
Robbert van der Helm 3a73fb9689 Allow hiding the DAW name for VST2 plugins
This can be useful when plugins have (broken) host-specific behaviour
that you want to avoid. I'll later add a list of host/plugin
combinations where this may be useful to the readme.
2021-04-27 18:41:36 +02:00
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