3 #include "AudioLogger.h"
4 #include "AudioTools/CoreAudio/AudioSource.h"
5 #include "AudioTools/AudioLibs/Desktop/File.h"
6 #include "AudioTools/CoreAudio/AudioBasic/StrView.h"
11 namespace fs = std::filesystem;
23 start_path = startFilePath;
25 timeout_auto_next_value = 600000;
37 LOGI(
"nextStream: %d", offset);
42 LOGI(
"selectStream: %d",
index);
44 file_name = get(
index);
45 if (file_name==
nullptr)
return nullptr;
46 LOGI(
"Using file %s", file_name);
47 file = SD.open(file_name);
48 return file ? &file :
nullptr;
54 file_name = file.name();
55 LOGI(
"-> selectStream: %s", path);
56 return file ? &file :
nullptr;
67 const char *
toStr() {
return file_name; }
73 virtual void setPath(
const char *p) { start_path = p; }
78 for (
auto const& dir_entry : fs::recursive_directory_iterator(start_path)){
88 const char *file_name;
89 const char *exension =
"";
90 const char *start_path =
nullptr;
91 const char *file_name_pattern =
"*";
92 fs::directory_entry entry;
94 const char* get(
int idx){
96 const char* result =
nullptr;
97 for (
auto const& dir_entry : fs::recursive_directory_iterator(start_path)){
101 result = entry.path().c_str();
111 const std::filesystem::path& path = file.path();
113 const char *file_name = path.filename().c_str();
114 if (file.is_directory()) {
115 LOGD(
"-> isValidAudioFile: '%s': %d", file_name,
false);
118 StrView strFileTName(file_name);
120 && strFileTName.
matches(file_name_pattern);
121 LOGD(
"-> isValidAudioFile: '%s': %d", file_name, result);