Commit Graph

531 Commits

Author SHA1 Message Date
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 72e29d044a Add a function for temporarily blocking event loop
This can be used to prevent the Win32 message loop from running while
there are plugins in some partially initialized state.
2021-01-27 19:00:11 +01:00
Robbert van der Helm cf9ae47f99 Return kNotImplemented with vst3_no_scale
Ever since 0bed2b7bc0 REAPER will randomly
not play back one or more audio channels for plugins that support
IPlugViewContentScaleSuport. If you return `kNotImplemented` then this
bug doesn't occur. REAPER should definitely fix this soon. With
`kResultFalse` this issue still occurs, hence this change so you can use
`vst3_no_scale` to work around this REAPER bug.
2021-01-26 22:49:00 +01:00
Robbert van der Helm 2c7fd94f3b Add a TODO for inhibiting the event loop
During the early steps of plugin initialization.
2021-01-26 15:43:10 +01:00
Robbert van der Helm ffe46e225c Relay Wine STDIO with SCHED_OTHER
I haven't seen this cause issues myself, but it would not surprise me if
a plugin that produces a constant stream of FIXMEs would steal resources
from audio processing if the threads that are relaying those messages
are set to SCHED_FIFO.
2021-01-24 17:02:56 +01:00
Robbert van der Helm 21ff906bf8 Handle connection point proxy from GUI thread
FabFilter plugins will exchange messages that have to be handled from
the GUI thread, or they'll get stuck waiting on a synchronisation
object. This probably hurts GUI performance significantly but luckily it
only affects Ardour.
2021-01-24 15:42:25 +01:00
Robbert van der Helm 77414c80d6 Allow null pointers in IEditController::setComponentHandler 2021-01-24 14:51:18 +01:00
Robbert van der Helm 0044bc6b60 Allow passing null pointers to IPlugView::setFrame 2021-01-24 14:44:42 +01:00
Robbert van der Helm d5e4424463 Also sync VST3 audio thread scheduling priorities
The exact same thing as the last commit, but for VST3 plugins.
2021-01-23 15:22:10 +01:00
Robbert van der Helm f03b9b1497 Sync VST2 audio thread scheduling priorities
We'll periodically copy the scheduling priorities from the host's audio
threads to the Wine plugin host's audio threads. The overhead of doing
this is about 1 microsecond on my system, so doing this every cycle
really adds up. But getting the Unix epoch time and comparing some
timestamps has a neglegible overhead, so this should give you the best
of both worlds.

Next we'll do the same thing for VST3 plugins.

As suggested by @jhernberg
2021-01-23 15:14:52 +01:00
Robbert van der Helm 1b804bd5ea 💥 Convert between UID formats for class IDs
This is a breaking change. Old projects containing VST3 plugins running
through yabridge will no longer work without modifications. I'll write
some scripts to convert the class IDs stored in those project files soon
a migration path.

The UIDs reported by the plugin were apparently wrong, which meant that
the native Linux VST3 version of plugin X and the normal Windows VST3
version of plugin X used different class ideas than the Windows VST3
version of plugin X running through yabridge. Those things are supposed
to be compatible, so we sadly needed to make this change at some point.
2021-01-22 14:24:40 +01:00
Robbert van der Helm d3d57a3fe0 Use UID conversion for GetControllerClassId 2021-01-22 14:13:27 +01:00
Robbert van der Helm ae0d7263b8 Use UID conversion for IsPlugInterfaceSupported
I assume that this would also be necessary here, right?
2021-01-22 13:50:06 +01:00
Robbert van der Helm 2ca1d5b8ca Greatly increase reliability of deferred closing
It's pretty hard to find a solution that checks all of the boxes. I want
something that:

- Closes instantly when you close the editor, and in REAPER you should
  be able to instantly switch between docked and floating modes
- Where there should not be a delay in user interaction when quickly
  reopening the editor (or doing that switching thing in REAPER since that's
  the same thing)
- Where the window manager should not try to reparent the window during
  the losing process as that can cause some jarring flickering
- And, of course, there should be no weird Wine X11Drv crashes

