diff --git a/libs/ardour/ardour/vst3_plugin.h b/libs/ardour/ardour/vst3_plugin.h index 4819453227..0591df8dfd 100644 --- a/libs/ardour/ardour/vst3_plugin.h +++ b/libs/ardour/ardour/vst3_plugin.h @@ -143,10 +143,11 @@ public: uint32_t n_audio_aux_out () const { return _n_aux_outputs; } struct AudioBusInfo { - AudioBusInfo (Vst::BusType t, int32_t c) : type (t), n_chn (c) {} + AudioBusInfo (Vst::BusType t, int32_t c, bool a) : type (t), n_chn (c), dflt (a) {} AudioBusInfo () : type (Vst::kMain), n_chn (0) {} Vst::BusType type; int32_t n_chn; + bool dflt; // kDefaultActive }; std::map const& bus_info_in () const { return _bus_info_in; } diff --git a/libs/ardour/vst3_plugin.cc b/libs/ardour/vst3_plugin.cc index b9181af7e6..686102d886 100644 --- a/libs/ardour/vst3_plugin.cc +++ b/libs/ardour/vst3_plugin.cc @@ -96,13 +96,19 @@ VST3Plugin::init () _plug->OnResizeView.connect_same_thread (_connections, boost::bind (&VST3Plugin::forward_resize_view, this, _1, _2)); _plug->OnParameterChange.connect_same_thread (_connections, boost::bind (&VST3Plugin::parameter_change_handler, this, _1, _2, _3)); - /* assume all I/O is connected by default */ - for (int32_t i = 0; i < (int32_t)_plug->n_audio_inputs (); ++i) { - _connected_inputs.push_back (true); + /* assume only default active busses are connected */ + for (auto const& abi : _plug->bus_info_in ()) { + for (int32_t i = 0; i < abi.second.n_chn; ++i) { + _connected_inputs.push_back (abi.second.dflt); + } } - for (int32_t i = 0; i < (int32_t)_plug->n_audio_outputs (); ++i) { - _connected_outputs.push_back (true); + + for (auto const& abi : _plug->bus_info_out ()) { + for (int32_t i = 0; i < abi.second.n_chn; ++i) { + _connected_outputs.push_back (abi.second.dflt); + } } + /* pre-configure from GUI thread */ _plug->enable_io (_connected_inputs, _connected_outputs); } @@ -1747,9 +1753,9 @@ VST3PI::count_channels (Vst::MediaType media, Vst::BusDirection dir, Vst::BusTyp n_channels += bus.channelCount; if (dir == Vst::kInput) { - _bus_info_in.insert (std::make_pair(i, AudioBusInfo (type, bus.channelCount))); + _bus_info_in.insert (std::make_pair(i, AudioBusInfo (type, bus.channelCount, bus.flags & Vst::BusInfo::kDefaultActive))); } else { - _bus_info_out.insert (std::make_pair(i, AudioBusInfo (type, bus.channelCount))); + _bus_info_out.insert (std::make_pair(i, AudioBusInfo (type, bus.channelCount, bus.flags & Vst::BusInfo::kDefaultActive))); } } }