From 79c6601fd435efd98017a9ea42c18a54bc2cc82d Mon Sep 17 00:00:00 2001 From: falkTX Date: Wed, 10 Aug 2022 02:01:08 +0100 Subject: [PATCH] Try to make sense of vst3 non-conventional speaker arrangements --- distrho/src/DistrhoPluginVST3.cpp | 35 ++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/distrho/src/DistrhoPluginVST3.cpp b/distrho/src/DistrhoPluginVST3.cpp index 43694638..6244b7c0 100644 --- a/distrho/src/DistrhoPluginVST3.cpp +++ b/distrho/src/DistrhoPluginVST3.cpp @@ -2619,6 +2619,24 @@ private: return V3_OK; } + // someone please tell me what is up with these.. + static inline v3_speaker_arrangement indexToSpeaker(const uint32_t index) + { + switch (index) + { + case 0: return 1ull << 23ull; + case 1: return 1ull << 22ull; + case 2: return 1ull << 20ull; + case 3: return 1ull << 21ull; + case 4: return 1ull << 28ull; + case 5: return 1ull << 29ull; + case 6: return 1ull << 30ull; + case 7: return 1ull << 31ull; + case 8: return 1ull << 32ull; + default: return 1ull << (index - 8ull + 33ull); + } + } + template v3_speaker_arrangement getSpeakerArrangementForAudioPort(const BusInfo& busInfo, const uint32_t portGroupId, uint32_t busId) const noexcept { @@ -2636,7 +2654,7 @@ private: { const uint32_t numPortsInBus = fPlugin.getAudioPortCountWithGroupId(isInput, busId); for (uint32_t j=0; j 0 ? fEnabledInputs @@ -2679,6 +2696,7 @@ private: #else : nullptr; #endif + */ for (uint32_t i=0; i(busInfo, port.groupId, busId); // d_stdout("getAudioBusArrangement %d enabled by value %lx", busId, *speaker); @@ -2744,7 +2764,8 @@ private: const v3_speaker_arrangement earr = getSpeakerArrangementForAudioPort(busInfo, port.groupId, busId); // fail if host tries to map it to anything else - if (earr != arr && arr != 0) + // FIXME should we allow to map speaker to zero as a way to disable it? + if (earr != arr /* && arr != 0 */) { ok = false; continue;