diff --git a/src/detail/vst3/process.cpp b/src/detail/vst3/process.cpp index 2427afab..c1d6412a 100644 --- a/src/detail/vst3/process.cpp +++ b/src/detail/vst3/process.cpp @@ -391,19 +391,27 @@ void ProcessAdapter::process(Steinberg::Vst::ProcessData& data) auto inbusses = _audioinputs->size(); for (auto i = 0U; i < inbusses; ++i) { - if (_vstdata->inputs[i].numChannels > 0) + if (_vstdata->inputs[i].numChannels == (Steinberg::int32)_input_ports[i].channel_count) + { _input_ports[i].data32 = _vstdata->inputs[i].channelBuffers32; + } else + { doProcess = false; + } } auto outbusses = _audiooutputs->size(); for (auto i = 0U; i < outbusses; ++i) { - if (_vstdata->outputs[i].numChannels > 0) + if (_vstdata->outputs[i].numChannels == (Steinberg::int32)_output_ports[i].channel_count) + { _output_ports[i].data32 = _vstdata->outputs[i].channelBuffers32; + } else + { doProcess = false; + } } if (doProcess) _plugin->process(_plugin, &_processData); diff --git a/src/wrapasvst3.cpp b/src/wrapasvst3.cpp index 9ab0dc20..f26b1af1 100644 --- a/src/wrapasvst3.cpp +++ b/src/wrapasvst3.cpp @@ -1486,3 +1486,33 @@ void ClapAsVst3::clearContextMenu() vst3ContextMenu.reset(); contextmenuitems.clear(); } + +tresult ClapAsVst3::getBusInfo(Vst::MediaType type, Vst::BusDirection dir, int32 index, + Vst::BusInfo& bus) +{ + if (_plugin->_ext._audioports) + { + if (type == Vst::kAudio) + { + clap_audio_port_info_t info; + if (_plugin->_ext._audioports->get(_plugin->_plugin, (uint32_t)index, (dir == Vst::kInput), &info)) + { + bus.mediaType = Vst::kAudio; + bus.channelCount = info.channel_count; + bus.direction = dir; + bus.busType = (info.flags & CLAP_AUDIO_PORT_IS_MAIN) ? Vst::kMain : Vst::kAux; + bus.flags = Vst::BusInfo::kDefaultActive; + + UString wrapper(&bus.name[0], str16BufferSize(Steinberg::Vst::String128)); + wrapper.assign(info.name, (Steinberg::int32)CLAP_NAME_SIZE); + + return kResultOk; + } + else + { + return kResultFalse; + } + } + } + return SingleComponentEffect::getBusInfo(type, dir, index, bus); +} diff --git a/src/wrapasvst3.h b/src/wrapasvst3.h index 251d9f3b..9444203a 100644 --- a/src/wrapasvst3.h +++ b/src/wrapasvst3.h @@ -152,6 +152,8 @@ class ClapAsVst3 : public Steinberg::Vst::SingleComponentEffect, Vst::SpeakerArrangement* outputs, int32 numOuts) override; tresult PLUGIN_API getBusArrangement(Vst::BusDirection dir, int32 index, Vst::SpeakerArrangement& arr) override; + tresult PLUGIN_API getBusInfo(Vst::MediaType type, Vst::BusDirection dir, int32 index, + Vst::BusInfo& bus) override; tresult PLUGIN_API activateBus(Vst::MediaType type, Vst::BusDirection dir, int32 index, TBool state) override;