spelling corrections from Jaromír Mikeš <mira.mikes@seznam.cz>
[ardour.git] / libs / backends / alsa / alsa_audiobackend.h
index 48115f9f05ea1eac059f03f7e8a0ab3176432c43..d8dfb31725453f1e6490e26be51f94b697fb040d 100644 (file)
@@ -30,6 +30,7 @@
 
 #include <boost/shared_ptr.hpp>
 
+#include "pbd/natsort.h"
 #include "ardour/audio_backend.h"
 #include "ardour/dsp_load_calculator.h"
 #include "ardour/system_exec.h"
@@ -409,8 +410,16 @@ class AlsaAudioBackend : public AudioBackend {
                std::vector<AlsaPort *> _system_midi_in;
                std::vector<AlsaPort *> _system_midi_out;
 
+               struct SortByPortName
+               {
+                       bool operator ()(const AlsaPort* lhs, const AlsaPort* rhs) const
+                       {
+                               return PBD::naturally_less (lhs->name ().c_str (), rhs->name ().c_str ());
+                       }
+               };
+
                typedef std::map<std::string, AlsaPort *> PortMap; // fast lookup in _ports
-               typedef std::set<AlsaPort *> PortIndex; // fast lookup in _ports
+               typedef std::set<AlsaPort *, SortByPortName> PortIndex; // fast lookup in _ports
                PortMap _portmap;
                PortIndex _ports;
 
@@ -446,7 +455,7 @@ class AlsaAudioBackend : public AudioBackend {
                }
 
                bool valid_port (PortHandle port) const {
-                       return _ports.find (static_cast<AlsaPort*>(port)) != _ports.end ();
+                       return std::find (_ports.begin(), _ports.end(), static_cast<AlsaPort*>(port)) != _ports.end ();
                }
 
                AlsaPort* find_port (const std::string& port_name) const {