3#include "AudioLogger.h"
4#include "AudioTools/Disk/AudioSource.h"
7#include "AudioTools/Disk/SDDirect.h"
35 AudioSourceSDMMC(
const char *startFilePath =
"/",
const char *ext =
".mp3",
bool setupIndex=
true) {
36 start_path = startFilePath;
38 setup_index = setupIndex;
48 if (!SD_MMC.begin(
"/sdcard",
true)) {
49 LOGE(
"SD_MMC.begin failed");
54 idx.begin(start_path, exension, file_name_pattern);
67 LOGI(
"nextStream: %d", offset);
72 LOGI(
"selectStream: %d",
index);
75 file_name = idx[
index];
76 if (file_name==
nullptr)
return nullptr;
77 LOGI(
"Using file %s", file_name);
78 file = SD_MMC.open(file_name);
79 return file ? &file :
nullptr;
84 file = SD_MMC.open(path);
85 file_name = file.name();
86 LOGI(
"-> selectStream: %s", path);
87 return file ? &file :
nullptr;
98 const char *
toStr() {
return file_name; }
104 virtual void setPath(
const char *p) { start_path = p; }
113 const char *file_name;
114 const char *exension =
nullptr;
115 const char *start_path =
nullptr;
116 const char *file_name_pattern =
"*";
117 bool setup_index =
true;
118 bool is_sd_setup =
false;
VFSFile File
Desktop file system compatibility alias.
Definition File.h:12