diff --git a/gtk2_ardour/plugin_pin_dialog.cc b/gtk2_ardour/plugin_pin_dialog.cc index 35e5b8e6eb..1db51ecba3 100644 --- a/gtk2_ardour/plugin_pin_dialog.cc +++ b/gtk2_ardour/plugin_pin_dialog.cc @@ -1636,9 +1636,22 @@ PluginPinWidget::add_remove_port_clicked (bool add, ARDOUR::DataType dt) ChanCount out = _out; ChanCount sinks = _sinks; assert (add || out.get (dt) > 0); + uint32_t n_before = std::min (out.get (dt), _sources.get (dt) * _n_plugins); out.set (dt, out.get (dt) + (add ? 1 : -1)); if (!_route ()->customize_plugin_insert (_pi, _n_plugins, out, sinks)) { error_message_dialog (_("Failed to alter plugin output configuration.")); + } else if (add && dt == DataType::AUDIO) { + ChanCount ins, outs, src; + _pi->configured_io (ins, outs); + src = _pi->natural_output_streams (); + for (uint32_t i = n_before; i < outs.get (dt); ++i) { + uint32_t pc = i / src.get (dt); + uint32_t pn = i % src.get (dt); + assert (pc <= _n_plugins); + ChanMapping map (_pi->output_map (pc)); + map.set (dt, pn, pn); + _pi->set_output_map (pc, map); + } } }