summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2012-10-18 16:15:11 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2012-10-18 16:15:11 +0000
commit2d9ed69fe2f8f35d81bb9bc33c8f4fa8393dd00a (patch)
tree82fe9f5e381c45e95962ba024bd87228a6f62047
parent3e59452fa0182ace7785c62acef83cb0d213cc86 (diff)
change input/output button context menus for mixer strip to be non-additive: when selecting a new IO bundle, disconnect from any existing connections before connecting to the new one (fixes #5087)
git-svn-id: svn://localhost/ardour2/branches/3.0@13308 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r--gtk2_ardour/mixer_strip.cc24
-rw-r--r--gtk2_ardour/mixer_strip.h4
-rw-r--r--libs/ardour/ardour/io.h2
-rw-r--r--libs/ardour/audio_track.cc2
-rw-r--r--libs/ardour/io.cc10
-rw-r--r--libs/ardour/route_group.cc2
-rw-r--r--libs/ardour/session.cc2
7 files changed, 20 insertions, 26 deletions
diff --git a/gtk2_ardour/mixer_strip.cc b/gtk2_ardour/mixer_strip.cc
index 848439ccd1..c4410438f9 100644
--- a/gtk2_ardour/mixer_strip.cc
+++ b/gtk2_ardour/mixer_strip.cc
@@ -874,7 +874,7 @@ MixerStrip::input_press (GdkEventButton *ev)
}
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;
@@ -883,14 +883,14 @@ MixerStrip::bundle_input_toggled (boost::shared_ptr<ARDOUR::Bundle> c)
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;
@@ -899,7 +899,7 @@ MixerStrip::bundle_output_toggled (boost::shared_ptr<ARDOUR::Bundle> c)
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);
}
@@ -930,13 +930,7 @@ MixerStrip::maybe_add_bundle_to_input_menu (boost::shared_ptr<Bundle> b, ARDOUR:
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
@@ -964,13 +958,7 @@ MixerStrip::maybe_add_bundle_to_output_menu (boost::shared_ptr<Bundle> b, ARDOUR
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
diff --git a/gtk2_ardour/mixer_strip.h b/gtk2_ardour/mixer_strip.h
index e5df59565c..eb29bdbf97 100644
--- a/gtk2_ardour/mixer_strip.h
+++ b/gtk2_ardour/mixer_strip.h
@@ -219,8 +219,8 @@ class MixerStrip : public RouteUI, public Gtk::EventBox
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 ();
diff --git a/libs/ardour/ardour/io.h b/libs/ardour/ardour/io.h
index 69297fff04..adad0c753f 100644
--- a/libs/ardour/ardour/io.h
+++ b/libs/ardour/ardour/io.h
@@ -94,7 +94,7 @@ class IO : public SessionObject, public Latent
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 ();
diff --git a/libs/ardour/audio_track.cc b/libs/ardour/audio_track.cc
index 2801a4e997..90439f46e9 100644
--- a/libs/ardour/audio_track.cc
+++ b/libs/ardour/audio_track.cc
@@ -176,7 +176,7 @@ AudioTrack::deprecated_use_diskstream_connections ()
}
}
- _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())) {
diff --git a/libs/ardour/io.cc b/libs/ardour/io.cc
index d39ba7b4f9..38b5fc717d 100644
--- a/libs/ardour/io.cc
+++ b/libs/ardour/io.cc
@@ -912,7 +912,7 @@ IO::make_connections (const XMLNode& node, int version, bool in)
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);
}
}
@@ -1241,13 +1241,19 @@ IO::latency () const
}
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 */
diff --git a/libs/ardour/route_group.cc b/libs/ardour/route_group.cc
index cb00df724a..ed684d3c9f 100644
--- a/libs/ardour/route_group.cc
+++ b/libs/ardour/route_group.cc
@@ -502,7 +502,7 @@ RouteGroup::make_subgroup (bool aux, Placement placement)
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);
}
}
}
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc
index 43fb4b6b5d..3a18b1f7f7 100644
--- a/libs/ardour/session.cc
+++ b/libs/ardour/session.cc
@@ -725,7 +725,7 @@ Session::add_monitor_section ()
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())