13
0

Merge branch 'ardour'

This commit is contained in:
Paul Davis 2024-05-29 22:39:08 -06:00
commit ab09b7fbc1

View File

@ -292,9 +292,7 @@ PortGroupList::~PortGroupList()
} }
void void
PortGroupList::maybe_add_processor_to_list ( PortGroupList::maybe_add_processor_to_list (std::weak_ptr<Processor> wp, list<std::shared_ptr<IO> >* route_ios, bool inputs, set<std::shared_ptr<IO> >& used_io)
std::weak_ptr<Processor> wp, list<std::shared_ptr<IO> >* route_ios, bool inputs, set<std::shared_ptr<IO> >& used_io
)
{ {
std::shared_ptr<Processor> p (wp.lock()); std::shared_ptr<Processor> p (wp.lock());
@ -302,6 +300,14 @@ PortGroupList::maybe_add_processor_to_list (
return; return;
} }
#ifdef LIVETRAX
std::shared_ptr<Delivery> d = std::dynamic_pointer_cast<Delivery> (p);
if (d && d->role() == Delivery::Main) {
return;
}
#endif
std::shared_ptr<IOProcessor> iop = std::dynamic_pointer_cast<IOProcessor> (p); std::shared_ptr<IOProcessor> iop = std::dynamic_pointer_cast<IOProcessor> (p);
if (iop) { if (iop) {
@ -318,8 +324,10 @@ PortGroupList::maybe_add_processor_to_list (
struct RouteIOs { struct RouteIOs {
RouteIOs (std::shared_ptr<Route> r, std::shared_ptr<IO> i) { RouteIOs (std::shared_ptr<Route> r, std::shared_ptr<IO> i) {
route = r; route = r;
if (i) {
ios.push_back (i); ios.push_back (i);
} }
}
std::shared_ptr<Route> route; std::shared_ptr<Route> route;
/* it's ok to use a shared_ptr here as RouteIOs structs are only used during ::gather () */ /* it's ok to use a shared_ptr here as RouteIOs structs are only used during ::gather () */
@ -365,11 +373,11 @@ PortGroupList::gather (ARDOUR::Session* session, ARDOUR::DataType type, bool inp
std::shared_ptr<RouteList const> routes = session->get_routes (); std::shared_ptr<RouteList const> routes = session->get_routes ();
list<RouteIOs> route_ios; list<RouteIOs> 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 */ /* we never show the monitor bus inputs */
if (inputs && (*i)->is_monitor()) { if (inputs && r->is_monitor()) {
continue; continue;
} }
@ -379,12 +387,20 @@ PortGroupList::gather (ARDOUR::Session* session, ARDOUR::DataType type, bool inp
*/ */
set<std::shared_ptr<IO> > used_io; set<std::shared_ptr<IO> > used_io;
std::shared_ptr<IO> io = inputs ? (*i)->input() : (*i)->output(); std::shared_ptr<IO> io;
#ifdef LIVETRAX
if (inputs) {
io = r->input();
used_io.insert (io); used_io.insert (io);
}
#else
io = inputs ? r->input() : r->output();
used_io.insert (io);
#endif
RouteIOs rb (*i, io); RouteIOs rb (r, io);
(*i)->foreach_processor (boost::bind (&PortGroupList::maybe_add_processor_to_list, this, _1, &rb.ios, inputs, used_io)); r->foreach_processor (boost::bind (&PortGroupList::maybe_add_processor_to_list, this, _1, &rb.ios, inputs, used_io));
route_ios.push_back (rb); 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. */ /* Now put the bundles that belong to these sorted RouteIOs into the PortGroup. */
for (list<RouteIOs>::iterator i = route_ios.begin(); i != route_ios.end(); ++i) { for (auto & rio : route_ios) {
TimeAxisView* tv = PublicEditor::instance().time_axis_view_from_stripable (i->route); TimeAxisView* tv = PublicEditor::instance().time_axis_view_from_stripable (rio.route);
/* Work out which group to put these IOs' bundles in */ /* Work out which group to put these IOs' bundles in */
std::shared_ptr<PortGroup> g; std::shared_ptr<PortGroup> g;
if (std::dynamic_pointer_cast<Track> (i->route)) { if (std::dynamic_pointer_cast<Track> (rio.route)) {
g = track; g = track;
} else { } else {
g = bus; g = bus;
} }
for (list<std::shared_ptr<IO> >::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 /* Only add the bundle if there is at least one port
* with a type that's been asked for */ * 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) { if (tv) {
g->add_bundle ((*j)->bundle(), *j, tv->color ()); g->add_bundle (io->bundle(), io, tv->color ());
} else { } 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 /* When on input side, let's look for sidechains in the route's plugins
to display them right next to their route */ to display them right next to their route */
for (uint32_t n = 0; inputs; ++n) { for (uint32_t n = 0; inputs; ++n) {
std::shared_ptr<Processor> p = (i->route)->nth_plugin (n); std::shared_ptr<Processor> p = (rio.route)->nth_plugin (n);
if (!p) { if (!p) {
break; break;
} }
@ -477,11 +493,11 @@ PortGroupList::gather (ARDOUR::Session* session, ARDOUR::DataType type, bool inp
std::shared_ptr<Bundle> sync (new Bundle (_("Sync"), inputs)); std::shared_ptr<Bundle> sync (new Bundle (_("Sync"), inputs));
AudioEngine* ae = AudioEngine::instance(); 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> port = (*i)->port (); std::shared_ptr<Port> port = tm->port ();
if (!port) { if (!port) {
continue; continue;
@ -491,7 +507,7 @@ PortGroupList::gather (ARDOUR::Session* session, ARDOUR::DataType type, bool inp
continue; 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); program->add_bundle (sync);