From: Julien "_FrnchFrgg_" RIVAUD Date: Thu, 24 Aug 2017 09:40:19 +0000 (+0200) Subject: Remove all manual accounting of connected user bundles X-Git-Tag: 5.12~93 X-Git-Url: https://main.carlh.net/gitweb/?p=ardour.git;a=commitdiff_plain;h=9c793759c81c306f9cf1dcf8e0be40a4ef16f795 Remove all manual accounting of connected user bundles IO used to manually keep a list of user bundles it was connected to, but it didn't work correctly: sometimes it didn't notice that a bundle wasn't connected anymore, and the list wasn't correctly persisted across save/reloads among other things. Moreover, it wasn't needed at all, since the user bundles are correctly listed by _session.bundles() and IO already notices they are connected ! Remove all occurrences of |_bundles_connected| and |check_bundles_connected|. --- diff --git a/libs/ardour/ardour/io.h b/libs/ardour/ardour/io.h index ce47ec54a5..571737e5a9 100644 --- a/libs/ardour/ardour/io.h +++ b/libs/ardour/ardour/io.h @@ -225,15 +225,11 @@ class LIBARDOUR_API IO : public SessionObject, public Latent PBD::ScopedConnection changed; }; - std::vector _bundles_connected; ///< user bundles connected to our ports - static int parse_io_string (const std::string&, std::vector& chns); static int parse_gain_string (const std::string&, std::vector& chns); int ensure_ports (ChanCount, bool clear, void *src); - void check_bundles_connected (); - void bundle_changed (Bundle::Change); int get_port_counts (const XMLNode& node, int version, ChanCount& n, boost::shared_ptr& c); diff --git a/libs/ardour/io.cc b/libs/ardour/io.cc index 40c4d854f3..7dc67d176b 100644 --- a/libs/ardour/io.cc +++ b/libs/ardour/io.cc @@ -154,50 +154,6 @@ IO::silence (framecnt_t nframes) } } -/** Set _bundles_connected to those bundles that are connected such that every - * port on every bundle channel x is connected to port x in _ports. - */ -void -IO::check_bundles_connected () -{ - std::vector new_list; - - for (std::vector::iterator i = _bundles_connected.begin(); i != _bundles_connected.end(); ++i) { - - uint32_t const N = (*i)->bundle->nchannels().n_total(); - - if (_ports.num_ports() < N) { - continue; - } - - bool ok = true; - - for (uint32_t j = 0; j < N; ++j) { - /* Every port on bundle channel j must be connected to our input j */ - Bundle::PortList const pl = (*i)->bundle->channel_ports (j); - for (uint32_t k = 0; k < pl.size(); ++k) { - if (_ports.port(j)->connected_to (pl[k]) == false) { - ok = false; - break; - } - } - - if (ok == false) { - break; - } - } - - if (ok) { - new_list.push_back (*i); - } else { - delete *i; - } - } - - _bundles_connected = new_list; -} - - int IO::disconnect (boost::shared_ptr our_port, string other_port, void* src) { @@ -220,8 +176,6 @@ IO::disconnect (boost::shared_ptr our_port, string other_port, void* src) error << string_compose(_("IO: cannot disconnect port %1 from %2"), our_port->name(), other_port) << endmsg; return -1; } - - check_bundles_connected (); } changed (IOChange (IOChange::ConnectionsChanged), src); /* EMIT SIGNAL */ @@ -288,7 +242,6 @@ IO::remove_port (boost::shared_ptr port, void* src) } _session.engine().unregister_port (port); - check_bundles_connected (); } } @@ -395,8 +348,6 @@ IO::disconnect (void* src) for (PortSet::iterator i = _ports.begin(); i != _ports.end(); ++i) { i->disconnect_all (); } - - check_bundles_connected (); } changed (IOChange (IOChange::ConnectionsChanged), src); /* EMIT SIGNAL */ @@ -482,7 +433,6 @@ IO::ensure_ports_locked (ChanCount count, bool clear, bool& changed) } if (changed) { - check_bundles_connected (); PortCountChanged (n_ports()); /* EMIT SIGNAL */ _session.set_dirty (); } @@ -567,12 +517,6 @@ IO::state (bool /*full_state*/) node->set_property("pretty-name", _pretty_name_prefix); } - for (std::vector::iterator i = _bundles_connected.begin(); i != _bundles_connected.end(); ++i) { - XMLNode* n = new XMLNode ("Bundle"); - n->set_property ("name", (*i)->bundle->name ()); - node->add_child_nocopy (*n); - } - for (PortSet::iterator i = _ports.begin(); i != _ports.end(); ++i) { vector connections; @@ -1320,22 +1264,6 @@ IO::connect_ports_to_bundle (boost::shared_ptr c, bool exclusive, c->connect (_bundle, _session.engine(), allow_partial); - /* If this is a UserBundle, make a note of what we've done */ - - boost::shared_ptr ub = boost::dynamic_pointer_cast (c); - if (ub) { - - /* See if we already know about this one */ - std::vector::iterator i = _bundles_connected.begin(); - while (i != _bundles_connected.end() && (*i)->bundle != ub) { - ++i; - } - - if (i == _bundles_connected.end()) { - /* We don't, so make a note */ - _bundles_connected.push_back (new UserBundleInfo (this, ub)); - } - } } changed (IOChange (IOChange::ConnectionsChanged), src); /* EMIT SIGNAL */ @@ -1354,19 +1282,6 @@ IO::disconnect_ports_from_bundle (boost::shared_ptr c, void* src) /* If this is a UserBundle, make a note of what we've done */ - boost::shared_ptr ub = boost::dynamic_pointer_cast (c); - if (ub) { - - std::vector::iterator i = _bundles_connected.begin(); - while (i != _bundles_connected.end() && (*i)->bundle != ub) { - ++i; - } - - if (i != _bundles_connected.end()) { - delete *i; - _bundles_connected.erase (i); - } - } } changed (IOChange (IOChange::ConnectionsChanged), src); /* EMIT SIGNAL */ @@ -1545,11 +1460,6 @@ IO::bundles_connected () { BundleList bundles; - /* User bundles */ - for (std::vector::iterator i = _bundles_connected.begin(); i != _bundles_connected.end(); ++i) { - bundles.push_back ((*i)->bundle); - } - /* Session bundles */ boost::shared_ptr b = _session.bundles (); for (ARDOUR::BundleList::iterator i = b->begin(); i != b->end(); ++i) {