AudioSource for AudioPlayer using an SD card as data source. This class is based on the Arduino SD implementation Connect the SD card. For UTF8 Support change SdFatConfig.h #define USE_UTF8_LONG_NAMES 1.
More...
#include <AudioSourceSDFAT.h>
|
| | AudioSourceSDFAT (AudioFs fs, const char *startFilePath="/", const char *ext="", bool setupIndex=true) |
| | Constructor for providing an open FS.
|
| |
| | AudioSourceSDFAT (const char *startFilePath, const char *ext, SdSpiConfig &config, bool setupIndex=true) |
| | Costructor with SdSpiConfig.
|
| |
| | AudioSourceSDFAT (const char *startFilePath="/", const char *ext=".mp3", int chipSelect=PIN_CS, int speedMHz=10, int spi_mode=DEDICATED_SPI, bool setupIndex=true) |
| | Default constructor.
|
| |
| virtual | ~AudioSourceSDFAT () |
| |
| virtual bool | begin () override |
| | Reset actual stream and move to root.
|
| |
| void | end () |
| |
| AudioFs & | getAudioFs () |
| | provides access to the AudioFs object
|
| |
| int | index () |
| | Provides the current index position.
|
| |
| virtual bool | isAutoNext () |
| | Returns default setting go to the next.
|
| |
| virtual Stream * | nextStream (int offset=1) override |
| | Returns next audio stream.
|
| |
| Stream * | operator[] (int idx) |
| | access with array syntax
|
| |
| virtual Stream * | previousStream (int offset) |
| | Returns previous audio stream.
|
| |
| virtual Stream * | selectStream (const char *path) override |
| | Returns audio stream by path: The index is not changed!
|
| |
| virtual Stream * | selectStream (int index) override |
| |
| virtual void | setAutoNext (bool flag) |
| |
| void | setFileFilter (const char *filter) |
| |
| virtual Stream * | setIndex (int index) |
| | same as selectStream - I just prefer this name
|
| |
| virtual bool | setMetadataCallback (void(*fn)(MetaDataType info, const char *str, int len), ID3TypeSelection sel=SELECT_ICY) |
| |
| virtual void | setPath (const char *p) |
| | Allows to "correct" the start path if not defined in the constructor.
|
| |
| virtual void | setTimeout (int millisec) |
| | Sets the timeout of Stream in milliseconds.
|
| |
| virtual void | setTimeoutAutoNext (int millisec) |
| |
| long | size () |
| |
| virtual int | timeoutAutoNext () |
| | Provides the timeout which is triggering to move to the next stream.
|
| |
| const char * | toStr () |
| | provides the actual file name
|
| |
template<typename AudioFs = SdFat32, typename AudioFile = File32>
class audio_tools::AudioSourceSDFAT< AudioFs, AudioFile >
AudioSource for AudioPlayer using an SD card as data source. This class is based on the Arduino SD implementation Connect the SD card. For UTF8 Support change SdFatConfig.h #define USE_UTF8_LONG_NAMES 1.
- Note
- Supported only by Arduino platforms that support SDFAT library!
-
Dependency: https://github.com/greiman/sdfat
- Parameters
-
| <SdFat32,File32>,<SdFs,FsFile>,<SdExFat,ExFile>,<SdFat,File> | |
- Author
- Phil Schatzmann
- Copyright
- GPLv3
◆ AudioSourceSDFAT() [1/3]
template<typename AudioFs = SdFat32, typename AudioFile = File32>
| AudioSourceSDFAT |
( |
const char * |
startFilePath = "/", |
|
|
const char * |
ext = ".mp3", |
|
|
int |
chipSelect = PIN_CS, |
|
|
int |
speedMHz = 10, |
|
|
int |
spi_mode = DEDICATED_SPI, |
|
|
bool |
setupIndex = true |
|
) |
| |
|
inline |
◆ AudioSourceSDFAT() [2/3]
template<typename AudioFs = SdFat32, typename AudioFile = File32>
| AudioSourceSDFAT |
( |
const char * |
startFilePath, |
|
|
const char * |
ext, |
|
|
SdSpiConfig & |
config, |
|
|
bool |
setupIndex = true |
|
) |
| |
|
inline |
Costructor with SdSpiConfig.
◆ AudioSourceSDFAT() [3/3]
template<typename AudioFs = SdFat32, typename AudioFile = File32>
| AudioSourceSDFAT |
( |
AudioFs |
fs, |
|
|
const char * |
startFilePath = "/", |
|
|
const char * |
ext = "", |
|
|
bool |
setupIndex = true |
|
) |
| |
|
inline |
Constructor for providing an open FS.
◆ ~AudioSourceSDFAT()
template<typename AudioFs = SdFat32, typename AudioFile = File32>
◆ begin()
template<typename AudioFs = SdFat32, typename AudioFile = File32>
Reset actual stream and move to root.
Implements AudioSource.
◆ end()
template<typename AudioFs = SdFat32, typename AudioFile = File32>
◆ getAudioFs()
template<typename AudioFs = SdFat32, typename AudioFile = File32>
provides access to the AudioFs object
◆ getFileName()
template<typename AudioFs = SdFat32, typename AudioFile = File32>
| const char * getFileName |
( |
AudioFile & |
file | ) |
|
|
inlineprotected |
◆ index()
template<typename AudioFs = SdFat32, typename AudioFile = File32>
Provides the current index position.
Reimplemented from AudioSource.
◆ isAutoNext()
template<typename AudioFs = SdFat32, typename AudioFile = File32>
| virtual bool isAutoNext |
( |
| ) |
|
|
inlinevirtual |
Returns default setting go to the next.
Reimplemented from AudioSource.
◆ nextStream()
template<typename AudioFs = SdFat32, typename AudioFile = File32>
| virtual Stream * nextStream |
( |
int |
offset = 1 | ) |
|
|
inlineoverridevirtual |
◆ operator[]()
| Stream * operator[] |
( |
int |
idx | ) |
|
|
inlineinherited |
◆ previousStream()
| virtual Stream * previousStream |
( |
int |
offset | ) |
|
|
inlinevirtualinherited |
◆ selectStream() [1/2]
template<typename AudioFs = SdFat32, typename AudioFile = File32>
| virtual Stream * selectStream |
( |
const char * |
path | ) |
|
|
inlineoverridevirtual |
Returns audio stream by path: The index is not changed!
Implements AudioSource.
◆ selectStream() [2/2]
template<typename AudioFs = SdFat32, typename AudioFile = File32>
| virtual Stream * selectStream |
( |
int |
index | ) |
|
|
inlineoverridevirtual |
Returns audio stream at the indicated index (the index is zero based, so the first value is 0!)
Reimplemented from AudioSource.
◆ setAutoNext()
| virtual void setAutoNext |
( |
bool |
flag | ) |
|
|
inlinevirtualinherited |
◆ setFileFilter()
template<typename AudioFs = SdFat32, typename AudioFile = File32>
| void setFileFilter |
( |
const char * |
filter | ) |
|
|
inline |
Defines the regex filter criteria for selecting files. E.g. ".*Bob
Dylan.*"
◆ setIndex()
| virtual Stream * setIndex |
( |
int |
index | ) |
|
|
inlinevirtualinherited |
same as selectStream - I just prefer this name
◆ setMetadataCallback()
◆ setPath()
template<typename AudioFs = SdFat32, typename AudioFile = File32>
| virtual void setPath |
( |
const char * |
p | ) |
|
|
inlinevirtual |
Allows to "correct" the start path if not defined in the constructor.
◆ setTimeout()
| virtual void setTimeout |
( |
int |
millisec | ) |
|
|
inlinevirtualinherited |
◆ setTimeoutAutoNext()
| virtual void setTimeoutAutoNext |
( |
int |
millisec | ) |
|
|
inlinevirtualinherited |
Sets the timeout which is triggering to move to the next stream. - the default value is 500 ms
◆ size()
template<typename AudioFs = SdFat32, typename AudioFile = File32>
Provides the number of files (The max index is size()-1): WARNING this is very slow if you have a lot of files in many subdirectories
◆ timeoutAutoNext()
| virtual int timeoutAutoNext |
( |
| ) |
|
|
inlinevirtualinherited |
Provides the timeout which is triggering to move to the next stream.
◆ toStr()
template<typename AudioFs = SdFat32, typename AudioFile = File32>
provides the actual file name
Reimplemented from AudioSource.
◆ cs
template<typename AudioFs = SdFat32, typename AudioFile = File32>
◆ exension
template<typename AudioFs = SdFat32, typename AudioFile = File32>
| const char* exension = nullptr |
|
protected |
◆ file
template<typename AudioFs = SdFat32, typename AudioFile = File32>
◆ file_name
template<typename AudioFs = SdFat32, typename AudioFile = File32>
◆ file_name_pattern
template<typename AudioFs = SdFat32, typename AudioFile = File32>
| const char* file_name_pattern = "*" |
|
protected |
◆ idx
template<typename AudioFs = SdFat32, typename AudioFile = File32>
◆ idx_pos
template<typename AudioFs = SdFat32, typename AudioFile = File32>
◆ is_auto_next
◆ is_close_sd
template<typename AudioFs = SdFat32, typename AudioFile = File32>
◆ is_sd_setup
template<typename AudioFs = SdFat32, typename AudioFile = File32>
◆ owns_cfg
template<typename AudioFs = SdFat32, typename AudioFile = File32>
◆ p_cfg
template<typename AudioFs = SdFat32, typename AudioFile = File32>
| SdSpiConfig* p_cfg = nullptr |
|
protected |
◆ sd
template<typename AudioFs = SdFat32, typename AudioFile = File32>
◆ setup_index
template<typename AudioFs = SdFat32, typename AudioFile = File32>
◆ start_path
template<typename AudioFs = SdFat32, typename AudioFile = File32>
| const char* start_path = nullptr |
|
protected |
◆ timeout_auto_next_value
| int timeout_auto_next_value = 500 |
|
protectedinherited |
The documentation for this class was generated from the following file: