Browse Source

VST3: Add support for 5/6/7-order ambisonics from VST 3.7.8

v7.0.9
reuk 2 years ago
parent
commit
974795ed7a
No known key found for this signature in database GPG Key ID: FCB43929F012EE5C
2 changed files with 27 additions and 1 deletions
  1. +1
    -1
      modules/juce_audio_basics/buffers/juce_AudioChannelSet.cpp
  2. +26
    -0
      modules/juce_audio_processors/format_types/juce_VST3Common.h

+ 1
- 1
modules/juce_audio_basics/buffers/juce_AudioChannelSet.cpp View File

@@ -586,7 +586,7 @@ AudioChannelSet AudioChannelSet::ambisonic (int order)
return numToSet;
};
const auto numAmbisonicChannels = (order + 1) * (order + 1);
const auto numAmbisonicChannels = square (order + 1);
for (int rangeIdx = 0, bitsSet = 0; bitsSet < numAmbisonicChannels; ++rangeIdx)
{


+ 26
- 0
modules/juce_audio_processors/format_types/juce_VST3Common.h View File

@@ -478,6 +478,24 @@ static std::optional<Array<AudioChannelSet::ChannelType>> getSpeakerOrder (Stein
return {};
}
struct Ambisonics
{
struct Mapping
{
Steinberg::Vst::SpeakerArrangement arrangement;
AudioChannelSet channelSet;
};
inline static const Mapping mappings[]
{
{ Steinberg::Vst::SpeakerArr::kAmbi5thOrderACN, AudioChannelSet::ambisonic (5) },
{ Steinberg::Vst::SpeakerArr::kAmbi6thOrderACN, AudioChannelSet::ambisonic (6) },
{ Steinberg::Vst::SpeakerArr::kAmbi7thOrderACN, AudioChannelSet::ambisonic (7) },
};
Ambisonics() = delete;
};
static std::optional<Steinberg::Vst::SpeakerArrangement> getVst3SpeakerArrangement (const AudioChannelSet& channels) noexcept
{
using namespace Steinberg::Vst::SpeakerArr;
@@ -504,6 +522,10 @@ static std::optional<Steinberg::Vst::SpeakerArrangement> getVst3SpeakerArrangeme
if (getChannelCount (result) == channels.size())
return result;
for (const auto& mapping : Ambisonics::mappings)
if (channels == mapping.channelSet)
return mapping.arrangement;
return {};
}
@@ -514,6 +536,10 @@ inline std::optional<AudioChannelSet> getChannelSetForSpeakerArrangement (Steinb
if (const auto order = getSpeakerOrder (arr))
return AudioChannelSet::channelSetWithChannels (*order);
for (const auto& mapping : Ambisonics::mappings)
if (arr == mapping.arrangement)
return mapping.channelSet;
// VST3 <-> JUCE layout conversion error: report this bug to the JUCE forum
return {};
}


Loading…
Cancel
Save