+ _listen_cnt = listeners;
+
+ if (isolated != _solo_isolated_cnt) {
+ _solo_isolated_cnt = isolated;
+ IsolatedChanged (); /* EMIT SIGNAL */
+ }
+
+ DEBUG_TRACE (DEBUG::Solo, string_compose ("solo state updated by session, soloed? %1 listeners %2 isolated %3\n",
+ something_soloed, listeners, isolated));
+}
+
+boost::shared_ptr<RouteList>
+Session::get_routes_with_internal_returns() const
+{
+ boost::shared_ptr<RouteList> r = routes.reader ();
+ boost::shared_ptr<RouteList> rl (new RouteList);
+
+ for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
+ if ((*i)->internal_return ()) {
+ rl->push_back (*i);
+ }
+ }
+ return rl;
+}
+
+bool
+Session::io_name_is_legal (const std::string& name)
+{
+ boost::shared_ptr<RouteList> r = routes.reader ();
+
+ for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
+ if ((*i)->name() == name) {
+ return false;
+ }
+
+ if ((*i)->has_io_processor_named (name)) {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+void
+Session::set_exclusive_input_active (boost::shared_ptr<RouteList> rl, bool onoff, bool flip_others)
+{
+ RouteList rl2;
+ vector<string> connections;
+
+ /* if we are passed only a single route and we're not told to turn
+ * others off, then just do the simple thing.
+ */
+
+ if (flip_others == false && rl->size() == 1) {
+ boost::shared_ptr<MidiTrack> mt = boost::dynamic_pointer_cast<MidiTrack> (rl->front());
+ if (mt) {
+ mt->set_input_active (onoff);
+ return;
+ }
+ }
+
+ for (RouteList::iterator rt = rl->begin(); rt != rl->end(); ++rt) {
+
+ PortSet& ps ((*rt)->input()->ports());
+
+ for (PortSet::iterator p = ps.begin(); p != ps.end(); ++p) {
+ p->get_connections (connections);
+ }
+
+ for (vector<string>::iterator s = connections.begin(); s != connections.end(); ++s) {
+ routes_using_input_from (*s, rl2);
+ }
+
+ /* scan all relevant routes to see if others are on or off */
+
+ bool others_are_already_on = false;
+
+ for (RouteList::iterator r = rl2.begin(); r != rl2.end(); ++r) {
+
+ boost::shared_ptr<MidiTrack> mt = boost::dynamic_pointer_cast<MidiTrack> (*r);
+
+ if (!mt) {
+ continue;
+ }
+
+ if ((*r) != (*rt)) {
+ if (mt->input_active()) {
+ others_are_already_on = true;
+ }
+ } else {
+ /* this one needs changing */
+ mt->set_input_active (onoff);
+ }
+ }
+
+ if (flip_others) {