Fix up port matrix for new Route / IO arrangements.

git-svn-id: svn://localhost/ardour2/branches/3.0@5143 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2009-06-09 23:43:20 +00:00
parent 9f8dc1f145
commit d039e2e80f
2 changed files with 19 additions and 15 deletions

View file

@ -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());
@ -161,17 +161,12 @@ PortGroupList::maybe_add_processor_to_bundle (boost::weak_ptr<Processor> wp, boo
if (iop) {
if (inputs) {
if (!iop->output()) {
return;
}
} else {
if (!iop->input()) {
return;
}
}
boost::shared_ptr<IO> io = inputs ? iop->input() : iop->output();
rb->add_processor_bundle (inputs ? iop->output()->bundle() : iop->input()->bundle());
if (io && used_io.find (io) == used_io.end()) {
rb->add_processor_bundle (io->bundle ());
used_io.insert (io);
}
}
}
@ -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 */
(*i)->foreach_processor (bind (mem_fun (*this, &PortGroupList::maybe_add_processor_to_bundle), rb, inputs));
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, used_io));
/* Work out which group to put this bundle in */
boost::shared_ptr<PortGroup> g;

View file

@ -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;