mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-12 17:46:34 +01:00
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.
This commit is contained in:
parent
8119026bc8
commit
452e22e9c9
2 changed files with 23 additions and 4 deletions
|
|
@ -1118,23 +1118,41 @@ MixerStrip::maybe_add_bundle_to_input_menu (boost::shared_ptr<Bundle> b, ARDOUR:
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
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;
|
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;
|
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 ();
|
list<boost::shared_ptr<Bundle> >::iterator i = output_menu_bundles.begin ();
|
||||||
while (i != output_menu_bundles.end() && b->has_same_ports (*i) == false) {
|
while (i != output_menu_bundles.end() && b->has_same_ports (*i) == false) {
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i != output_menu_bundles.end()) {
|
if (i != output_menu_bundles.end()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Now add the bundle to the menu */
|
||||||
output_menu_bundles.push_back (b);
|
output_menu_bundles.push_back (b);
|
||||||
|
|
||||||
MenuList& citems = output_menu.items();
|
MenuList& citems = output_menu.items();
|
||||||
|
|
|
||||||
|
|
@ -236,7 +236,8 @@ private:
|
||||||
|
|
||||||
Gtk::Menu output_menu;
|
Gtk::Menu output_menu;
|
||||||
std::list<boost::shared_ptr<ARDOUR::Bundle> > output_menu_bundles;
|
std::list<boost::shared_ptr<ARDOUR::Bundle> > output_menu_bundles;
|
||||||
void maybe_add_bundle_to_output_menu (boost::shared_ptr<ARDOUR::Bundle>, ARDOUR::BundleList const &);
|
void maybe_add_bundle_to_output_menu (boost::shared_ptr<ARDOUR::Bundle>, ARDOUR::BundleList const &,
|
||||||
|
ARDOUR::DataType type = ARDOUR::DataType::NIL);
|
||||||
|
|
||||||
void bundle_input_chosen (boost::shared_ptr<ARDOUR::Bundle>);
|
void bundle_input_chosen (boost::shared_ptr<ARDOUR::Bundle>);
|
||||||
void bundle_output_chosen (boost::shared_ptr<ARDOUR::Bundle>);
|
void bundle_output_chosen (boost::shared_ptr<ARDOUR::Bundle>);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue