Sort ports by name in the connnection-matrix

This should fix a long-standing issue with interleaved display
of clients since jack_get_ports() does not return a well defined order.

(Internal backends based on Ardour::PortEngine keep ports sorted)
This commit is contained in:
Robin Gareus 2022-07-26 01:58:11 +02:00
parent 191dbf7c34
commit faa1e984ab
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
1 changed files with 10 additions and 0 deletions

View File

@ -26,6 +26,8 @@
#include "midi++/mmc.h"
#include "pbd/natsort.h"
#include "ardour/audio_port.h"
#include "ardour/async_midi_port.h"
#include "ardour/audioengine.h"
@ -583,6 +585,14 @@ PortGroupList::gather (ARDOUR::Session* session, ARDOUR::DataType type, bool inp
if (ports.size () > 0) {
struct SortByPortName {
bool operator() (std::string const& lhs, std::string const& rhs) const {
return PBD::naturally_less (lhs.c_str (), rhs.c_str ());
}
} port_sorter;
std::sort (ports.begin (), ports.end (), port_sorter);
for (vector<string>::const_iterator s = ports.begin(); s != ports.end(); ++s) {
std::string const p = *s;