Commit Graph

497 Commits

Author SHA1 Message Date
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 16aa1af14e Don't check for child termination with winedbg
This of course can't work since the process is spawned in a detached
state.
2020-05-28 19:00:10 +02:00
Robbert van der Helm 000438c59d Mention plugin groups in the readme's introduction 2020-05-28 17:24:32 +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 00bcdf8fca Add a RAII wrapper around SetTimer() 2020-05-28 15:27:45 +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 f32ef61fde Link to plugin groups section further in readme
As it may not immediately be obvious what this is for when just scanning
through the readme.
2020-05-27 17:17:09 +02:00
Robbert van der Helm effca96ead Correct capitalization on FabFilter 2020-05-27 17:12:48 +02:00
Robbert van der Helm c7976e8802 Update installation instructions for plugin groups
Since there are now also 64 and 32 bit group host files.
2020-05-27 16:51:27 +02:00
Robbert van der Helm ce35124e0c Merge branch 'feature/plugin-groups' 2020-05-27 15:47:57 +02:00
Robbert van der Helm 706b34eeb4 Rearrange order of Win32 and X11 event handling
Should not matter that much, but a potential situation where you would
want to have handled the X11 events first is when the editor enters a
blocking message loop while it is waiting on a GUI component just as the
window gets moved by an external program or window manager.
2020-05-27 15:44:14 +02:00
Robbert van der Helm 40f88b948f Document behaviour differences with plugin groups 2020-05-27 15:43:43 +02:00
Robbert van der Helm 941f915dfe Move the architecture section to docs/
It's getting a bit unwieldy to be left in the readme.
2020-05-27 15:24:54 +02:00
Robbert van der Helm 276e4ac02f Make the local coordinate fix more robust
Without this fix and when using plugin groups, hovering over an opened
window that has not yet been interacted with shows some weird behavior.
2020-05-27 14:29:31 +02:00
Robbert van der Helm 5a0c3c4627 Simplify the opening editor behaviour again
This partially reverts 16fce5577d.
2020-05-27 14:05:57 +02:00
Robbert van der Helm d65281d691 Clarify local coordinate fix function name 2020-05-27 13:50:52 +02:00
Robbert van der Helm ab4d35886e Add a fix for the keyboard focus in Bitwig 3.2 2020-05-26 19:39:51 +02:00
Robbert van der Helm be969a69d0 Document plugin groups 2020-05-26 19:39:51 +02:00
Robbert van der Helm 0c047f9a66 Work around a memory corruption issue on unload
I'm really not sure what is happening here, and it might just be a
winelib thing.
2020-05-26 17:09:09 +02:00
Robbert van der Helm fc35b6c9c8 Show the init message before launching VST host 2020-05-26 17:07:14 +02:00
Robbert van der Helm 9b847fdc31 Add todo regarding offscreen window coordinates 2020-05-26 12:19:37 +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 9a35023990 Split X11 and Win32 event handling
X11 events should always be handled since it's thread safe and they
don't block.
2020-05-26 11:11:34 +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 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 85fb3a2588 Conditionally disiable the message loop from
Based on a function. This is needed because the message loop should be
skipped while any of the plugins is opening their GUI, similar to how
`EditorOpening` worked for individually hosted plugins.
2020-05-25 15:04:43 +02:00
Robbert van der Helm 1c44a2f2cb Also filter audioMasterGetCurrentProcessLevel
Some plugins call this every time they process audio.
2020-05-25 14:38:30 +02:00
Robbert van der Helm 2e68ade2a3 Allow handling events inside of an IO context
This is needed when using multiple plugins since their GUI operations
all have to be run from the same thread.
2020-05-25 14:38:30 +02:00
Robbert van der Helm e546dd7b24 Change wording for individually hosted plugins 2020-05-23 16:00:44 +02:00
Robbert van der Helm 42c755cac8 Don't try to join nonexistent threads
This fixes a shutdown crash for individually hosted plugins. One more
reason to refactor the host launch behavior!
2020-05-23 15:59:04 +02:00
Robbert van der Helm 124b62bf6b Change config path wording
Since this field will only be populated if we are actually using values
from a config file.
2020-05-23 15:47:13 +02:00
Robbert van der Helm e61b70ed97 Add the new plugin groups to the changelog #15
With this the plugin groups functionality is feature complete, although
I still want to do a few rounds of refactoring and the readme has not
yet been updated.
2020-05-23 15:28:54 +02:00
Robbert van der Helm c387238b78 Change wording in group related log messages 2020-05-23 15:16:33 +02:00
Robbert van der Helm 9c901935d4 Fix editor GUIs for plugin groups
Handles for things like timers should be unique on a per-thread basis in
the Win32 API, but apparently window classes have to be unique for the
entire application.
2020-05-23 15:09:56 +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 9f544c194a Change hosting mode wording 2020-05-23 13:01:22 +02:00
Robbert van der Helm 333c5dac17 Clean up GitHub workflow 2020-05-22 23:37:21 +02:00
Robbert van der Helm a9841f21f5 Include the group host binaries in the artifacts 2020-05-22 23:34:06 +02:00
Robbert van der Helm 3a9d902c72 Allow all threads to return when sockets close
This was not a problem with individually hosted plugins because the
entire process got terminated at once, but here we all threads to shut
down gracefully when a plugin's sockets get closed. I wish this wouldn't
need all these try-catches, but we're not writing Haskell here.

The only issue remaining is that for some reason only the first
instance's editor works, at least for Serum. This might be because of
the message loop.
2020-05-22 23:22:49 +02:00
Robbert van der Helm a246ddf344 Manually close sockets when not killing process
Killing the socket would otherwise cause the sockets to be closed, and
both sides to shut down.
2020-05-22 23:08:25 +02:00
Robbert van der Helm 6da1909d4b Fix interleaved group host initialization
In case two yabridge instances start at the same time and both try to
launch a group host for the same group and the second plugin connects to
the first group host, then we should of course be using that process'es
PID to check if the group host is still running.
2020-05-22 22:50:29 +02:00
Robbert van der Helm bea924c0e1 Make plugin initialization thread safe 2020-05-22 22:42:24 +02:00
Robbert van der Helm b4b471523f Fix assertion in group host connection handler 2020-05-22 20:15:53 +02:00
Robbert van der Helm ad6199949d Fix startup errors not being logged 2020-05-22 20:15:53 +02:00
Robbert van der Helm c5c1c334d9 Add group host support to the plugin
The difference between individual hosting and group hosting will have to
be encapsulated in a class to keep the rest of the plugin bridge clean.
2020-05-22 20:15:53 +02:00
Robbert van der Helm 903d977d83 Add a function for generating group host endpoints 2020-05-22 19:06:43 +02:00