diff --git a/gtk2_ardour/port_group.cc b/gtk2_ardour/port_group.cc index cf56c66939..652dd350f7 100644 --- a/gtk2_ardour/port_group.cc +++ b/gtk2_ardour/port_group.cc @@ -292,9 +292,7 @@ PortGroupList::~PortGroupList() } void -PortGroupList::maybe_add_processor_to_list ( - std::weak_ptr wp, list >* route_ios, bool inputs, set >& used_io - ) +PortGroupList::maybe_add_processor_to_list (std::weak_ptr wp, list >* route_ios, bool inputs, set >& used_io) { std::shared_ptr p (wp.lock()); @@ -302,6 +300,14 @@ PortGroupList::maybe_add_processor_to_list ( return; } +#ifdef LIVETRAX + std::shared_ptr d = std::dynamic_pointer_cast (p); + + if (d && d->role() == Delivery::Main) { + return; + } +#endif + std::shared_ptr iop = std::dynamic_pointer_cast (p); if (iop) { @@ -318,7 +324,9 @@ PortGroupList::maybe_add_processor_to_list ( struct RouteIOs { RouteIOs (std::shared_ptr r, std::shared_ptr i) { route = r; - ios.push_back (i); + if (i) { + ios.push_back (i); + } } std::shared_ptr route; @@ -365,11 +373,11 @@ PortGroupList::gather (ARDOUR::Session* session, ARDOUR::DataType type, bool inp std::shared_ptr routes = session->get_routes (); list route_ios; - for (RouteList::const_iterator i = routes->begin(); i != routes->end(); ++i) { + for (auto const & r : *routes) { /* we never show the monitor bus inputs */ - if (inputs && (*i)->is_monitor()) { + if (inputs && r->is_monitor()) { continue; } @@ -379,12 +387,20 @@ PortGroupList::gather (ARDOUR::Session* session, ARDOUR::DataType type, bool inp */ set > used_io; - std::shared_ptr io = inputs ? (*i)->input() : (*i)->output(); + std::shared_ptr io; + +#ifdef LIVETRAX + if (inputs) { + io = r->input(); + used_io.insert (io); + } +#else + io = inputs ? r->input() : r->output(); used_io.insert (io); +#endif - RouteIOs rb (*i, io); - (*i)->foreach_processor (boost::bind (&PortGroupList::maybe_add_processor_to_list, this, _1, &rb.ios, inputs, used_io)); - + RouteIOs rb (r, io); + r->foreach_processor (boost::bind (&PortGroupList::maybe_add_processor_to_list, this, _1, &rb.ios, inputs, used_io)); route_ios.push_back (rb); } @@ -393,25 +409,25 @@ PortGroupList::gather (ARDOUR::Session* session, ARDOUR::DataType type, bool inp /* Now put the bundles that belong to these sorted RouteIOs into the PortGroup. */ - for (list::iterator i = route_ios.begin(); i != route_ios.end(); ++i) { - TimeAxisView* tv = PublicEditor::instance().time_axis_view_from_stripable (i->route); + for (auto & rio : route_ios) { + TimeAxisView* tv = PublicEditor::instance().time_axis_view_from_stripable (rio.route); /* Work out which group to put these IOs' bundles in */ std::shared_ptr g; - if (std::dynamic_pointer_cast (i->route)) { + if (std::dynamic_pointer_cast (rio.route)) { g = track; } else { g = bus; } - for (list >::iterator j = i->ios.begin(); j != i->ios.end(); ++j) { + for (auto & io : rio.ios) { /* Only add the bundle if there is at least one port * with a type that's been asked for */ - if (type == DataType::NIL || (*j)->bundle()->nchannels().n(type) > 0) { + if (type == DataType::NIL || io->bundle()->nchannels().n(type) > 0) { if (tv) { - g->add_bundle ((*j)->bundle(), *j, tv->color ()); + g->add_bundle (io->bundle(), io, tv->color ()); } else { - g->add_bundle ((*j)->bundle(), *j); + g->add_bundle (io->bundle(), io); } } } @@ -419,7 +435,7 @@ PortGroupList::gather (ARDOUR::Session* session, ARDOUR::DataType type, bool inp /* When on input side, let's look for sidechains in the route's plugins to display them right next to their route */ for (uint32_t n = 0; inputs; ++n) { - std::shared_ptr p = (i->route)->nth_plugin (n); + std::shared_ptr p = (rio.route)->nth_plugin (n); if (!p) { break; } @@ -477,11 +493,11 @@ PortGroupList::gather (ARDOUR::Session* session, ARDOUR::DataType type, bool inp std::shared_ptr sync (new Bundle (_("Sync"), inputs)); AudioEngine* ae = AudioEngine::instance(); - TransportMasterManager::TransportMasters const & tm (TransportMasterManager::instance().transport_masters()); + TransportMasterManager::TransportMasters const & tms (TransportMasterManager::instance().transport_masters()); - for (TransportMasterManager::TransportMasters::const_iterator i = tm.begin(); i != tm.end(); ++i) { + for (auto const & tm : tms) { - std::shared_ptr port = (*i)->port (); + std::shared_ptr port = tm->port (); if (!port) { continue; @@ -491,7 +507,7 @@ PortGroupList::gather (ARDOUR::Session* session, ARDOUR::DataType type, bool inp continue; } - sync->add_channel ((*i)->name(), DataType::AUDIO, ae->make_port_name_non_relative (port->name())); + sync->add_channel (tm->name(), DataType::AUDIO, ae->make_port_name_non_relative (port->name())); } program->add_bundle (sync); @@ -756,7 +772,7 @@ PortGroupList::add_bundles_for_ports (std::vector const & p, ARDOUR if (pf != cp && !nb.empty()) { std::shared_ptr b = make_bundle_from_ports (nb, type, inputs); group->add_bundle (b, allow_dups); - nb.clear(); + nb.clear(); } cp = pf; nb.push_back(s);