pre-sort port-names

This commit is contained in:
Robin Gareus 2016-07-08 20:43:24 +02:00
parent bda5a4a4e6
commit f84a7605d8
3 changed files with 27 additions and 3 deletions

View file

@ -466,8 +466,16 @@ class CoreAudioBackend : public AudioBackend {
std::vector<CoreBackendPort *> _system_midi_in;
std::vector<CoreBackendPort *> _system_midi_out;
struct SortByPortName
{
bool operator ()(const CoreBackendPort* lhs, const CoreBackendPort* rhs) const
{
return lhs->name () < rhs->name ();
}
};
typedef std::map<std::string, CoreBackendPort *> PortMap; // fast lookup in _ports
typedef std::set<CoreBackendPort *> PortIndex; // fast lookup in _ports
typedef std::set<CoreBackendPort *, SortByPortName> PortIndex; // fast lookup in _ports
PortMap _portmap;
PortIndex _ports;