mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-07 20:10:13 +02:00
Do small vector optimization for all communication
I once read years ago somewhere on Stack Overflow that `std::vectors` with that are preinitialized to a default size would allocate the initial capacity on the stack. This of course doesn't make any sense (run time sized stack allocations can cause all kinds of issues), so we were still allocating with our default 64-byte sized buffers, but just not as often.
This commit is contained in:
@@ -593,7 +593,7 @@ void Vst2PluginBridge::do_process(T** inputs, T** outputs, int sample_frames) {
|
||||
}
|
||||
|
||||
// The inputs and outputs arrays should be `[num_inputs][sample_frames]` and
|
||||
// `[num_outputs][sample_frames]` floats large respectfully.
|
||||
// `[num_outputs][sample_frames]` floats large respectfully
|
||||
std::vector<std::vector<T>> input_buffers(plugin.numInputs,
|
||||
std::vector<T>(sample_frames));
|
||||
for (int channel = 0; channel < plugin.numInputs; channel++) {
|
||||
|
||||
@@ -154,10 +154,11 @@ class Vst2PluginBridge : PluginBridge<Vst2Sockets<std::jthread>> {
|
||||
Vst2Logger logger;
|
||||
|
||||
/**
|
||||
* A scratch buffer for sending and receiving data during `process`,
|
||||
* `processReplacing` and `processDoubleReplacing` calls.
|
||||
* A scratch buffer for sending and receiving binary data during the
|
||||
* `process()`, `processReplacing()` and `processDoubleReplacing()` calls.
|
||||
* This buffer also needs to stay alive.
|
||||
*/
|
||||
std::vector<uint8_t> process_buffer;
|
||||
SerializationBuffer<0> process_buffer;
|
||||
|
||||
/**
|
||||
* We'll periodically synchronize the Wine host's audio thread priority with
|
||||
|
||||
Reference in New Issue
Block a user