13
0

VST3: match pin-mapping with VST speaker-arrangement

This enables all channels left of the last connected pin
for each given bus. e.g. when using just the 2nd (right)
input of a given bus, the plugin is configure in stereo
mode, with the 1st (left) input being fed with silence.

VST3 does not have a "right-channel mono" configuration.

It is also preferable to have Ardour do the pin/channel
mapping.
This commit is contained in:
Robin Gareus 2023-03-17 15:46:34 +01:00
parent 03263950b7
commit 2a3eb6dc88
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -2137,15 +2137,18 @@ VST3PI::enable_io (std::vector<bool> const& ins, std::vector<bool> const& outs)
while (sa_in.size () < (VSTSpeakerArrangements::size_type) _n_bus_in) { while (sa_in.size () < (VSTSpeakerArrangements::size_type) _n_bus_in) {
bool enable = false; bool enable = false;
int32_t const n_chn = _bus_info_in[sa_in.size ()].n_chn;
Vst::SpeakerArrangement sa = 0; Vst::SpeakerArrangement sa = 0;
_bus_info_in[sa_in.size ()].n_used_chn = 0; _bus_info_in[sa_in.size ()].n_used_chn = 0;
for (int i = 0; i < _bus_info_in[sa_in.size ()].n_chn; ++i) { /* use all channels before the last connected one */
if (ins[cnt++]) { for (int32_t i = n_chn - 1; i >= 0; --i) {
if (ins[cnt + i] || enable) {
sa |= (uint64_t)1 << i; sa |= (uint64_t)1 << i;
++_bus_info_in[sa_in.size ()].n_used_chn; ++_bus_info_in[sa_in.size ()].n_used_chn;
enable = true; enable = true;
} }
} }
cnt += n_chn;
/* special case for Left only == Mono */ /* special case for Left only == Mono */
if (sa == 1 /*Vst::SpeakerArr::kSpeakerL */) { if (sa == 1 /*Vst::SpeakerArr::kSpeakerL */) {
sa = Vst::SpeakerArr::kMono; /* 1 << 19 */ sa = Vst::SpeakerArr::kMono; /* 1 << 19 */
@ -2159,15 +2162,17 @@ VST3PI::enable_io (std::vector<bool> const& ins, std::vector<bool> const& outs)
cnt = 0; cnt = 0;
while (sa_out.size () < (VSTSpeakerArrangements::size_type) _n_bus_out) { while (sa_out.size () < (VSTSpeakerArrangements::size_type) _n_bus_out) {
bool enable = false; bool enable = false;
int32_t const n_chn = _bus_info_out[sa_out.size ()].n_chn;
Vst::SpeakerArrangement sa = 0; Vst::SpeakerArrangement sa = 0;
_bus_info_out[sa_out.size ()].n_used_chn = 0; _bus_info_out[sa_out.size ()].n_used_chn = 0;
for (int i = 0; i < _bus_info_out[sa_out.size ()].n_chn; ++i) { for (int32_t i = n_chn - 1; i >= 0; --i) {
if (outs[cnt++]) { if (outs[cnt + i] || enable) {
sa |= (uint64_t)1 << i; sa |= (uint64_t)1 << i;
++_bus_info_out[sa_out.size ()].n_used_chn; ++_bus_info_out[sa_out.size ()].n_used_chn;
enable = true; enable = true;
} }
} }
cnt += n_chn;
/* special case for Left only == Mono */ /* special case for Left only == Mono */
if (sa == 1 /*Vst::SpeakerArr::kSpeakerL */) { if (sa == 1 /*Vst::SpeakerArr::kSpeakerL */) {
sa = Vst::SpeakerArr::kMono; /* 1 << 19 */ sa = Vst::SpeakerArr::kMono; /* 1 << 19 */