Commit Graph

592 Commits

Author SHA1 Message Date
Robbert van der Helm 10b01b5140 Update comments on the VST3 info caches 2021-02-09 23:19:17 +01:00
Robbert van der Helm 81d401f06a Add mutexes for the VST3 data caches
Since the restart will always be called from another thread, and when a
plugin asks for a restart during initialization this can quickly lead to
issues.
2021-01-30 23:26:57 +01:00
Robbert van der Helm b5dd806b2d Cache VST3 parameter information
This is in some cases needed to get decent performance in REAPER, as
REAPER seems to query this information (which cannot change without the
plugin requesting a restart) four times per second.
2021-01-30 22:24:05 +01:00
Robbert van der Helm 1043776e52 Differentiate between cached values in logs
If it turns out we forgot to flush this cache in some place.
2021-01-30 13:56:58 +01:00
Robbert van der Helm 68e10cd24c Flush the bus info cache in more places
The current approach 'works', but better err on the safe side. Once this
caching layer is no longer necessary we should just remove it.
2021-01-30 13:48:42 +01:00
Robbert van der Helm 0adca3e33c Revert "Remove cache_time_info and always cache time info"
This reverts commit cfb171c991.

No idea why, but this cache breaks SPL Transient Designer Plus. Perhaps
it overwrites the time info?
2021-01-30 02:37:27 +01:00
Robbert van der Helm 10b7930779 Also clear bus cache on IAudioProcessor::setActive
Now we need a workaround for our REAPER workaround because REAPER
doesn't follow the audio processing workflow diagram, amazing!
2021-01-30 01:42:20 +01:00
Robbert van der Helm 6339618984 Fix response logging filtering with bus info cache
The response logging wasn't getting filtered.
2021-01-30 00:45:45 +01:00
Robbert van der Helm cfb171c991 Remove cache_time_info and always cache time info
It sort of goes against yabridge's principles to not do these
unnecessary `audioMasterGetTime()` calls if the plugin does that, but it
also hurts the user experience to not have this as a default.
2021-01-30 00:20:35 +01:00
Robbert van der Helm f5b4a28bd0 Cache bus information during processing
This works around an issue with REAPER. During every processing cycle
REAPER would query how many input and output busses we have, and it
would then enumerate over all of those busses. This meant that if a VST3
plugin has 32 output busses, then REAPER will do 34 extra function calls
before processing audio.
2021-01-30 00:02:06 +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 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 96511ca8a3 Make realtime priority setting more granular
On the plugin side.
2021-01-23 14:43:06 +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 ac47865410 Readd accidentally removed forward declaration
This got removed in 74dc8225d1 when I
wanted to rework all `*Impl` classes the same way I did with
`YaPluginFactoryImpl`. This ended up not being possible, but
accidentally also removed this forward declaration. With unity builds
this did not cause issues however, but with regular builds it might
depending on which files are changed.
2021-01-21 13:26:01 +01:00
Robbert van der Helm 6f5a8e3ebf Update comments on get_plugin_factory()
Now that we do use a smart pointer to manage it ourselves, as proven
necessary by REAPER.
2021-01-21 02:05:21 +01:00
Robbert van der Helm 74dc8225d1 Back the VST3 plugin factory by an IPtr
This prevents REAPER from crashing when removing the last instance of a
plugin and then readding it. REAPER doesn't unload the module even after
it removes its last plugin factory instance. This means that before this
the plugin factory would be freed but we still had a seemingly valid
pointer to it that we would try to access.
2021-01-21 01:51:21 +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 508d393bbc Fix event handlers not being unregistered
This would cause crashes in Bitwig, as `RunLoopTasks`' destructor would
not be run after the event handler has been unregistered, and we
unregister the event handler in that destructor.
2021-01-20 00:21:18 +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 23d9b7416d Support deep nested mutual recursion in IPlugView
This could cause hangs in Bitwig when very quickly resizing GUIs.
2021-01-19 23:11:08 +01:00
Robbert van der Helm d7d5725ae9 Fix typo 2021-01-19 18:02:35 +01:00
Robbert van der Helm 36535fc3b5 Fix VST2 editor resizing in REAPER
After solving this for VST3 plugins it become clear that REAPER required
us to do the exact same thing for VST2 plugins.
2021-01-19 17:49:40 +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 b2ccfed2e6 Add a note for a potential fix for REAPER resizing 2021-01-18 16:00:45 +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 0c8941f9f0 Update the fixme on REAPER's thread safety issues 2021-01-17 17:37:23 +01:00
Robbert van der Helm 7c3e28e482 Add a note about unavoidable zombie processes
This has to be fixed in Boost.Process
2021-01-17 15:38:20 +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 3d8ee1ddf1 Add stubs for IParameterFunctionName 2021-01-17 13:23:17 +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 9ddf4b2ae1 Fully implement IProcessContextRequirements 2021-01-16 16:29:21 +01:00
Robbert van der Helm a2203cfef7 Add stubs for IProcessContextRequirements 2021-01-16 16:09:31 +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 7fdf646270 Fully implement IMidiLearn 2021-01-16 14:25:00 +01:00
Robbert van der Helm 85c1972c1f Add stubs for IMidiLearn 2021-01-15 22:36:25 +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 c485677987 Add stubs for INoteExpressionPhysicalUIMapping 2021-01-15 19:08:06 +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 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 c57090600e Add stubs for IPlugViewContentScaleSupport 2021-01-14 14:33:20 +01:00
Robbert van der Helm 631166d0bf Fully implement IInfoListener 2021-01-12 17:04:07 +01:00