Commit Graph

43 Commits

Author SHA1 Message Date
Robbert van der Helm 987ce8f204 Rename asio-fix.h to use-linux-asio.h
Bit of an ugly verbose name but it probably makes it much clearer why
the include is needed.
2022-10-26 17:10:18 +02:00
Robbert van der Helm 1fec4c8860 Change the description in the GPL header 2022-04-16 20:37:10 +02:00
Robbert van der Helm 037d6ad5aa Replace Boost.Process for the Wine plugin host
Now we use our own library for this, so we can drop the Boost.Filesystem
dependency after a couple more changes.
2022-04-16 20:37:10 +02:00
Robbert van der Helm 556b0e38f9 Replace Boost.Asio with standalone Asio library
We had to add an even hackier hack now to get Boost.Process to
interoperate with Asio's IO contexts. This will be replaced later when
we replace Boost.Process.
2022-04-14 23:42:12 +02:00
Robbert van der Helm d2d4cf4ea9 Replace most uses of Boost.{Filesystem,Process}
With the `ghc::filesystem` dependency from the previous commit. If we
can replace the rest of the Boost.Filesystem dependency then we can get
rid the one nasty runtime dependency we have, and it will make
implementing the chainloading simpler since can reuse more code without
bringing in Boost.
2022-04-14 23:42:12 +02:00
Robbert van der Helm 0b9a16cf40 Change the naming scheme for class field members
I'm not a fan of Hungarian notation, but C++ kind of needs it with its
implicit `this`. And of all the common options for this, I find
suffixing members with an underscore the least offensive one.
2022-01-01 21:07:17 +01:00
Robbert van der Helm e0ab24e645 Update copyright headers
Happy new year!
2022-01-01 18:32:10 +01:00
Robbert van der Helm 4e4bbe1ba4 Replace const-rvalue with rvalue
Since const-rvalue doesn't make any sense.
2021-07-05 16:39:11 +02:00
Robbert van der Helm a9643577fd Also add noexcept qualifications on the Wine side
See the last few commits.
2021-05-14 18:27:19 +02:00
Robbert van der Helm 4ff538c7e1 Let group hosts shut down on their own if unused
We would never try to shut the group host down if nothing ever tried to
connect to it. This could happen when the native host gets killed after
initializing the yabridge plugin but before it gets the chance to
request the group host process to host a plugin.
2021-05-01 18:38:18 +02:00
Robbert van der Helm a1bb522ea0 Move piping stream lines to the log to common 2021-02-12 18:35:07 +01: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 34f8d3b1d2 Update the copyright notices for 2021 2021-01-01 18:54:02 +01:00
Robbert van der Helm a724b378fe Move the editor handling back to Vst2Bridge
Since we can have multiple editors in Vst3Bridge.
2020-12-19 19:56:49 +01:00
Robbert van der Helm 0214221c3a Rename handle_plugin_dispatch to *_run
Since run() is now the general `HostBridge()` function to listen for
incoming events.
2020-12-12 13:34:30 +01:00
Robbert van der Helm 4f8fe21fa9 Merge branch 'master' into feature/vst3 2020-12-12 13:33:36 +01:00
Robbert van der Helm 712736e74a Prevent a deadlock in plugin group handling
This was a nasty race condition that only seemed to pop up with Spitfire
plugins in REAPER, but it could also happen elsewhere. The
`active_plugins_mutex` was getting locked from the message loop, but the
plugin would block until `effOpen()` had been called. But because the
mutex was locked by the message loop we would never get to handling
`effOpen()`. Passing the pointer directly both removes this unnecessary
locking and fixes the issue.
2020-12-12 12:44:01 +01:00
Robbert van der Helm 41b79720ca Merge branch 'master' into feature/vst3 2020-12-11 00:50:43 +01:00
Robbert van der Helm ac0d83e555 Fix concurrency issue in plugin group shutdown 2020-12-10 21:41:04 +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 3db099e0fc Also make the GroupHost plugin type agnostic 2020-12-07 18:28:16 +01:00
Robbert van der Helm d2500ff31d Get rid of message loop skipping and EditorOpening
This special behaviour is no longer needed now that event handling is
fully concurrent and the Win32 message loop no longer blocks
`dispatch()` calls.
2020-11-07 22:06:58 +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 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 1e6188d774 Check the return value from pipe(2)
Starting from GCC 10 not checking this will produce a warning.
2020-06-20 18:43:36 +02:00
Robbert van der Helm 61cde0bd43 Use std::jthread 2020-06-20 16:16:12 +02:00
Robbert van der Helm 8202a6b250 Add missing const qualifiers to member functions 2020-06-06 13:44:26 +02:00
Robbert van der Helm b379708b21 Encapsulate individual/group handling differences
This cleans up the PluginBridge significantly by getting rid of all
fields and handling that was only needed for connecting to plugin
groups. This was also the last thing I wanted to refactor before
releasing the plugin groups feature with yabridge 1.2.
2020-05-29 18:08:44 +02:00
Robbert van der Helm 2a31a60266 Get rid of the ugly Win32 threads in group host
Running the audio processing and midi dispatcher loops in a regular
`std::thread` causes weird memory corruption issues (likely because of
calling conventions are not being respected). Luckily this does not
cause any issues here, so we can get rid of a lot of ugly glue code and
manual memory management.
2020-05-28 16:27:30 +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 198807a15a Run events async and centralized for group hosts
At a 30 fps rate with a limit on the number of window messages per
frame. This is somehow needed for Melda plugins, as they otherwise
dispatch tiemr messages indefinitely after opening a second editor with
seemingly no way around it.

With this and some refactoring #15 should be almost done.
2020-05-26 12:13:37 +02:00
Robbert van der Helm 16fce5577d Skip the message loop when an editor is opening
This is a bit more restrictive than the old approach that only skipped
when `effEditOpen()` got called after `effEditGetRect()`. Not sure why
the Melda plugins block indefinitely on the message loop without this
now.
2020-05-26 11:12:36 +02:00
Robbert van der Helm 064bb2684f Init plugins and handle events on the main thread
Within the plugin IO context.
2020-05-25 15:19:46 +02:00
Robbert van der Helm bbfe522343 Use a seperate thread for STDIO capture for groups
When running the plugins on the main thread the window message loop may
block for a while, which would cause the STDIO redirect to be
interrupted.
2020-05-25 15:15:32 +02:00
Robbert van der Helm f50d04ce04 Defer group host shutdown
This allows for a significant speedup in plugin scanning time for plugin
groups, since starting Wine processes takes up pretty much the entirety
of the time spent scanning plugins.
2020-05-23 13:54:40 +02:00
Robbert van der Helm 9fb7f1fc03 Add handling for stale and active group sockets 2020-05-22 19:06:43 +02:00
Robbert van der Helm dd843519ce Rename PluginParameters to GroupReuqest 2020-05-22 19:06:43 +02:00
Robbert van der Helm 8c22f37f29 Actually host plugins in the group process 2020-05-21 17:12:55 +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 6d6d928838 Move all plugin group handling boilerplate 2020-05-19 15:29:48 +02:00
Robbert van der Helm 8bd1dc8c50 Encapsulate the STDOUT/STDERR capturing 2020-05-18 16:15:07 +02:00