}
void
-MixerStrip::bundle_input_toggled (boost::shared_ptr<ARDOUR::Bundle> c)
+MixerStrip::bundle_input_chosen (boost::shared_ptr<ARDOUR::Bundle> c)
{
if (ignore_toggle) {
return;
ARDOUR::BundleList current = _route->input()->bundles_connected ();
if (std::find (current.begin(), current.end(), c) == current.end()) {
- _route->input()->connect_ports_to_bundle (c, this);
+ _route->input()->connect_ports_to_bundle (c, true, this);
} else {
_route->input()->disconnect_ports_from_bundle (c, this);
}
}
void
-MixerStrip::bundle_output_toggled (boost::shared_ptr<ARDOUR::Bundle> c)
+MixerStrip::bundle_output_chosen (boost::shared_ptr<ARDOUR::Bundle> c)
{
if (ignore_toggle) {
return;
ARDOUR::BundleList current = _route->output()->bundles_connected ();
if (std::find (current.begin(), current.end(), c) == current.end()) {
- _route->output()->connect_ports_to_bundle (c, this);
+ _route->output()->connect_ports_to_bundle (c, true, this);
} else {
_route->output()->disconnect_ports_from_bundle (c, this);
}
std::string n = b->name ();
replace_all (n, "_", " ");
- citems.push_back (CheckMenuElem (n, sigc::bind (sigc::mem_fun(*this, &MixerStrip::bundle_input_toggled), b)));
-
- if (std::find (current.begin(), current.end(), b) != current.end()) {
- ignore_toggle = true;
- dynamic_cast<CheckMenuItem *> (&citems.back())->set_active (true);
- ignore_toggle = false;
- }
+ citems.push_back (MenuElem (n, sigc::bind (sigc::mem_fun(*this, &MixerStrip::bundle_input_chosen), b)));
}
void
std::string n = b->name ();
replace_all (n, "_", " ");
- citems.push_back (CheckMenuElem (n, sigc::bind (sigc::mem_fun(*this, &MixerStrip::bundle_output_toggled), b)));
-
- if (std::find (current.begin(), current.end(), b) != current.end()) {
- ignore_toggle = true;
- dynamic_cast<CheckMenuItem *> (&citems.back())->set_active (true);
- ignore_toggle = false;
- }
+ citems.push_back (MenuElem (n, sigc::bind (sigc::mem_fun(*this, &MixerStrip::bundle_output_chosen), b)));
}
void
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 bundle_input_toggled (boost::shared_ptr<ARDOUR::Bundle>);
- void bundle_output_toggled (boost::shared_ptr<ARDOUR::Bundle>);
+ void bundle_input_chosen (boost::shared_ptr<ARDOUR::Bundle>);
+ void bundle_output_chosen (boost::shared_ptr<ARDOUR::Bundle>);
void edit_input_configuration ();
void edit_output_configuration ();
int ensure_io (ChanCount cnt, bool clear, void *src);
- int connect_ports_to_bundle (boost::shared_ptr<Bundle>, void *);
+ int connect_ports_to_bundle (boost::shared_ptr<Bundle>, bool exclusive, void *);
int disconnect_ports_from_bundle (boost::shared_ptr<Bundle>, void *);
BundleList bundles_connected ();
}
}
- _input->connect_ports_to_bundle (c, this);
+ _input->connect_ports_to_bundle (c, true, this);
} else if ((prop = node.property ("inputs")) != 0) {
if (_input->set_ports (prop->value())) {
if (prop) {
boost::shared_ptr<Bundle> b = find_possible_bundle (prop->value());
if (b) {
- connect_ports_to_bundle (b, this);
+ connect_ports_to_bundle (b, true, this);
}
}
}
int
-IO::connect_ports_to_bundle (boost::shared_ptr<Bundle> c, void* src)
+IO::connect_ports_to_bundle (boost::shared_ptr<Bundle> c, bool exclusive, void* src)
{
BLOCK_PROCESS_CALLBACK ();
{
Glib::Threads::Mutex::Lock lm2 (io_lock);
+ if (exclusive) {
+ for (PortSet::iterator i = _ports.begin(); i != _ports.end(); ++i) {
+ i->disconnect_all ();
+ }
+ }
+
c->connect (_bundle, _session.engine());
/* If this is a UserBundle, make a note of what we've done */
for (RouteList::iterator i = routes->begin(); i != routes->end(); ++i) {
(*i)->output()->disconnect (this);
- (*i)->output()->connect_ports_to_bundle (bundle, this);
+ (*i)->output()->connect_ports_to_bundle (bundle, false, this);
}
}
}
boost::shared_ptr<Bundle> b = bundle_by_name (Config->get_monitor_bus_preferred_bundle());
if (b) {
- _monitor_out->output()->connect_ports_to_bundle (b, this);
+ _monitor_out->output()->connect_ports_to_bundle (b, true, this);
} else {
warning << string_compose (_("The preferred I/O for the monitor bus (%1) cannot be found"),
Config->get_monitor_bus_preferred_bundle())