mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-06-14 23:43:52 +02:00
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()`.
This commit is contained in:
@@ -621,13 +621,14 @@ class HostCallbackDataConverter : public DefaultDataConverter {
|
||||
|
||||
Vst2EventResult send_event(
|
||||
boost::asio::local::stream_protocol::socket& socket,
|
||||
const Vst2Event& event) const override {
|
||||
const Vst2Event& event,
|
||||
SerializationBufferBase& buffer) const override {
|
||||
if (mutually_recursive_callbacks.contains(event.opcode)) {
|
||||
return mutual_recursion.fork([&]() {
|
||||
return DefaultDataConverter::send_event(socket, event);
|
||||
return DefaultDataConverter::send_event(socket, event, buffer);
|
||||
});
|
||||
} else {
|
||||
return DefaultDataConverter::send_event(socket, event);
|
||||
return DefaultDataConverter::send_event(socket, event, buffer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user