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
bda9a0b75f
Catch exceptions in failing host callbacks
...
This will let us more or less gracefully handle failing host callbacks
during initialization. We cannot catch this from anywhere else since
this these functions get called from unmanaged code.
2021-05-01 17:57:41 +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
e912bdd302
Also make sure that all group host threads exit
...
I actually don't know if this is necessary, but it was necessary for
individually hosted plugins, so presumably it's also needed here.
2021-05-01 17:20:13 +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
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
131d749ba6
Register the Wine host bridge watchdog
...
It doesn't do anything yet.
2021-05-01 16:52:05 +02:00
Robbert van der Helm
d8ca4022d1
Add universal way to shutdown sockets on Wine side
2021-05-01 16:51:55 +02:00
Robbert van der Helm
0f2db64aeb
Add the pieces for a watchdog for dangling plugins
...
Once we register our plugins here, we should be able to gracefully shut
down any plugins whose remote process got killed.
2021-05-01 16:51:55 +02:00
Robbert van der Helm
167784f93b
Prevent unnecessary copies in ScopedValueCache
2021-05-01 16:28:14 +02:00
Robbert van der Helm
7881e0116e
Rename host_guard_handler to host_watchdog_handler
...
To keep the terminology consistent.
2021-05-01 15:46:27 +02:00
Robbert van der Helm
aeca37d795
Rearrange src/wine-host/utils.h
...
We're going to need to spawn a Win32Thread in the MainContext to act as
a watchdog.
2021-05-01 15:46:27 +02:00
Robbert van der Helm
b22f207aee
Move the MainContext to HostBridge
...
We'll use this to create a watchdog timer that shuts down the sockets
when the native host gets terminated.
2021-05-01 15:06:13 +02:00
Robbert van der Helm
564e047b4b
Remove the Ardour warning for VST3 plugins
2021-05-01 12:53:38 +02:00
Robbert van der Helm
177431e202
Fix performEdit() deadlock in Ardour/Mixbus
...
Those DAWs would immediately call `IEditController::performEdit()` with
the same parameter change the plugin has just announced, which would
result in a deadlock. Hopefully this helps with #100 .
2021-04-30 20:50:54 +02:00
Robbert van der Helm
2fe6b1c48d
Clean up the main VST3 mutual recursion function
2021-04-30 20:44:50 +02:00
Robbert van der Helm
89d6c1b2e0
Fix assertion failure when reading end of stream
...
Getting the address of the end of a vector apparently raises an
assertion failure now, even if we didn't do anything with it.
2021-04-30 17:00:04 +02:00
Robbert van der Helm
36b3636072
Handle mutual recursion in context menus
...
REAPER will call `getState()` while the context menu is open, and that
also has to be handled from the GUI thread.
2021-04-30 02:49:54 +02:00
Robbert van der Helm
52428c8749
Also fix mutual recursion across both components
...
When setting the state on the audio processor, it can happen that plugin
triggers a resize from the edit controller. We should also be able to
handle that situation.
2021-04-30 02:11:24 +02:00
Robbert van der Helm
949ddaf673
Use mutual recursion for IEditController::setState
...
With this we should be able to handle `setState()`s that try to resize
the currently open editor. This could pop up when using the preset
browser in REAPER with plugins that recall their old size when loading a
preset.
2021-04-30 01:15:18 +02:00
Robbert van der Helm
0536256217
Add clamping to IBStream implementation seek
2021-04-29 23:40:42 +02:00
Robbert van der Helm
cb07fd07a2
Handle mutual recursion while loading presets
2021-04-29 23:40:42 +02:00
Robbert van der Helm
74dd7f61a2
Fix ISizeableStream::getStreamSize implementation
2021-04-29 22:49:16 +02:00
Robbert van der Helm
0f506f75e4
Bypass connection point proxies when possible
...
This greatly improves compatibility with VST3 plugins in Ardour and
Mixbus. Most notably the FabFilter plugins would previously freeze when
having the GUI open while duplicating or inserting new instances.
2021-04-29 15:36:28 +02:00
Robbert van der Helm
e4177f2856
Avoid IAudioProcessor::isActive() on GUI thread
...
I haven't seen this cause any issues this way, and I could imagine that
this could cause some hangs when initializing a second instance of a
plugin while you're interacting with the GUI of the first instance.
2021-04-29 14:29:15 +02:00
Robbert van der Helm
a56e4b337f
Rename the VST3 mutual recursion functions
2021-04-29 14:03:15 +02:00
Robbert van der Helm
45d83ad9a1
Revert "Separate mutual recursion on GUI and other threads"
...
This reverts commit a495f1a67f .
This ended up not being an issue. What we _do_ have to do, sadly, is to
have a mutual recursion context stack per plugin. Otherwise multiple
plugin instances can deadlock eachother.
2021-04-29 13:54:48 +02:00
Robbert van der Helm
a495f1a67f
Separate mutual recursion on GUI and other threads
...
I wasn't able to get this to clash, but this way we can be 100% sure
that there aren't any weird issues.
2021-04-29 12:07:11 +02:00
Robbert van der Helm
8b168b310c
Fix mutual recursion with latency in Ardour/Mixbus
...
This would cause Ardour and Mixbus to freeze when inserting a latency
introducing (JUCE based) VST3 plugin. As mentioned in #98 .
2021-04-29 03:13:53 +02:00
Robbert van der Helm
22f94dd22f
Prevent unnecessary copies in ScopedValueCache
2021-04-29 02:58:05 +02:00
Robbert van der Helm
6f6e6c5b94
Reword caching to prefetching
...
Since that makes it much clearer what we're actually doing. With old
`cache_time_info` was actually caching the response, but now we're
querying it before the plugin has even requested the information.
2021-04-29 01:07:14 +02:00
Robbert van der Helm
c82eb35243
Also cache audioMasterGetCurrentProcessLevel()
...
Melda plugins seem to call this during every processing cycle.
2021-04-29 01:02:10 +02:00
Robbert van der Helm
383b0c3f10
Remove the cache_time_info option
...
The new time info caching behaviour supersedes this by getting rid of
callbacks altogether.
2021-04-29 00:46:43 +02:00
Robbert van der Helm
2a9840828f
Add a todo for also caching the process level
2021-04-29 00:42:44 +02:00
Robbert van der Helm
b8f8dd7236
Log cached audioMasterGetTime() calls
...
Just like we log cached VST3 function calls.
2021-04-29 00:41:56 +02:00
Robbert van der Helm
1deb4cf664
Send the VST2 transport info along with processing
...
And cache it during the processing cycle. This greatly reduces the
overhead of bridging VST2 plugins.
2021-04-29 00:32:25 +02:00
Robbert van der Helm
6a3c726acf
Get rid of spurious accessibility label
2021-04-29 00:31:11 +02:00
Robbert van der Helm
6cd1b664d3
Rearrange fields in Vst2Bridge
2021-04-29 00:31:11 +02:00
Robbert van der Helm
70adf5493e
Add a logger to the Wine VST2 bridge
2021-04-29 00:31:11 +02:00
Robbert van der Helm
32db921b9b
Move generic logger on the Wine side to common.h
...
We'll also need this for VST2 plugins when we start caching the time
info.
2021-04-29 00:31:11 +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
14b0ba0c62
Clarify the definition of empty_arrangement
...
This is the same thing of course, but it's a bitfield so just a single 0
may seem a bit odd if you don't already know that.
2021-04-28 13:41:24 +02:00
Robbert van der Helm
216c6bc4f2
Always provide at least some speaker arrangement
...
This works around a bug in the VST3 version of W. A. Production
Imperfect as mentioned in #97 . Even if it's a synth and numInputs is 0,
the plugin will still try to read the input arrangement.
2021-04-28 13:35:15 +02:00
Robbert van der Helm
23f94b35d0
Fix move semantics in Win32Thread and Win32Timer
...
I was sure that moving an `std::optional<T>` would reset the object you
moved from, but apparently not.
2021-04-28 12:56:49 +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
93f089eca7
Always set FTZ instead of gating it behind a flag
...
After a quick round of testing it seems like REAPER doesn't always
enable this on the audio thread, but Bitwig, Ardour, Carla and Renoise
do. So it should be safe to just get rid of the option and to leave this
enabled all the time.
2021-04-28 12:07:14 +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
73d9f5f9b8
Remove unnecessary include
2021-04-27 20:46:08 +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