Commit Graph

1592 Commits

Author SHA1 Message Date
Robbert van der Helm fb7531d74b Greatly clean up the input focus grabbing
In commit 9788f21e0e we changed the input
focus grabbing to only grab focus once per event cycle, because
otherwise Bitwig would fight over who was getting focus. This is a bit
hacky, and with this approach you could in theory still have an
unnecessary focus grab 60 times per second (i.e. the default event
polling rate). Now we instead check the current focus target, and only
request focus when it's actually necessary.
2021-01-30 15:40:24 +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 9858db25d2 Show IComponent::getBusCount on verbosity level 1
The only reason this was hidden is because REAPER spams it, but it also
spams `IComponent::getBusInfo` which we cannot hide.
2021-01-30 01:51:14 +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 3f7f67fc2d Get rid of no longer used mutex
This was left over from a very early version of yabridge. It's not
needed since we have to initialize all VST2 plugins from the same thread
anyways.
2021-01-28 23:45:44 +01:00
Robbert van der Helm 62ab9a1c1a Reword comment
Forgot to add this to the last commit.
2021-01-27 21:01:34 +01:00
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 04d0ff0949 Fix serializing silence flags
We didn't initialize the field, and we also didn't copy the updated
value back (since everything else is a pointer to the original data).
This fixes audio channels in REAPER randomly being silence, as this
field would otherwise be uninitialized.

Thanks a lot to @kytdkut for finding this issue!
2021-01-26 23:59:56 +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 19fd99b58e Get rid of old fixmes related to the CID migration 2021-01-24 16:55:11 +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 96511ca8a3 Make realtime priority setting more granular
On the plugin side.
2021-01-23 14:43:06 +01:00
Robbert van der Helm 33dd469d36 Allow setting different priorities than 5 2021-01-23 14:24:01 +01:00
Robbert van der Helm 7c636ffcb1 Mention issues caused by 32-bit prefixes 2021-01-23 12:24:30 +01:00
Robbert van der Helm 91d0b405ec Add a migration script for Renoise
Now all migration scripts are done.
2021-01-22 22:51:08 +01:00
Robbert van der Helm 34136dd9cc Fix the class ID conversion in plugin factory
This is what you get for mindlessly copy-pasting.
2021-01-22 21:49:45 +01:00
Robbert van der Helm 52b723ef7d Add a migration script for Ardour 2021-01-22 21:29:35 +01:00
Robbert van der Helm e171881666 Mention how to download and run migration scripts 2021-01-22 20:27:42 +01:00
Robbert van der Helm 4e21cdb89b Add a migration script for Bitwig
This sadly has to be a semi-manual process, but at least it works!
2021-01-22 20:16:25 +01:00
Robbert van der Helm dfb9d18aa3 Add a class ID migration script for REAPER 2021-01-22 19:39:23 +01:00
Robbert van der Helm 0bba724cf9 Add a readme for the class ID conversion scripts 2021-01-22 14:55:29 +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 4f4f455f13 Add a todo for a failsafe for the socket cleanup 2021-01-22 14:18:21 +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 4a5c961b63 Get rid of unused bitsery FUID extension
This would need a UID conversion to be safe anyway, so it's better to
just get rid of it.
2021-01-22 13:47:11 +01:00
Robbert van der Helm 249b82f846 Add conversions for the garbled UIDs
We'll need this to make sure the reported class IDs match up with the
actual IDs.
2021-01-22 13:47:11 +01:00
Robbert van der Helm 29410e3992 Add fixmes for incorrect byte orders
As pointed out on the Discord. Fixing this will require a breaking
change, but right we report incorrect plugin IDs meaning that projects
saved under Windows cannot be opened under Linux with yabridge so this
really needs a fix.
2021-01-22 01:28:25 +01:00
Robbert van der Helm 4812757f1a Add a function for getting the current priority 2021-01-22 00:44:43 +01:00
Robbert van der Helm 58c687f9d7 Revert "Don't override existing host thread priorities"
This reverts commit 9b0324f4a7.

Since the plugin is initialized from the GUI thread, this doesn't make
any sense.
2021-01-22 00:38:44 +01:00
Robbert van der Helm e84f7425cf Fix reverting to SCHED_OTHER
This still seemed to work, but the `sched_setscheduler` would return an
error code when the priority is set to 5 for SCHED_OTHER (which is of
course not a valid value here).
2021-01-21 20:34:43 +01:00
Robbert van der Helm 9b0324f4a7 Don't override existing host thread priorities
If the thread that's hosting yabridge's plugin is already using realtime
scheduling.
2021-01-21 20:30:08 +01:00
Robbert van der Helm f8ac296ec7 Print the tempo part of VstTimeInfo
At debug level 2. This was needed to debug an issue with Renoise.
2021-01-21 20:04:35 +01:00
Robbert van der Helm e9210a1100 Reorder tested hosts list based on VST3 support 2021-01-21 18:00:54 +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 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