diff options
author | Julien "_FrnchFrgg_" RIVAUD <frnchfrgg@free.fr> | 2017-08-22 16:02:04 +0200 |
---|---|---|
committer | Julien "_FrnchFrgg_" RIVAUD <frnchfrgg@free.fr> | 2017-08-23 22:59:43 +0200 |
commit | 452e22e9c91b9872a59eba9f0c13199d5b32d34d (patch) | |
tree | fc9e9a61f3cbd115c4c411f586ff9dcd58a24d7b /gtk2_ardour/mixer_strip.cc | |
parent | 8119026bc8243a4d9a43dc459da6c1c0ca5031b3 (diff) |
Improve maybe_add_bundle_to_output_menu
Avoid proposing the monitor section in the list if the current route is
not the master bus. Also allow the caller to pass a DataType as argument
to allow partial bundle match on that datatype only.
Diffstat (limited to 'gtk2_ardour/mixer_strip.cc')
-rw-r--r-- | gtk2_ardour/mixer_strip.cc | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/gtk2_ardour/mixer_strip.cc b/gtk2_ardour/mixer_strip.cc index 7bb51f99b5..f459237000 100644 --- a/gtk2_ardour/mixer_strip.cc +++ b/gtk2_ardour/mixer_strip.cc @@ -1118,23 +1118,41 @@ MixerStrip::maybe_add_bundle_to_input_menu (boost::shared_ptr<Bundle> b, ARDOUR: } void -MixerStrip::maybe_add_bundle_to_output_menu (boost::shared_ptr<Bundle> b, ARDOUR::BundleList const& /*current*/) +MixerStrip::maybe_add_bundle_to_output_menu (boost::shared_ptr<Bundle> b, ARDOUR::BundleList const& /*current*/, + DataType type) { using namespace Menu_Helpers; - if (b->ports_are_inputs() == false || b->nchannels() != _route->n_outputs() || *b == *_route->input()->bundle()) { + /* The bundle should be an input one, but not ours */ + if (b->ports_are_inputs() == false || *b == *_route->input()->bundle()) { return; } + /* Don't add the monitor input unless we are Master */ + boost::shared_ptr<Route> monitor = _session->monitor_out(); + if ((!_route->is_master()) && monitor && b->has_same_ports (monitor->input()->bundle())) + return; + + /* It should either match exactly our outputs (if |type| is DataType::NIL) + * or have the same number of |type| channels than our outputs. */ + if (type == DataType::NIL) { + if(b->nchannels() != _route->n_outputs()) + return; + } else { + if (b->nchannels().n(type) != _route->n_outputs().n(type)) + return; + } + + /* Avoid adding duplicates */ list<boost::shared_ptr<Bundle> >::iterator i = output_menu_bundles.begin (); while (i != output_menu_bundles.end() && b->has_same_ports (*i) == false) { ++i; } - if (i != output_menu_bundles.end()) { return; } + /* Now add the bundle to the menu */ output_menu_bundles.push_back (b); MenuList& citems = output_menu.items(); |