And it should do all of that in Bitwig, REAPER, Carla, Ardour and
Renoise. Apparently it's quite the task to find an approach that checks
all the boxes there.
2021-01-21 16:47:35 +01:00
Robbert van der Helm 5155863673 Encapsulate the deferred window closing
This makes it a bit easier to tweak the closing behaviour.
2021-01-21 15:56:13 +01:00
Robbert van der Helm e5b1e31aff Reuse window classes
This gets rid of some unnecessary complexity.
2021-01-21 15:40:25 +01:00
Robbert van der Helm 4cc44c3cf7 Make the mutual recursion mechanism safer
By directly stopping the IO context there was a chance that a task would
get cancelled outright if all stars aligned in the wrong way. Stopping
the IO context could happen between posting the task to the context and
waiting for it. This approach is much safer as we cannot drop any work
this way.
2021-01-20 12:52:48 +01:00
Robbert van der Helm 5f7f44ce20 Fix potential issue in GUI thread mutual recursion
While the assumption that this is always the last element should hold
true, there may be exceptions so better be safe than sorry.
2021-01-20 03:29:25 +01:00
Robbert van der Helm c08d704dc0 Apply the mutual recursion changes to Vst3Bridge
I've never seen this happen, but now this too would support deeply
nested mutual recursion just like we implemented in
`Vst3PlugViewProxyImpl`. Better safe than sorry.
2021-01-19 23:52:00 +01:00
Robbert van der Helm de8559caea Get rid of some old todos 2021-01-19 15:20:22 +01:00
Robbert van der Helm dac817323b Add an option to force drag-and-drop under REAPER
This works around a long standing bug in REAPER itself that would
prevent you from dragging files onto any plugin editor window.
2021-01-19 15:11:27 +01:00
Robbert van der Helm 9788f21e0e Fix rare hanging issue on Bitwig related to focus
On Bitwig grabbing input focus this way would trigger many more FocusIn
events, which in certain situations could cause the interface to hang
while everything was being processed.
2021-01-19 00:52:49 +01:00
Robbert van der Helm bb5471f2d9 Run certain GUI tasks from the host's run loop
This was a bit of a tricky one because it requires simulating mutual
recursion, but it's needed for REAPER as otherwide calls to
`IPlugFrame::resizeView()` and `IContextMenu::popup()` might cause
REAPER to segfault because its GUI is not thread safe.
2021-01-18 14:19:31 +01:00
Robbert van der Helm 5ad47c8c68 Get rid of condition variable in mutual recursion
We can safely assume that these are mutually recursive calls from the
GUI thread and can thus be handled directly.
2021-01-18 11:22:07 +01:00
Robbert van der Helm bb2b526003 Optimize away some potential copies 2021-01-17 19:06:56 +01:00
Robbert van der Helm 1c6d3f8fd9 Fully implement IParameterFunctionName
We now support all VST 3.7.1 interfaces! At least, in theory we do.
2021-01-17 14:17:46 +01:00
Robbert van der Helm aa1a7a1588 Fully implement IProgress
`IParameterFunctionName` will be the last interface before we _in
theory_ support all VST3 features.
2021-01-17 00:19:48 +01:00
Robbert van der Helm e840fe3114 Add stubs for IProgress 2021-01-16 18:09:39 +01:00
Robbert van der Helm 9ddf4b2ae1 Fully implement IProcessContextRequirements 2021-01-16 16:29:21 +01:00
Robbert van der Helm 73fda0b568 Fully implement IPlugInterfaceSupport
With this we support all VST 3.6.12 interfaces.
2021-01-16 15:19:10 +01:00
Robbert van der Helm 6c40cd5ad1 Add stubs for IPlugInterfaceSupport 2021-01-16 14:47:40 +01:00
Robbert van der Helm 7fdf646270 Fully implement IMidiLearn 2021-01-16 14:25:00 +01:00
Robbert van der Helm 6e8d56923c Fully implement INoteExpressionPhysicalUIMapping
With this we support all VST 3.6.11 features.
2021-01-15 19:33:05 +01:00
Robbert van der Helm 5dcedbace5 Add an option to disable VST3 content scaling
This might be necessary when using a HiDPI screen as plugin GUIs often
don't scale correctly under Wine.
2021-01-14 17:36:00 +01:00
Robbert van der Helm 1d9b60b481 Fully implement IComponentHandlerBusActivation
We now support all VST 3.6.8 features. (or technically, also all VST
3.6.10 features)
2021-01-14 16:42:19 +01:00
Robbert van der Helm bfdbfa9196 Add stubs for IComponentHandlerBusActivation 2021-01-14 16:16:58 +01:00
Robbert van der Helm 0bed2b7bc0 Fully implement IPlugViewContentScaleSupport
With this we're at VST 3.6.6 level support.
2021-01-14 14:52:39 +01:00
Robbert van der Helm 561aee4963 Pass channel context data from the GUI thread
This fixes Melodyne crashing as it presumably immediately wants to
redraw upon receiving this.
2021-01-12 18:44:43 +01:00
Robbert van der Helm 631166d0bf Fully implement IInfoListener 2021-01-12 17:04:07 +01:00
Robbert van der Helm 87b270273f Fully implement IPrefetchableSupport 2021-01-12 15:37:58 +01:00
Robbert van der Helm bf3a4e7296 Allow changing the event loop tick rate
This also changes the refresh rate for most plugins. You can now lower
this setting if your computer is struggling to keep up with rendering a
certain heavy plugin.
2021-01-11 23:38:21 +01:00
Robbert van der Helm b86df213fb Change to SCHED_OTHER on IPlugView init/destruct
Instead of only on `IPlugView::attached`/`IPlugView::removed` like in
the previous commit. I forgot to also do this when creating and
destroying IPlugViews (since I can assume lots of plugins will then
already start loading resources).
2021-01-11 19:04:46 +01:00
Robbert van der Helm 8f15578d8c Also disable realtime priority during effEditGetRect
Since on some hosts this is called before effEditOpen.
2021-01-11 18:53:36 +01:00
Robbert van der Helm f015739942 Open and close editors without realtime priority 2021-01-11 18:50:53 +01:00
Robbert van der Helm 3ca7061659 Switch to SCHED_OTHER while handling events
GUI drawing should not be able to interrupt the cores that are handling
DSP, but it seems like that was happening for some people with
suboptimal kernel configurations. This will require some more extensive
testing to see if these changes don't actually increase DSP load.
2021-01-11 14:20:03 +01:00
Robbert van der Helm e3ea1dd2fe Allow an option set_realtime_priority() to revert 2021-01-11 14:04:54 +01:00
Robbert van der Helm 5855ffbe85 Fully implement IUnitHandler2 2021-01-10 23:54:43 +01:00
Robbert van der Helm 89111d2f5f Add stubs for IUnitHandler2 2021-01-10 23:49:58 +01:00
Robbert van der Helm a2d1a97309 Fully implement IAutomationState 2021-01-10 23:38:40 +01:00
Robbert van der Helm 8971a65825 Pass through host provided IBStream objects
So if the host supports IStreamAttributes, we can also provide objects
that support the same itnerface to the plugin.
2021-01-10 16:57:36 +01:00