I’m working on a sample player for @23volts that can switch between files in a folder. I’m stuck on the part that, given a path, scans the path for all .wav files.
Modular80 has some code that does a similar thing here, but their code appears to be fairly old and they use systemListEntries, which appears to be deprecated in favor of getEntries. However, I can’t find any code examples that use getEntries. Would anyone have any code samples that they can share?
Here’s some sample code that iterates over .wav files in a path:
std::list<std::string> dirList = system::getEntries(path);
for (auto entry : dirList)
{
if (string::filenameExtension(entry).compare("wav") == 0)
{
// if it is a .wav file, then do stuff
}
}
Not sure what string::filenameExtension is off hand and if it handles this, but just a reminder with code like this that Mac and Linux can throw you a .Wav or .WAV or I guess a .wAv file where your compare may fail on case.