Hi

I found some error in the juce_VST3Common.h channel types wrappers with Vst::Speaker types Sl/Sr and Lcs/Rcs being mixed up. One of the consequences being that Dolby Atmos arrangements such as 7.1.2 or 7.1.4 can’t be used in VST3.

So, basically, the following code:

```
static inline AudioChannelSet::ChannelType getChannelType (Steinberg::Vst::SpeakerArrangement arr, Steinberg::Vst::Speaker type) noexcept
{
using namespace Steinberg::Vst;
switch (type)
{
/* ... */
case kSpeakerCs: return AudioChannelSet::centreSurround;
case kSpeakerSl: return AudioChannelSet::leftSurroundRear;
case kSpeakerSr: return AudioChannelSet::rightSurroundRear;
case (1ull << 11): return AudioChannelSet::topMiddle; /* kSpeakerTm */
case kSpeakerTfl: return AudioChannelSet::topFrontLeft;
case kSpeakerTfc: return AudioChannelSet::topFrontCentre;
/* ... */
case (1ull << 49): return AudioChannelSet::ambisonicACN15; /* kSpeakerACN15 */
case (1ull << 24): return AudioChannelSet::topSideLeft; /* kSpeakerTsl */
case (1ull << 25): return AudioChannelSet::topSideRight; /* kSpeakerTsr */
case (1ull << 26): return AudioChannelSet::leftSurroundSide; /* kSpeakerLcs */
case (1ull << 27): return AudioChannelSet::rightSurroundSide; /* kSpeakerRcs */
/* ... */
}
/* ... */
}
static inline Steinberg::Vst::Speaker getSpeakerType (const AudioChannelSet& set, AudioChannelSet::ChannelType type) noexcept
{
using namespace Steinberg::Vst;
switch (type)
{
/* ... */
case AudioChannelSet::leftSurroundSide: return (1ull << 26); /* kSpeakerLcs */
case AudioChannelSet::rightSurroundSide: return (1ull << 27); /* kSpeakerRcs */
case AudioChannelSet::topMiddle: return (1ull << 11); /* kSpeakerTm */
/* ... */
case AudioChannelSet::LFE2: return kSpeakerLfe2;
case AudioChannelSet::leftSurroundRear: return kSpeakerSl;
case AudioChannelSet::rightSurroundRear: return kSpeakerSr;
case AudioChannelSet::wideLeft: return kSpeakerPl;
case AudioChannelSet::wideRight: return kSpeakerPr;
/* ... */
default:
break;
}
/* ... */
}
```

should become:

```
static inline AudioChannelSet::ChannelType getChannelType (Steinberg::Vst::SpeakerArrangement arr, Steinberg::Vst::Speaker type) noexcept
{
using namespace Steinberg::Vst;
switch (type)
{
/* ... */
case kSpeakerCs: return AudioChannelSet::centreSurround;
case kSpeakerSl: return AudioChannelSet::leftSurroundSide;
case kSpeakerSr: return AudioChannelSet::rightSurroundSide;
case (1ull << 11): return AudioChannelSet::topMiddle; /* kSpeakerTm */
case kSpeakerTfl: return AudioChannelSet::topFrontLeft;
case kSpeakerTfc: return AudioChannelSet::topFrontCentre;
/* ... */
case (1ull << 49): return AudioChannelSet::ambisonicACN15; /* kSpeakerACN15 */
case (1ull << 24): return AudioChannelSet::topSideLeft; /* kSpeakerTsl */
case (1ull << 25): return AudioChannelSet::topSideRight; /* kSpeakerTsr */
case (1ull << 26): return AudioChannelSet::leftSurroundRear; /* kSpeakerLcs */
case (1ull << 27): return AudioChannelSet::rightSurroundRear; /* kSpeakerRcs */
/* ... */
}
/* ... */
}
static inline Steinberg::Vst::Speaker getSpeakerType (const AudioChannelSet& set, AudioChannelSet::ChannelType type) noexcept
{
using namespace Steinberg::Vst;
switch (type)
{
/* ... */
case AudioChannelSet::leftSurroundSide: return kSpeakerSl;
case AudioChannelSet::rightSurroundSide: return kSpeakerSr;
case AudioChannelSet::topMiddle: return (1ull << 11); /* kSpeakerTm */
/* ... */
case AudioChannelSet::LFE2: return kSpeakerLfe2;
case AudioChannelSet::leftSurroundRear: return (1ull << 26); /* kSpeakerLcs */
case AudioChannelSet::rightSurroundRear: return (1ull << 27); /* kSpeakerRcs */
case AudioChannelSet::wideLeft: return kSpeakerPl;
case AudioChannelSet::wideRight: return kSpeakerPr;
/* ... */
default:
break;
}
/* ... */
}
```

Can you please fix it ?

Steinberg Speaker types positions diagram below as a reminder:

Thanks

Fred

Merging Technologies