4#include "AudioLogger.h"
5#include "AudioTools/Disk/AudioSource.h"
35 AudioSourceSD(
const char *startFilePath =
"/",
const char *ext =
".mp3",
int chipSelect = PIN_CS,
bool setupIndex=
true) {
36 start_path = startFilePath;
38 setup_index = setupIndex;
43#ifdef USE_SD_SUPPORTS_SPI
46 AudioSourceSD(
const char *startFilePath,
const char *ext,
int chipSelect, SPIClass &spiInstance,
bool setupIndex=
true) {
47 start_path = startFilePath;
49 setup_index = setupIndex;
61 LOGE(
"SD.begin cs=%d failed", cs);
69 idx.begin(start_path, extension, file_name_pattern);
81 LOGI(
"nextStream: %d", offset);
86 LOGI(
"selectStream SD: %d",
index);
95 if (path ==
nullptr) {
96 LOGE(
"Filename is null")
100 file_name = file.name();
101 LOGI(
"-> selectStream: %s", path);
102 return file ? &file :
nullptr;
113 const char *
toStr() {
return file_name; }
119 virtual void setPath(
const char *p) { start_path = p; }
125#if defined(USE_SD_NO_NS)
128 SDDirect<fs::SDFS,fs::File> idx{SD};
132 const char *file_name;
133 const char *extension =
nullptr;
134 const char *start_path =
nullptr;
135 const char *file_name_pattern =
"*";
136 bool setup_index =
true;
137 bool is_sd_setup =
false;
139 SPIClass *p_spi =
nullptr;
142#ifdef USE_SD_SUPPORTS_SPI
143 return SD.begin(cs, *p_spi);
VFSFile File
Desktop file system compatibility alias.
Definition File.h:12