Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vst3 io fixes #389

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 24 additions & 24 deletions distrho/src/DistrhoPluginVST3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1446,13 +1446,17 @@ class PluginVst3
#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
Expand All @@ -1465,13 +1469,17 @@ class PluginVst3
#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
Expand Down Expand Up @@ -2802,6 +2810,7 @@ class PluginVst3

// d_debug("setAudioBusArrangement %d %d | %d %lx", (int)isInput, numBuses, busId, arr);

size_t nth_speaker = 0;
for (uint32_t i=0; i<numPorts; ++i)
{
AudioPortWithBusId& port(fPlugin.getAudioPort(isInput, i));
Expand All @@ -2812,18 +2821,9 @@ class PluginVst3
continue;
}

// get the only valid speaker arrangement for this bus, assuming enabled
const v3_speaker_arrangement earr = getSpeakerArrangementForAudioPort<isInput>(busInfo, port.groupId, busId);

// fail if host tries to map it to anything else
// FIXME should we allow to map speaker to zero as a way to disable it?
if (earr != arr /* && arr != 0 */)
{
ok = false;
continue;
}

enabledPorts[i] = arr != 0;
v3_speaker_arrangement earr = (uint64_t)1 << nth_speaker;
enabledPorts[i] = 0 != (arr & earr);
++nth_speaker;
}
}

Expand Down