diff options
author | Carl Hetherington <carl@carlh.net> | 2009-06-09 23:43:20 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2009-06-09 23:43:20 +0000 |
commit | d039e2e80ff2179aef7430c53ca41e43297d9065 (patch) | |
tree | 17e5faab29f1d0a8b6e4cd3da242fc9df3ec5244 /gtk2_ardour | |
parent | 9f8dc1f145203168290750cfeb89491d9f37c48e (diff) |
Fix up port matrix for new Route / IO arrangements.
git-svn-id: svn://localhost/ardour2/branches/3.0@5143 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/port_group.cc | 30 | ||||
-rw-r--r-- | gtk2_ardour/port_group.h | 4 |
2 files changed, 19 insertions, 15 deletions
diff --git a/gtk2_ardour/port_group.cc b/gtk2_ardour/port_group.cc index 99c4861f79..0aae51d2b9 100644 --- a/gtk2_ardour/port_group.cc +++ b/gtk2_ardour/port_group.cc @@ -149,7 +149,7 @@ PortGroupList::set_type (DataType t) } void -PortGroupList::maybe_add_processor_to_bundle (boost::weak_ptr<Processor> wp, boost::shared_ptr<RouteBundle> rb, bool inputs) +PortGroupList::maybe_add_processor_to_bundle (boost::weak_ptr<Processor> wp, boost::shared_ptr<RouteBundle> rb, bool inputs, set<boost::shared_ptr<IO> >& used_io) { boost::shared_ptr<Processor> p (wp.lock()); @@ -160,18 +160,13 @@ PortGroupList::maybe_add_processor_to_bundle (boost::weak_ptr<Processor> wp, boo boost::shared_ptr<IOProcessor> iop = boost::dynamic_pointer_cast<IOProcessor> (p); if (iop) { + + boost::shared_ptr<IO> io = inputs ? iop->input() : iop->output(); - if (inputs) { - if (!iop->output()) { - return; - } - } else { - if (!iop->input()) { - return; - } + if (io && used_io.find (io) == used_io.end()) { + rb->add_processor_bundle (io->bundle ()); + used_io.insert (io); } - - rb->add_processor_bundle (inputs ? iop->output()->bundle() : iop->input()->bundle()); } } @@ -188,16 +183,23 @@ PortGroupList::gather (Session& session, bool inputs) boost::shared_ptr<PortGroup> other (new PortGroup (_("Other"))); /* Find the bundles for routes. We use the RouteBundle class to join - the route's IO bundles and processor bundles together so that they + the route's input/output and processor bundles together so that they are presented as one bundle in the matrix. */ boost::shared_ptr<RouteList> routes = session.get_routes (); for (RouteList::const_iterator i = routes->begin(); i != routes->end(); ++i) { - boost::shared_ptr<RouteBundle> rb (new RouteBundle (inputs ? (*i)->output()->bundle() : (*i)->input()->bundle())); + /* keep track of IOs that we have taken bundles from, so that maybe_add_processor... below + can avoid taking the same IO from both Route::output() and the main_outs Delivery */ + + set<boost::shared_ptr<IO> > used_io; + boost::shared_ptr<IO> io = inputs ? (*i)->input() : (*i)->output(); + used_io.insert (io); + + boost::shared_ptr<RouteBundle> rb (new RouteBundle (io->bundle())); - (*i)->foreach_processor (bind (mem_fun (*this, &PortGroupList::maybe_add_processor_to_bundle), rb, inputs)); + (*i)->foreach_processor (bind (mem_fun (*this, &PortGroupList::maybe_add_processor_to_bundle), rb, inputs, used_io)); /* Work out which group to put this bundle in */ boost::shared_ptr<PortGroup> g; diff --git a/gtk2_ardour/port_group.h b/gtk2_ardour/port_group.h index 707cc04966..5abe0c9bcd 100644 --- a/gtk2_ardour/port_group.h +++ b/gtk2_ardour/port_group.h @@ -22,6 +22,7 @@ #include <vector> #include <string> +#include <set> #include <gtkmm/widget.h> #include <gtkmm/checkbutton.h> #include <boost/shared_ptr.hpp> @@ -32,6 +33,7 @@ namespace ARDOUR { class Session; class Bundle; class Processor; + class IO; } class PortMatrix; @@ -121,7 +123,7 @@ class PortGroupList : public sigc::trackable std::string common_prefix_before (std::vector<std::string> const &, std::string const &) const; void emit_changed (); boost::shared_ptr<ARDOUR::Bundle> make_bundle_from_ports (std::vector<std::string> const &, bool) const; - void maybe_add_processor_to_bundle (boost::weak_ptr<ARDOUR::Processor>, boost::shared_ptr<RouteBundle>, bool); + void maybe_add_processor_to_bundle (boost::weak_ptr<ARDOUR::Processor>, boost::shared_ptr<RouteBundle>, bool, std::set<boost::shared_ptr<ARDOUR::IO> > &); ARDOUR::DataType _type; mutable ARDOUR::BundleList _bundles; |