Commit Graph

1586 Commits

Author SHA1 Message Date
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
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