Commit Graph

602 Commits

Author SHA1 Message Date
Robbert van der Helm 4e289348c2 Clarify the VST3 mutual recursion change 2021-05-23 13:49:38 +02:00
Robbert van der Helm df93944f3b Prevent allocations caused by Logger::log_trace
C++ would always construct an `std::string` from the string constant
every iteration. Since this also happened when `YABRIDGE_DEBUG_LEVEL` is
not set to 2, this ended up causing unnecessary allocations.
2021-05-23 00:21:21 +02:00
Robbert van der Helm e700678a11 Also preallocate small buffers for VST2 events 2021-05-23 00:10:03 +02:00
Robbert van der Helm da8f4aae19 Preallocate small vectors for VST3 queues
Events, parameter changes, and the individual queues contained within
the parameter changes all use dynamic memory allocation. Preallocating
some memory for those things inside of the objects may prevent latency
spikes when they those objects are first filled. This is especially
useful for the parameter changes since there's no way to reserve memory
in a vector of vectors.
2021-05-22 23:38:31 +02:00
Robbert van der Helm 7c49fe739d Use our new custom std::variant bitsery extension
This prevents reinitializing `std::variant`s when the variant we want to
deserialize is already active. We store audio buffers in variants, so
reinitializing them results in a lot of unnecessary memory frees,
allocations and writes during every processing cycle.
2021-05-22 17:51:01 +02:00
Robbert van der Helm a96cfc8090 Allow mutual recursion between audioMasterUpdateDisplay and effGetProgram
This prevents Voxengo VST2 plugins from freezing in Renoise when
recalling their state. See the comments in the diff for why this is
necessary.
2021-05-20 15:28:00 +02:00
Robbert van der Helm e5bfb56756 Mention the disable_pipes option in the changelog
I somehow forgot to do this in the last commit.
2021-05-18 22:57:41 +02:00
Robbert van der Helm 883b6b7700 Manually close descriptors instead of using vfork
With `vfork()` the child process inherits the parents process image and
prevents copying them, but if it outlives its parent then the file
descriptors will still remain open. Manually closing all file
descriptors is the only solution here.

