From e6d860041a0cc4dfad2958991e0e4da72bfdcd51 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Thu, 24 Nov 2022 19:31:33 +0100 Subject: [PATCH] Fix VST setAudioBusArrangement, en/disable individual ports Vst::SpeakerArrangement is a bitset with each bit corresponding to a port of the current bus. --- distrho/src/DistrhoPluginVST3.cpp | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/distrho/src/DistrhoPluginVST3.cpp b/distrho/src/DistrhoPluginVST3.cpp index 647a500b..6883bfe5 100644 --- a/distrho/src/DistrhoPluginVST3.cpp +++ b/distrho/src/DistrhoPluginVST3.cpp @@ -2810,6 +2810,7 @@ private: // d_debug("setAudioBusArrangement %d %d | %d %lx", (int)isInput, numBuses, busId, arr); + size_t nth_speaker = 0; for (uint32_t i=0; i(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; } }