Commit Graph

818 Commits

Author SHA1 Message Date
Robbert van der Helm 388d9739a9 Move XML escaping to a separate function 2021-06-28 12:53:51 +02:00
Robbert van der Helm e7366006df Append to the STDERR stream
This got lost when changing from using `std::cerr` to opening
`/dev/stderr` directly.
2021-06-26 12:42:53 +02:00
Robbert van der Helm 20638b7349 Fix missing autoformatting
At some point Doom Emacs broke on-save formatting with lsp-mode in
certain circumstances, and I made these changes with wgrep so apparently
they were never formatted.
2021-06-26 12:27:01 +02:00
Robbert van der Helm 94b3c92432 Get rid of pointer size checks
To allow cross-compiling 32-bit libraries.
2021-06-24 13:17:15 +02:00
Robbert van der Helm 75cfc8eaac Fix new watchdog timer environment check
This would of course cause a segfault if the environment variable isn't
defined. The regression was introduced in
8873c11e1d.
2021-06-22 18:06:04 +02:00
Robbert van der Helm 4ab61a77b7 Compare to string view constant instead of string
These are constexpr, so hopefully the compiler can be a bit smarter
about it.
2021-06-22 17:42:37 +02:00
Robbert van der Helm 8873c11e1d Move watchdog timer disable check to common/utils
We may also want to check this from the plugin.
2021-06-22 17:15:47 +02:00
Robbert van der Helm c2b8626ec5 Rearrange declarations to match implementations 2021-06-22 17:15:47 +02:00
Robbert van der Helm 4d58adb83f Prevent against environment modifications
Should not be necessary here, but better safe than sorry.
2021-06-16 01:11:36 +02:00
Robbert van der Helm 9c439b62e3 Ignore REAPER host function API requests
Apparently there is a plugin that uses these.
2021-06-12 17:22:47 +02:00
Robbert van der Helm 14ee304256 Silence spurious maybe unused errors
These only show up during unity builds, and they originate from
Boost.Container's small vector. The compiler's diagnostic also doesn't
make any sense here so it's probably just a weird GCC thing.
2021-06-12 00:35:59 +02:00
Robbert van der Helm b4e0941473 Don't cache reconstructed VST3 events at all
There's no need to since reconstructing the event is very cheap, and
this should be faster (less memory used) and also less error prone
anyways.
2021-06-11 18:18:13 +02:00
Robbert van der Helm fe29def33f Clear reconstructed VST3 events on deserialization
This fixes a regression from 964c150158,
because now the old reconstructed events buffer will stay alive.
2021-06-11 18:13:22 +02:00
Robbert van der Helm 9c30d64975 Fix speaker arrangement bitsets
The sizes were wrong, and Blue Cat Audio's VST3 plugins seem to use the
upper bits to store the channel configuration, which thus got read out
incorrectly.
2021-06-11 17:22:46 +02:00
Robbert van der Helm aaf3e7438c Use unordered maps for VST3 plugin instances
The better algorithmic time complexity should help when using many (say,
hundreds) of instances of a single VST3 plugin.
2021-06-11 14:48:28 +02:00
Robbert van der Helm dec19dc12a 💥 Reimplement VST3 audio processing
In the same way as 50c25c1cf0 did it for
VST2 plugins. Input and output audio data is now stored in a shared
memory buffer instead of being sent over the sockets. This reduces the
bridging overhead to a minimum since copying data was the most expensive
operation we were doing and we now only need to copy the entire buffer
once per processing cycle.
2021-06-11 13:59:37 +02:00
Robbert van der Helm a7d8063db4 Add getters for channel counts in audio buffers 2021-06-11 13:38:29 +02:00
Robbert van der Helm 340d376564 Add constant overloads for audio buffer pointers 2021-06-11 12:58:46 +02:00
Robbert van der Helm 964c150158 Use the in new place optional extension 2021-06-10 23:44:47 +02:00
Robbert van der Helm f5214b7686 Add an in place std::optional bitsery extension
To avoid unnecessarily recreating the object during deserialization.
This has also been upstreamed to
https://github.com/fraillt/bitsery/pull/78.
2021-06-10 23:43:45 +02:00
Robbert van der Helm 14e3ed2cd3 Add shared audio buffers config to IAudioProcessor::setupProcessing() 2021-06-10 21:37:42 +02:00
Robbert van der Helm 50c25c1cf0 💥 Reimplement VST2 audio processing
We now use shared memory to store the input and output audio buffers.
This means that we have to copy less data every processing cycle, since
a single copy to and a single copy from the shared memory object
suffices now. This should reduce the DSP load for VST2
plugins (especially when used in a plugin group) marginally to
significantly depending on the plugins used and the system
configuration.
2021-06-10 17:31:32 +02:00
Robbert van der Helm 1bc804965c Clean up lambdas in VST2 variant visitors 2021-06-10 16:53:55 +02:00
Robbert van der Helm f99781c1b2 Make getting channel pointers noexcept
There should be no bounds checks in release mode anyways, and we'll
trust ourselves that this will be a simple lookup.
2021-06-10 16:09:55 +02:00
Robbert van der Helm 0370c64f99 Allow resizing shared memory buffers 2021-06-10 16:09:55 +02:00
Robbert van der Helm 23d99411c8 Define the Ack message in serialization/common.h
We're going to need this for VST2 audio processing.
2021-06-10 16:09:55 +02:00
Robbert van der Helm 503d8248c2 Refactor VST2 serialization primitives
Bundle all serialization function with the structs whenever possible to
simplify the serialization function, and add `Foo::Response` types so we
can make the `passthrough_event()` function slightly more type safe.
2021-06-10 13:13:01 +02:00
Robbert van der Helm cacfc0b379 Fix serializing VST2 speaker arrangements 2021-06-10 13:05:47 +02:00
Robbert van der Helm 5a38a2e482 Lock mapped shared memory for audio buffers 2021-06-10 01:35:43 +02:00
Robbert van der Helm a3aaeaa9a9 Mention that busses and channels are zero indexed 2021-06-09 20:47:52 +02:00
Robbert van der Helm 2210cb4fc3 Implement move semantics for shared audio buffer 2021-06-09 20:35:47 +02:00
Robbert van der Helm 9d11b501cd Add a shared memory based audio buffer
We'll be using this to reduce the amount of copying we have to do during
audio processing.
2021-06-09 20:06:57 +02:00
Robbert van der Helm e36a7e7e72 Add the effSetProcessPrecision opcode 2021-06-09 18:41:34 +02:00
Robbert van der Helm 70d18edce2 Fix version strings when building from tarball
When that tarball has been extracted in an (unrelated) git repository.
2021-06-09 16:19:01 +02:00
Robbert van der Helm c97595a391 Mark Vst{2,3}Sockets as final
Since we're calling a virtual method during the destructor.
2021-06-09 13:04:51 +02:00
Robbert van der Helm 7c9cd7b9e5 Fix uninitialized timed caches
This could prevent resizeable plugins from being resizeable in Ardour if
the initialized timestamp just happened to be greater than the current
time, since the returned result would then likely be some invalid value.
2021-06-09 12:31:03 +02:00
Robbert van der Helm a7496fae77 Add thread names 2021-06-06 23:45:47 +02:00
Robbert van der Helm 3baccf885d Remove old todo 2021-06-01 18:18:44 +02:00
Robbert van der Helm 5f4ffed90b Prevent allocations in Vst3Logger::log_query_interface
String constants will be converted to `std::string` because it's not
constexpr yet, and that will allocate for longer strings. Since this
function only prints something when `YABRIDGE_DEBUG_LEVEL` is set to 2
or higher that seems like a waste.
2021-05-31 18:07:19 +02:00
Robbert van der Helm 2bf1c4c5eb Use C++20 [[unlikely]] instead of BOOST_UNLIKELY 2021-05-31 17:50:02 +02:00
Robbert van der Helm 6a047497bc Only print query interface messages on log level 2 2021-05-31 17:44:43 +02:00
Robbert van der Helm 70467a31dc Fix compilation under GCC 11 2021-05-30 17:54:45 +02:00
Robbert van der Helm b3d5a39001 Fix debug builds after small vector optimization 2021-05-30 00:05:36 +02:00
Robbert van der Helm b4c9f53bcf Fix typo in the in place std::variant<> extension
We of course want to do this for non-trivial types as mentioned in the
comment above, not for trivial types...
2021-05-28 14:17:35 +02:00
Robbert van der Helm f533dd40ce Make the in place std::variant<> extension smarter
With the suggestions to use `std::get_if<>` and to only do this for
nontrivial types from
https://github.com/fraillt/bitsery/issues/76#issuecomment-850371533.
2021-05-28 14:11:50 +02:00
Robbert van der Helm 0d3850e837 Add a function for fetching the RTTIME limit
We can use this to more easily diagnose issues caused by PipeWire.
2021-05-27 13:58:19 +02:00
Robbert van der Helm 4d5b2fcb12 Add missing quotes in IEditController::getParamValueByString() log message 2021-05-23 19:45:29 +02:00
Robbert van der Helm 1464ec2ab0 Use text2b instead of container2b for u16string
Should be equivalent. The only reason why we use container2b in some
places is because strings based on `Steinberg::char16` arrays will have
an incorrect length on the Wine side, because character traits for
`wchar_t` is still reflects Linux instead of Windows there.
2021-05-23 19:33:27 +02:00
Robbert van der Helm 95de9ea0bf Set a better maximum on text in strings in events 2021-05-23 19:30:34 +02:00
Robbert van der Helm 0b9b1330ad Make sure effProcessEvents() also never allocates
This basically changes the default small vectors during VST2 event
processing from 256 bytes to the size of a `DynamicVstEvents`
object (which also includes a small_vector to hold MIDI events without
allocating) and makes them thread local. We already have a similar
optimization for VST3. There it's a bit neater since we already had to
separate audio processing functions from non-time critical functions.
Here we don't have that separation, so we just made these buffers thread
local, large enough to hold our predefined number of events, and we then
just shrink them to fit if these buffers grow even more (which can only
happen after reading or writing chunk data).

The change doesn't specifically target `effProcessEvents()`, but that's
where you would see the differences. This is also relevant for
`audioMasterProcessEvents()`.
2021-05-23 17:37:09 +02:00