Commit Graph

47 Commits

Author SHA1 Message Date
Robbert van der Helm 3dd5859799 Always print version information in plugin hosts
When the plugin host applications are invoked without arguments. Seems a
bit weird when they only print this when invoked with arguments.
2021-09-26 18:20:20 +02:00
Robbert van der Helm c98a9519fe Handle X11 events within the Win32 event loop
This unifies event handling and it allows X11 events to still be
processed even when the event loop is blocked.
2021-07-31 15:19:44 +02:00
Robbert van der Helm d459649f49 Move most of the Meson build to subdirectories
We sadly cannot call `shared_library()` and `executable()` in these
subdirectories while still maintaining the same `build/` directory
structure, but this is still much cleaner. All of the other build
artifacts are now also gone from the root of `build/` so it's cleaner
overall.
2021-07-01 14:57:23 +02:00
Robbert van der Helm da5f6e9e7d Always initialize Microsoft COM unconditionally 2021-06-07 22:24:48 +02:00
Robbert van der Helm a7496fae77 Add thread names 2021-06-06 23:45:47 +02:00
Robbert van der Helm 712ef41a7f Make realtime scheduling less aggressive
On the Wine side. Instead of always having it enabled and disabling it
when it could potentially hurt (i.e. when handling GUI related things),
we'll now only enable it when it's potentially beneficial. This way we
don't have to constantly switch scheduling policies on the GUI thread.
2021-06-01 16:21:38 +02:00
Robbert van der Helm f7901266b7 Use STDERR for all output in the Wine plugin hosts 2021-05-18 13:39:49 +02:00
Robbert van der Helm bbc93d7413 Catch all exceptions during initialization 2021-05-01 18:48:46 +02:00
Robbert van der Helm 56afefeb53 Terminate all threads when initialization fails
With this the watchdog can correctly terminate VST2 bridges that get
stuck during initialization.
2021-05-01 17:58:46 +02:00
Robbert van der Helm 832089d4d1 Implement the Wine host process watchdog
This will shut down a bridge's sockets when the connected native host
process exits, to prevent dangling Wine processes.
2021-05-01 17:54:22 +02:00
Robbert van der Helm 757fb6d372 Pass the PID of the native host to the Wine hosts
We need this for our watchdog.
2021-05-01 17:13:16 +02:00
Robbert van der Helm 6e5ea3a4d8 Skip event loop with partially initialized plugins
This should prevent T-RackS 5 from potentially stalling indefinitely
when using plugin groups.
2021-01-27 19:23:21 +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 2c3312b452 Merge branch 'master' into feature/vst3 2020-12-28 11:51:28 +01:00
Robbert van der Helm ae71536639 Add back __cdecl on older Wine versions 2020-12-28 11:50:08 +01:00
Robbert van der Helm 9c97ebb262 Merge branch 'master' into feature/vst3 2020-12-14 23:21:53 +01:00
Robbert van der Helm 449b17b5e2 Get rid of explicit calling convention on main()
Fixes builds on Wine 6.0, and it's apparently also no longer needed for
Wine 5.9 and up.
2020-12-14 23:20:21 +01:00
Robbert van der Helm 3e13eb9e46 Merge branch 'master' into feature/vst3 2020-12-11 13:02:49 +01:00
Robbert van der Helm 29f1754527 Link to the issue instead of listing issue number 2020-12-11 13:01:45 +01:00
Robbert van der Helm c306048988 Fix hanging processes for good #69 2020-12-11 12:40:50 +01:00
Robbert van der Helm 6e5aa1c1c6 Add the Vst3Bridge boilerplate 2020-12-07 18:28:16 +01:00
Robbert van der Helm 0b462c034e Allow loading VST3 modules
Doesn't actually work yet or do anything, but it compiles and it runs.
2020-12-07 18:28:16 +01:00
Robbert van der Helm 84e13e556c Add #ifdef WITH_VST3 guards around VST3 hosting 2020-12-07 18:28:16 +01:00
Robbert van der Helm 0eb80fe866 Add a general entry point to HostBridge
Since for all plugin types we would need to start listening for incoming
events this way.
2020-12-07 18:28:16 +01:00
Robbert van der Helm 3dd5090023 Support multiple plugin types in individual host 2020-12-07 18:28:16 +01:00
Robbert van der Helm 1c5a9423d2 Print the plugin type on initialization 2020-12-07 18:28:16 +01:00
Robbert van der Helm f9bb3822de Pass plugin type when calling the host application 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 cbf276b7dc Hide all symbols by default
As mentioned by @abique. Could prevent issues caused by symbol clashes,
and it also greatly reduces the size of all binaries.
2020-11-27 20:40:59 +01:00
Robbert van der Helm 09ba0d887b Remove old TODO
MainContext is now basically just a wrapper with a simple event loop
implementation so it's not really necessary, but having a separate type
for the 'main' IO context still makes everything much clearer.
2020-11-10 15:52:35 +01:00
Robbert van der Helm b04e1da0d9 Terminate the Wine host after the sockets close
The Wine host application would not close properly if the VST host would
suddenly crash or terminate without closing all plugins.
2020-11-08 21:49:52 +01:00
Robbert van der Helm bece654c2d Rename PluginContext to MainContext for clarity 2020-10-28 01:02:56 +01:00
Robbert van der Helm a6b5951d81 Replace std::jthread with Win32Thread everywhere 2020-10-27 17:38:13 +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 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
Robbert van der Helm 61cde0bd43 Use std::jthread 2020-06-20 16:16:12 +02:00
Robbert van der Helm f8d7421a8b Remove now unneeded include 2020-05-28 19:29:43 +02:00
Robbert van der Helm 290a85e902 Simplify individual host and Fix memory corruption
Not sure why I made this more complicated than it needed to be to begin
with. And just like in `Vst2Bridge`, we can't reliably run third party
code inside of an `std::thread` so the IO context and initialization has
to be run on the main thread.
2020-05-28 19:26:37 +02:00
Robbert van der Helm 10cc871798 Fix dangling references in last commit 2020-05-28 14:18:16 +02:00
Robbert van der Helm 06de49ded2 Unify event handling behavior for all cases
This makes the individual plugin host slightly more complex, but now
both individually hosted plugins and plugin groups handle both
dispatcher events and GUI events in the exact same way.
2020-05-28 13:53:25 +02:00
Robbert van der Helm 23f15c8d8a Rename the two handle_dispatch functions
To better differentiate between their intended uses.
2020-05-25 15:10:19 +02:00
Robbert van der Helm 8eb01cb519 Listen on the group socket and handle requests 2020-05-20 18:45:33 +02:00
Robbert van der Helm 53acb1f78a Move wine-bridge.h -> bridges/vst2.h
This way we can structure the group handling and a potential future VST3
bridge in the same way.
2020-05-18 16:15:07 +02:00
Robbert van der Helm 994f3c9e38 Add a plugin group host application 2020-05-18 16:15:07 +02:00
Robbert van der Helm 95e716d229 Rename vst-host.cpp -> individual-host.cpp 2020-05-17 14:43:21 +02:00