Sort MIDI Ports by human readable name in connection matrix
This is mainly for the benefit of CoreMIDI where MIDI ports are identified by kMIDIPropertyUniqueID and ALSA where Ardour uses a unique hash for persistent names.
This commit is contained in:
parent
cb34845498
commit
170bc45de9
@ -628,10 +628,19 @@ PortGroupList::gather (ARDOUR::Session* session, ARDOUR::DataType type, bool inp
|
||||
if (ports.size () > 0) {
|
||||
|
||||
struct SortByPortName {
|
||||
bool _use_pretty_name;
|
||||
SortByPortName (bool use_pretty_name) : _use_pretty_name (use_pretty_name) {}
|
||||
bool operator() (std::string const& lhs, std::string const& rhs) const {
|
||||
if (_use_pretty_name) {
|
||||
/* add port-name as suffix (in case pretty-name is unset) */
|
||||
std::string l = AudioEngine::instance()->get_hardware_port_name_by_name (lhs) + lhs;
|
||||
std::string r = AudioEngine::instance()->get_hardware_port_name_by_name (rhs) + rhs;
|
||||
return PBD::naturally_less (l.c_str (), r.c_str ());
|
||||
} else {
|
||||
return PBD::naturally_less (lhs.c_str (), rhs.c_str ());
|
||||
}
|
||||
} port_sorter;
|
||||
}
|
||||
} port_sorter (type == DataType::MIDI);
|
||||
|
||||
std::sort (ports.begin (), ports.end (), port_sorter);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user