Commit Graph

1846 Commits

Author SHA1 Message Date
Robbert van der Helm 814d3c688c Fix the VST3 audio processing sending buffers
Making these thread local statics makes much more sense for their
purpose. The old approach technically wasn't thread safe (even if it was
never an issue) and this gets rid of a data structure.
2021-05-07 17:41:42 +02:00
Robbert van der Helm 671587f981 Further reduce allocations by reusing responses
On the plugin's side, still need to do a lot of work on the Wine side of
things.
2021-05-07 17:00:43 +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 d08ec70f2c Add a bitsery adapter for MessageReference<T>
This lets us deserialize into an actual persistent object and then
reassign the reference to point to that object.
2021-05-07 16:23:04 +02:00
Robbert van der Helm c6fc24f210 Add a reference wrapper for VST3 message objects
This is kind of equivalent to `std::reference_wrapper`, but with default
initialization support (which is UB, but is required for serialization)
and a forward for `T::Response` as used by your sockets API.
2021-05-07 16:21:48 +02:00
Robbert van der Helm 578259a002 Fix the canProcessSampleSize() cache
This is what you get for carelessly copying and pasting.
2021-05-06 18:55:01 +02:00
Robbert van der Helm b6f96fc920 Cache IAudioProcessor::canProcessSampleSize() 2021-05-06 18:32:46 +02:00
Robbert van der Helm 8f310ed89b Rename ParameterInfoCache to be more general 2021-05-06 18:16:33 +02:00
Robbert van der Helm a9a7e3e711 Note that objects in audio sockets doesn't work 2021-05-06 18:05:10 +02:00
Robbert van der Helm 9f5066a293 Avoid allocations when reading VST3 process data
On the plugin side. We still need to do a lot of optimizations
elsewhere.
2021-05-06 17:50:41 +02:00
Robbert van der Helm 0b173ecba8 Reuse objects in the VST3 audio processor sockets
This means that, we're now receiving into an existing `YaProcessData`
object, which should reduce the number of allocations on the Wine side
considerably. Next we should also reuse the `YaProcessDataResponse`
object.
2021-05-06 16:41:11 +02:00
Robbert van der Helm 6231ab7816 Reuse YaProcessData object on the plugin side
Well, kind of. This doesn't do anything yet since the default assignment
operator will just destroy and recreate objects as normal.
2021-05-06 16:34:23 +02:00
Robbert van der Helm e3f65374f4 Add downgrade instructions for Wine Staging 6.4
And the general recommendation to stick with this version for the time
being.
2021-05-06 12:49:07 +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 75006a537b Split up VST3 logging for UniversalTResult
I was wondering why I couldn't find the overload for `UniversalTResult`,
and as it turns out we would always use this variant (which
unsurprisingly was the very first overload added). We should of course
have separate overloads for this.
2021-05-05 19:38:46 +02:00
Robbert van der Helm 22d74e8b70 Add a helper for temporarily caching a value 2021-05-05 19:38:46 +02:00
Robbert van der Helm ce668ec022 Clean up style 2021-05-05 19:38:46 +02:00
Robbert van der Helm 000fa04b7b Update documentation on VST3 function call caches
Since REAPER has now fixed the issues that lead us to implementing these
things.
2021-05-05 19:38:46 +02:00
Robbert van der Helm d0fbca1e50 Update the status on ARA in the readme 2021-05-05 18:34:41 +02:00
Robbert van der Helm ffdab23d46 Bump the version to 3.2.0 3.2.0 2021-05-03 13:09:18 +02:00
Robbert van der Helm ef2439bb65 Remove note about hide_daw only being in master 2021-05-03 13:07:29 +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 49750575bc Fix xcb assertion failures in Ardour for good
Hopefully. Checking mapped state apparently wasn't enough to prevent
spurious assertion failures on `is_child_window_or_same()`. Now we'll
just use exceptions instead of assertions so we catch them and ignore
them.
2021-05-02 20:40:59 +02:00
Robbert van der Helm ac6bcae28b Fix disconnecting VST3 connection points in Ardour
We bypassed the proxies on `IConnectionPoint::connect()`, so we should
of course be doing the same thing on `IConnectionPoint::disconnect()`.Z
2021-05-02 19:05:49 +02:00
Robbert van der Helm 2fd453e747 Repeat the window mapped check for Ardour
This is probably a better idea than trying to be efficient. If we get
two events in a row, then it can be that the map status has changed
between the two events.
2021-05-02 18:33:05 +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 be984b342d Clarify the note about Ardour/Mixbus VST3 support
Outputs here refers to busses, but a bus can contain up to 64 channels.
2021-05-02 14:22:00 +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 7bcc9ac181 Cancel group host shutdown timer with new request
Or else we will still shut down the host when loading the new plugin
takes a while.
2021-05-01 22:10:51 +02:00
Robbert van der Helm 448bfca0bc Reduce the initial shutdown timer on group hosts
This five seconds matches the five seconds on the first watchdog timer
proc.
2021-05-01 22:09:34 +02:00
Robbert van der Helm f3f2bfdc24 Fix deadlock caused by do_mutual_recursion_on_off_thread
Apparently the destructor for C++17/20 conditional initializers are only
run after the else branch, so this would keep the mutex locked while
executing `do_call()`.
2021-05-01 21:01:47 +02:00
Robbert van der Helm 459e7ac56b Fix syntax error in meson.build
As a result of 9daddb777b.
2021-05-01 19:31:44 +02:00
Robbert van der Helm 9daddb777b Fix unity builds
The version header was not being included in the correct unit,
sometimes.
2021-05-01 19:28:00 +02:00
Robbert van der Helm b103723df2 Make the watchdog much more aggressive
For individually hosted plugins this will behave the same. For plugin
groups it would have been nice if we could shut down individual plugins,
but dangling threads are apparently a real issue. This should be
equivalent in all use cases.

This also reverts commit bda9a0b75f.
2021-05-01 19:05:55 +02:00
Robbert van der Helm bbc93d7413 Catch all exceptions during initialization 2021-05-01 18:48:46 +02:00
Robbert van der Helm 5c2da36ecd Use a shorter delay for the first watchdog check 2021-05-01 18:47:45 +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 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