13
0

Update GUI to use new IO PortSet API (2/2)

This commit is contained in:
Robin Gareus 2024-06-24 20:41:43 +02:00
parent 2e23ec4422
commit 1f368900e3
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
5 changed files with 27 additions and 24 deletions

View File

@ -733,8 +733,8 @@ TrackExportChannelSelector::sync_with_manager_state ()
PortExportChannel::PortSet route_ports; PortExportChannel::PortSet route_ports;
PortExportChannel::PortSet intersection; PortExportChannel::PortSet intersection;
PortSet& ps (route->output()->ports ()); std::shared_ptr<PortSet> ps (route->output()->ports ());
for (PortSet::audio_iterator p = ps.audio_begin (); p != ps.audio_end (); ++p) { for (PortSet::audio_iterator p = ps->audio_begin (); p != ps->audio_end (); ++p) {
route_ports.insert (*p); route_ports.insert (*p);
} }

View File

@ -60,11 +60,12 @@ exclusively_connected (std::shared_ptr<IO> dest_io, std::shared_ptr<IO> io, Data
uint32_t n = 0; uint32_t n = 0;
uint32_t cnt = 0; uint32_t cnt = 0;
std::set<uint32_t> pn; std::set<uint32_t> pn;
PortSet const& psa (dest_io->ports ());
PortSet const& psb (io->ports ());
for (auto a = psa.begin (dt); a != psa.end (dt); ++a, ++n) { std::shared_ptr<PortSet const> psa (dest_io->ports ());
for (auto b = psb.begin (dt); b != psb.end (dt); ++b) { std::shared_ptr<PortSet const> psb (io->ports ());
for (auto a = psa->begin (dt); a != psa->end (dt); ++a, ++n) {
for (auto b = psb->begin (dt); b != psb->end (dt); ++b) {
if (a->connected_to (b->name ())) { if (a->connected_to (b->name ())) {
++cnt; ++cnt;
pn.insert (n); pn.insert (n);
@ -117,7 +118,7 @@ IOButtonBase::guess_main_type (std::shared_ptr<IO> io)
/* Find most likely type among connected ports */ /* Find most likely type among connected ports */
DataType type = DataType::NIL; /* NIL is always last so least likely */ DataType type = DataType::NIL; /* NIL is always last so least likely */
for (PortSet::iterator p = io->ports ().begin (); p != io->ports ().end (); ++p) { for (auto const& p : *io->ports ()) {
if (p->connected () && p->type () < type) if (p->connected () && p->type () < type)
type = p->type (); type = p->type ();
} }
@ -213,7 +214,7 @@ IOButtonBase::set_label (IOButtonBase& self, ARDOUR::Session& session, std::shar
vector<string> port_connections; vector<string> port_connections;
for (auto const& port : io->ports ()) { for (auto const& port : *io->ports ()) {
port_connections.clear (); port_connections.clear ();
port->get_connections (port_connections); port->get_connections (port_connections);
@ -306,8 +307,9 @@ IOButtonBase::set_label (IOButtonBase& self, ARDOUR::Session& session, std::shar
session.engine ().get_physical_outputs (dt, phys); session.engine ().get_physical_outputs (dt, phys);
playorcapture = "playback_"; playorcapture = "playback_";
} }
for (PortSet::iterator port = io->ports ().begin (dt); std::shared_ptr<PortSet> ps (io->ports ());
port != io->ports ().end (dt); for (PortSet::iterator port = ps->begin (dt);
port != ps->end (dt);
++port) { ++port) {
string pn = ""; string pn = "";
for (auto const& s : phys) { for (auto const& s : phys) {
@ -328,7 +330,7 @@ IOButtonBase::set_label (IOButtonBase& self, ARDOUR::Session& session, std::shar
temp_label.str (""); /* erase the failed attempt */ temp_label.str (""); /* erase the failed attempt */
break; break;
} }
if (port != io->ports ().begin (dt)) { if (port != ps->begin (dt)) {
temp_label << "/"; temp_label << "/";
} }
temp_label << pn; temp_label << pn;
@ -368,10 +370,11 @@ IOButtonBase::set_label (IOButtonBase& self, ARDOUR::Session& session, std::shar
/* Is each main-typed channel connected to a single and different port with /* Is each main-typed channel connected to a single and different port with
* the same client name (e.g. another JACK client) ? */ * the same client name (e.g. another JACK client) ? */
if (!have_label && each_typed_port_has_one_connection) { if (!have_label && each_typed_port_has_one_connection) {
string maybe_client = ""; string maybe_client = "";
vector<string> connections; vector<string> connections;
for (PortSet::iterator port = io->ports ().begin (dt); std::shared_ptr<PortSet> ps (io->ports ());
port != io->ports ().end (dt); for (PortSet::iterator port = ps->begin (dt);
port != ps->end (dt);
++port) { ++port) {
port_connections.clear (); port_connections.clear ();
port->get_connections (port_connections); port->get_connections (port_connections);

View File

@ -79,7 +79,7 @@ IOSelector::setup_type ()
int N = 0; int N = 0;
DataType type_with_ports = DataType::NIL; DataType type_with_ports = DataType::NIL;
for (DataType::iterator i = DataType::begin(); i != DataType::end(); ++i) { for (DataType::iterator i = DataType::begin(); i != DataType::end(); ++i) {
if (_io->ports().num_ports (*i)) { if (_io->ports()->num_ports (*i)) {
type_with_ports = *i; type_with_ports = *i;
++N; ++N;
} }

View File

@ -482,12 +482,12 @@ PluginPinWidget::refill_sidechain_table ()
} }
uint32_t r = 0; uint32_t r = 0;
PortSet& p (io->ports ()); std::shared_ptr<PortSet> p (io->ports ());
bool can_remove = p.num_ports () > 1; bool can_remove = p->num_ports () > 1;
for (PortSet::iterator i = p.begin (DataType::MIDI); i != p.end (DataType::MIDI); ++i) { for (PortSet::iterator i = p->begin (DataType::MIDI); i != p->end (DataType::MIDI); ++i) {
r += add_port_to_table (*i, r, can_remove); r += add_port_to_table (*i, r, can_remove);
} }
for (PortSet::iterator i = p.begin (DataType::AUDIO); i != p.end (DataType::AUDIO); ++i) { for (PortSet::iterator i = p->begin (DataType::AUDIO); i != p->end (DataType::AUDIO); ++i) {
r += add_port_to_table (*i, r, can_remove); r += add_port_to_table (*i, r, can_remove);
} }
_sidechain_tbl->show_all (); _sidechain_tbl->show_all ();
@ -1857,8 +1857,8 @@ PluginPinWidget::add_send_from (std::weak_ptr<ARDOUR::Port> wp, std::weak_ptr<AR
p->disconnect_all (); p->disconnect_all ();
DataType dt = p->type (); DataType dt = p->type ();
PortSet& ps (send->output ()->ports ()); std::shared_ptr<PortSet> ps (send->output ()->ports ());
for (PortSet::iterator i = ps.begin (dt); i != ps.end (dt); ++i) { for (PortSet::iterator i = ps->begin (dt); i != ps->end (dt); ++i) {
p->connect (&(**i)); p->connect (&(**i));
} }

View File

@ -636,8 +636,8 @@ ProcessorEntry::name (Width w) const
if (send->remove_on_disconnect ()) { if (send->remove_on_disconnect ()) {
// assume it's a sidechain, find pretty name of connected port(s) // assume it's a sidechain, find pretty name of connected port(s)
PortSet& ps (send->output ()->ports ()); shared_ptr<PortSet const> ps (send->output ()->ports ());
for (PortSet::iterator i = ps.begin (); i != ps.end () && pretty_ok; ++i) { for (auto i = ps->begin (); i != ps->end () && pretty_ok; ++i) {
vector<string> connections; vector<string> connections;
if (i->get_connections (connections)) { if (i->get_connections (connections)) {
vector<string>::const_iterator ci; vector<string>::const_iterator ci;