This was only an issue with Ardour since they don't open all of their
files with `FD_CLOEXEC`. Last update's watchdog timer somewhat mitigated
the issue, but Ardour should now no longer freeze when reopening because
of this. The watchdog timer is still necessary, since hanging Wine
processes will still prevent the Wine server from shutting down.
2021-05-16 15:28:53 +02:00
Robbert van der Helm 448243050a Always serialize in little-endian and skip checks
These checks are not necessary since we can trust ourselves to not try
to cause any buffer overflows.
2021-05-16 13:15:14 +02:00
Robbert van der Helm 37d706df63 Handle mutual recursion on plugin side globally
This makes much more sense, since all plugin instances will be sharing a
single GUI thread. What would happen was that resize calls from one
instance and GUI thread function calls from another instance would
collide. Using a single shared mutual recursion mechanism (just like on
the Wine side) fixes this.
2021-05-16 01:17:04 +02:00
Robbert van der Helm 70a546d160 Handle setting channel infos as mutually recursive
This was causing a timing issue with DMG plugins where the plugins would
try to resize after receiving new state (and not during the call), while
REAPER at the same time would try to set channel context information on
the plugin (which also has to be handled on the GUI thread).
2021-05-15 23:47:07 +02:00
Robbert van der Helm 171d8facee [yabridgectl] Improve the Wine check warning
This can also fail if you're using a version of yabridge that was
compiled against more recent libraries.
2021-05-15 23:03:23 +02:00
Robbert van der Helm 52cbc35867 [yabridgectl] Downgrade textwrap again
Partially reverts f02b9e646b. Newer
versions don't take the indentation into account when wrapping.
2021-05-15 22:47:06 +02:00
Robbert van der Helm 5577c4bfd8 Fix build on Wine 6.8 #103
Wine dropped `WINE_NOWINSOCK`, so now we sadly have to define this
globally instead.
2021-05-11 02:27:38 +02:00
Robbert van der Helm fcaac219a6 💥 Reduce allocations in VST3 audio sockets
We do this by using this new `MessageReference<T>` type to avoid copying
our `YaAudioProcessor::Process` struct and the contained `YaProcessData`
object. This is only part of the work, but this redesign lets us keep
the these objects alive on both the plugin and the host side. On the
plugin side, we'll simply serialize the data from the referred to object
without copying it. On the Wine side, we'll write the data to a
persistent thread local object, and then reassign the
`MessageReference<T>` to point to that object. This lets us serialize
'references', thus avoiding potentially expensive allocations. With
these last few changes alone VST3 plugins are already at the same
performance level as our optimized VST2 plugin groups.
2021-05-07 16:32:08 +02:00
Robbert van der Helm b6f96fc920 Cache IAudioProcessor::canProcessSampleSize() 2021-05-06 18:32:46 +02:00
Robbert van der Helm 9424c36993 Temporarily memoize IPlugView::canResize()
This makes VST3 plugin resizing more responsive, because this function
would otherwise be constantly running in lockstep from the GUI thread.
2021-05-05 19:44:44 +02:00
Robbert van der Helm 2c33048137 Mark the 3.2.0 release in the changelog
I somehow forgot about this.
2021-05-05 19:38:46 +02:00
Robbert van der Helm 018ad5293e Reword the changelog once more
It's always fun how you keep finding more spelling mistakes every time
you read something.
2021-05-03 13:06:23 +02:00
Robbert van der Helm a9b8225705 Reword the changelog
All entries with a longer explanation now also say what they do in the
first line, for if you don't want to read the entire thing.
2021-05-02 23:07:14 +02:00
Robbert van der Helm a9f9691b42 Don't copy any VST3 state preamble
Bitwig prepends some data when passing an `IBStream*` to the plugin, and
when we do copy it iZotope Rx7 plugins cannot load their state (even if
we also copy over the same seek position). Not copying that preamble
fixes the issue, and it seems like it doesn't break anything.
2021-05-02 22:00:53 +02:00
Robbert van der Helm dc37f03613 Fix styling in changelog 2021-05-02 21:58:34 +02:00
Robbert van der Helm 2a864c8941 Rearrange the fixes section of the changelog 2021-05-02 16:38:52 +02:00
Robbert van der Helm 62efc1c273 Also handle mutual recursion in *::getState()
VST3 plugins could freeze in REAPER when the plugin sends
`IComponentHandler::performEdit()` followed by
`IPlugFrame::resizeView()` when REAPER simultaneously tries to call
`*::getState()`. Here `*::getState()` gets called from the GUI thread,
while `IPlugFrame::resizeView()` has to be handled on REAPER's GUI
thread, resulting in a deadlock unless we use the plugin-side mutual
recursion mechanism.

I've seen this cause issues with PSPaudioware InfiniStrip.
2021-05-02 16:38:37 +02:00
Robbert van der Helm a83ff5a36a Fix wrong direction in cached VST3 call logging 2021-05-02 15:47:11 +02:00
Robbert van der Helm 5c88140c54 Also use mutual recursion for program list changes
The VST3 version of Voxengo TEOTE would deadlock in Ardour when Ardour
calls `IEditController::setState()`, the plugin calls
`IUnitHandler::notifyProgramListChange()` in response, and then when
Ardour calls `IUnitInfo::getProgramName()` while handling that callback.
All of these functions have to be called from the same thread in Voxengo
plugins.
2021-05-02 00:41:28 +02:00
Robbert van der Helm fd29c7d825 Skip X11 events when the window is not mapped
This fixes potential assertion failures in Ardour when Ardour unmaps
editor windows.
2021-05-01 23:22:59 +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 a91c1a3733 Reword the watchdog changelog entry 2021-05-01 18:12:42 +02:00
Robbert van der Helm 1065095ee2 Add a changelog entry for the watchdog 2021-05-01 18:08:05 +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 5b28d44797 Define a static library for the Wine hosts
This means we only have to compile everything two times, instead of four
times. We sadly still need to compile lots of files at least three
times. (once for native, once for 64-bit Wine, and once for 32-bit Wine)
2021-05-01 01:09:58 +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 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 66be22b902 Clarify the REAPER context menu regression 2021-04-30 12:47:16 +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 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 cb07fd07a2 Handle mutual recursion while loading presets 2021-04-29 23:40:42 +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 a2e3e691d2 Change wording in the changelog 2021-04-29 12:30:19 +02:00
Robbert van der Helm a0abfed689 Merge the two prefetching changelog entries 2021-04-29 12:25:54 +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 ee24969539 Mention SWAM Cello among the fixed plugins
Since this now no longer requires an option to get good performance.
2021-04-29 02:19:17 +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 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 676f995f83 Remove the changelog entry for force_ftz
Since this behaviour is now always enabled.
2021-04-28 15:36:14 +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 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