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 intersection;
PortSet& ps (route->output()->ports ());
for (PortSet::audio_iterator p = ps.audio_begin (); p != ps.audio_end (); ++p) {
std::shared_ptr<PortSet> ps (route->output()->ports ());
for (PortSet::audio_iterator p = ps->audio_begin (); p != ps->audio_end (); ++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 cnt = 0;
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) {
for (auto b = psb.begin (dt); b != psb.end (dt); ++b) {
std::shared_ptr<PortSet const> psa (dest_io->ports ());
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 ())) {
++cnt;
pn.insert (n);
@ -117,7 +118,7 @@ IOButtonBase::guess_main_type (std::shared_ptr<IO> io)
/* Find most likely type among connected ports */
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)
type = p->type ();
}
@ -213,7 +214,7 @@ IOButtonBase::set_label (IOButtonBase& self, ARDOUR::Session& session, std::shar
vector<string> port_connections;
for (auto const& port : io->ports ()) {
for (auto const& port : *io->ports ()) {
port_connections.clear ();
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);
playorcapture = "playback_";
}
for (PortSet::iterator port = io->ports ().begin (dt);
port != io->ports ().end (dt);
std::shared_ptr<PortSet> ps (io->ports ());
for (PortSet::iterator port = ps->begin (dt);
port != ps->end (dt);
++port) {
string pn = "";
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 */
break;
}
if (port != io->ports ().begin (dt)) {
if (port != ps->begin (dt)) {
temp_label << "/";
}
temp_label << pn;
@ -370,8 +372,9 @@ IOButtonBase::set_label (IOButtonBase& self, ARDOUR::Session& session, std::shar
if (!have_label && each_typed_port_has_one_connection) {
string maybe_client = "";
vector<string> connections;
for (PortSet::iterator port = io->ports ().begin (dt);
port != io->ports ().end (dt);
std::shared_ptr<PortSet> ps (io->ports ());
for (PortSet::iterator port = ps->begin (dt);
port != ps->end (dt);
++port) {
port_connections.clear ();
port->get_connections (port_connections);

View File

@ -79,7 +79,7 @@ IOSelector::setup_type ()
int N = 0;
DataType type_with_ports = DataType::NIL;
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;
++N;
}

View File

@ -482,12 +482,12 @@ PluginPinWidget::refill_sidechain_table ()
}
uint32_t r = 0;
PortSet& p (io->ports ());
bool can_remove = p.num_ports () > 1;
for (PortSet::iterator i = p.begin (DataType::MIDI); i != p.end (DataType::MIDI); ++i) {
std::shared_ptr<PortSet> p (io->ports ());
bool can_remove = p->num_ports () > 1;
for (PortSet::iterator i = p->begin (DataType::MIDI); i != p->end (DataType::MIDI); ++i) {
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);
}
_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 ();
DataType dt = p->type ();
PortSet& ps (send->output ()->ports ());
for (PortSet::iterator i = ps.begin (dt); i != ps.end (dt); ++i) {
std::shared_ptr<PortSet> ps (send->output ()->ports ());
for (PortSet::iterator i = ps->begin (dt); i != ps->end (dt); ++i) {
p->connect (&(**i));
}

View File

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