diff options
author | Robin Gareus <robin@gareus.org> | 2022-11-24 19:28:28 +0100 |
---|---|---|
committer | falkTX <falktx@falktx.com> | 2022-11-24 18:48:20 +0000 |
commit | 36f018dacdcb96a7e858f2c078e6b876b1921119 (patch) | |
tree | d5745a08891c95fc426d8455744f29a76603e2e2 | |
parent | b96b49329ab217b0f041a0051c8a57a0573ba24c (diff) |
VST3 channel buffers are per bus
Previously all inputs (num_channels) were assumed to be
on the first bus. However Vst::ProcessData's input/output
is an array pointing to instances of Vst::AudioBusBuffers
(not a pointer to a single instance).
This fixes CV ports (optional busses) for Cardinal VST3,
and likely also sidechain inputs for other processors.
-rw-r--r-- | distrho/src/DistrhoPluginVST3.cpp | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/distrho/src/DistrhoPluginVST3.cpp b/distrho/src/DistrhoPluginVST3.cpp index b81c5959..647a500b 100644 --- a/distrho/src/DistrhoPluginVST3.cpp +++ b/distrho/src/DistrhoPluginVST3.cpp @@ -1446,13 +1446,17 @@ public: #if DISTRHO_PLUGIN_NUM_INPUTS > 0 if (data->inputs != nullptr) { - for (int32_t j = 0; j < data->inputs->num_channels; ++j) - { - while (!fEnabledInputs[i] && i < DISTRHO_PLUGIN_NUM_INPUTS) - inputs[i++] = fDummyAudioBuffer; + for (int32_t b = 0; b < data->num_input_buses; ++b) { + for (int32_t j = 0; j < data->inputs[b].num_channels; ++j) + { + DISTRHO_SAFE_ASSERT_INT_BREAK(i < DISTRHO_PLUGIN_NUM_INPUTS, i); + if (!fEnabledInputs[i] && i < DISTRHO_PLUGIN_NUM_INPUTS) { + inputs[i++] = fDummyAudioBuffer; + continue; + } - DISTRHO_SAFE_ASSERT_INT_BREAK(i < DISTRHO_PLUGIN_NUM_INPUTS, i); - inputs[i++] = data->inputs->channel_buffers_32[j]; + inputs[i++] = data->inputs[b].channel_buffers_32[j]; + } } } #endif @@ -1465,13 +1469,17 @@ public: #if DISTRHO_PLUGIN_NUM_OUTPUTS > 0 if (data->outputs != nullptr) { - for (int32_t j = 0; j < data->outputs->num_channels; ++j) - { - while (!fEnabledOutputs[i] && i < DISTRHO_PLUGIN_NUM_OUTPUTS) - outputs[i++] = fDummyAudioBuffer; + for (int32_t b = 0; b < data->num_output_buses; ++b) { + for (int32_t j = 0; j < data->outputs[b].num_channels; ++j) + { + DISTRHO_SAFE_ASSERT_INT_BREAK(i < DISTRHO_PLUGIN_NUM_OUTPUTS, i); + if (!fEnabledOutputs[i] && i < DISTRHO_PLUGIN_NUM_OUTPUTS) { + outputs[i++] = fDummyAudioBuffer; + continue; + } - DISTRHO_SAFE_ASSERT_INT_BREAK(i < DISTRHO_PLUGIN_NUM_OUTPUTS, i); - outputs[i++] = data->outputs->channel_buffers_32[j]; + outputs[i++] = data->outputs[b].channel_buffers_32[j]; + } } } #endif |