Skip to content

Commit 2b24a84

Browse files
committed
correct sort for numerical strings
1 parent fe1b3e2 commit 2b24a84

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/ofxVisualProgramming.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1341,7 +1341,9 @@ void ofxVisualProgramming::loadPatch(string patchFile){
13411341
// remove duplicates from sample rates vector
13421342
std::sort( audioDevicesSR.begin(), audioDevicesSR.end() );
13431343
audioDevicesSR.erase( std::unique( audioDevicesSR.begin(), audioDevicesSR.end() ), audioDevicesSR.end() );
1344-
std::sort( audioDevicesSR.begin(), audioDevicesSR.end() );
1344+
std::sort( audioDevicesSR.begin(), audioDevicesSR.end(), [] (const std::string& lhs, const std::string& rhs) {
1345+
return std::stoi(lhs) < std::stoi(rhs);
1346+
} );
13451347

13461348
//ofLog(OF_LOG_NOTICE,"Device[%zu]: %s (IN:%i - OUT:%i), Sample Rates: %s",i,audioDevices[i].name.c_str(),audioDevices[i].inputChannels,audioDevices[i].outputChannels,tempSR.c_str());
13471349
}

0 commit comments

Comments
 (0)