arduino-audio-tools
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
audio_tools::AudioSourceSDFAT Class Reference

ESP32 AudioSource for AudioPlayer using an SD card as data source. This class is based on the Arduino SD implementation Connect the SD card to the following pins: More...

#include <AudioSourceIdxSDFAT.h>

Inheritance diagram for audio_tools::AudioSourceSDFAT:
audio_tools::AudioSource audio_tools::AudioSource audio_tools::AudioSource

Public Member Functions

 AudioSourceSDFAT (const char *startFilePath, const char *ext, SdSpiConfig &config)
 Costructor with SdSpiConfig.
 
 AudioSourceSDFAT (const char *startFilePath, const char *ext, SdSpiConfig &config, bool setupIndex=true)
 Costructor with SdSpiConfig.
 
 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=2)
 Default constructor.
 
 AudioSourceSDFAT (const char *startFilePath="/", const char *ext=".mp3", int chipSelect=PIN_CS, int speedMHz=2, bool setupIndex=true)
 Default constructor.
 
 AudioSourceSDFAT (const char *startFilePath="/", const char *ext=".mp3", int chipSelect=PIN_CS, int speedMHz=2, bool setupIndex=true)
 Default constructor.
 
virtual ~AudioSourceSDFAT ()
 Destructor.
 
virtual void begin () override
 Reset actual stream and move to root. More...
 
virtual void begin () override
 Reset actual stream and move to root. More...
 
virtual void begin () override
 Reset actual stream and move to root. More...
 
int index ()
 Provides the current index position.
 
int index ()
 Provides the current index position.
 
int index ()
 Provides the current index position.
 
virtual bool isAutoNext ()
 Returns default setting go to the next. More...
 
virtual bool isAutoNext ()
 Returns default setting go to the next. More...
 
virtual bool isAutoNext ()
 Returns default setting go to the next. More...
 
virtual StreamnextStream (int offset) override
 Returns next audio stream. More...
 
virtual StreamnextStream (int offset=1) override
 Returns next audio stream. More...
 
virtual StreamnextStream (int offset=1) override
 Returns next audio stream. More...
 
virtual StreamselectStream (const char *path) override
 Returns audio stream by path. More...
 
virtual StreamselectStream (const char *path) override
 Returns audio stream by path. More...
 
virtual StreamselectStream (const char *path) override
 Returns audio stream by path. More...
 
virtual StreamselectStream (int index) override
 Returns audio stream at the indicated index (the index is zero based, so the first value is 0!) More...
 
virtual StreamselectStream (int index) override
 Returns audio stream at the indicated index (the index is zero based, so the first value is 0!) More...
 
virtual StreamselectStream (int index) override
 Returns audio stream at the indicated index (the index is zero based, so the first value is 0!) More...
 
void setFileFilter (const char *filter)
 
void setFileFilter (const char *filter)
 
void setFileFilter (const char *filter)
 Defines the regex filter criteria for selecting files. E.g. ".*Bob Dylan.*".
 
virtual void setPath (const char *p)
 Allows to "correct" the start path if not defined in the constructor.
 
virtual void setPath (const char *p)
 Allows to "correct" the start path if not defined in the constructor.
 
virtual void setPath (const char *p)
 Allows to "correct" the start path if not defined in the constructor.
 
virtual void setTimeout (int ms)
 Sets the timeout of Stream in milliseconds. More...
 
const char * toStr ()
 provides the actual file name
 
const char * toStr ()
 provides the actual file name
 
const char * toStr ()
 provides the actual file name
 
- Public Member Functions inherited from audio_tools::AudioSource
virtual void begin ()=0
 Reset actual stream and move to root. More...
 
virtual bool isAutoNext ()
 Returns default setting go to the next. More...
 
virtual StreamnextStream (int offset)=0
 Returns next audio stream. More...
 
virtual StreampreviousStream (int offset)
 Returns previous audio stream. More...
 
virtual StreamselectStream (const char *path)=0
 Returns audio stream by path. More...
 
virtual StreamselectStream (int index)
 Returns audio stream at the indicated index (the index is zero based, so the first value is 0!) More...
 
virtual StreamsetIndex (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 setTimeout (int millisec)
 Sets the timeout of Stream in milliseconds. More...
 
virtual void setTimeoutAutoNext (int millisec)
 Sets the timeout which is triggering to move to the next stream. - the default value is 500 ms.
 
virtual int timeoutAutoNext ()
 Provides the timeout which is triggering to move to the next stream.
 

Protected Member Functions

void getFileAtIndex (AudioFile dir, size_t pos, size_t &idx, AudioFile &result)
 
AudioFile getFileByPath (const char *path)
 
AudioFile getFileByPos (const char *dirStr, int pos)
 Determines the file at the indicated index (starting with 0)
 
const char * getFileName (AudioFile &file)
 
const char * getFileName (AudioFile &file)
 
bool isValidAudioFile (AudioFile &file)
 checks if the file is a valid audio file
 

Protected Attributes

int cs
 
const char * exension = nullptr
 
AudioFile file
 
char file_name [MAX_FILE_LEN]
 
const char * file_name_pattern = "*"
 
char * file_name_pattern = (char*) "*"
 
SDIndex< AudioFs, AudioFileidx {sd}
 
SDDirect< AudioFs, AudioFileidx {sd}
 
size_t idx_pos = 0
 
bool owns_cfg =false
 
SdSpiConfig * p_cfg = nullptr
 
AudioFs sd
 
bool setup_index = true
 
const char * start_path = nullptr
 
int timeout
 
- Protected Attributes inherited from audio_tools::AudioSource
int timeout_auto_next_value = 500
 

Detailed Description

ESP32 AudioSource for AudioPlayer using an SD card as data source. This class is based on the Arduino SD implementation Connect the SD card to the following pins:

AudioSource for AudioPlayer using an SD card as data source. This class is based on https://github.com/greiman/SdFat.

Author
Phil Schatzmann

Member Function Documentation

◆ begin() [1/3]

virtual void audio_tools::AudioSourceSDFAT::begin ( )
inlineoverridevirtual

Reset actual stream and move to root.

Implements audio_tools::AudioSource.

◆ begin() [2/3]

virtual void audio_tools::AudioSourceSDFAT::begin ( )
inlineoverridevirtual

Reset actual stream and move to root.

Implements audio_tools::AudioSource.

◆ begin() [3/3]

virtual void audio_tools::AudioSourceSDFAT::begin ( )
inlineoverridevirtual

Reset actual stream and move to root.

Implements audio_tools::AudioSource.

◆ isAutoNext() [1/3]

virtual bool audio_tools::AudioSourceSDFAT::isAutoNext ( )
inlinevirtual

Returns default setting go to the next.

Reimplemented from audio_tools::AudioSource.

◆ isAutoNext() [2/3]

virtual bool audio_tools::AudioSourceSDFAT::isAutoNext ( )
inlinevirtual

Returns default setting go to the next.

Reimplemented from audio_tools::AudioSource.

◆ isAutoNext() [3/3]

virtual bool audio_tools::AudioSourceSDFAT::isAutoNext ( )
inlinevirtual

Returns default setting go to the next.

Reimplemented from audio_tools::AudioSource.

◆ nextStream() [1/3]

virtual Stream * audio_tools::AudioSourceSDFAT::nextStream ( int  offset)
inlineoverridevirtual

Returns next audio stream.

Implements audio_tools::AudioSource.

◆ nextStream() [2/3]

virtual Stream * audio_tools::AudioSourceSDFAT::nextStream ( int  offset = 1)
inlineoverridevirtual

Returns next audio stream.

Implements audio_tools::AudioSource.

◆ nextStream() [3/3]

virtual Stream * audio_tools::AudioSourceSDFAT::nextStream ( int  offset = 1)
inlineoverridevirtual

Returns next audio stream.

Implements audio_tools::AudioSource.

◆ selectStream() [1/6]

virtual Stream * audio_tools::AudioSourceSDFAT::selectStream ( const char *  path)
inlineoverridevirtual

Returns audio stream by path.

Implements audio_tools::AudioSource.

◆ selectStream() [2/6]

virtual Stream * audio_tools::AudioSourceSDFAT::selectStream ( const char *  path)
inlineoverridevirtual

Returns audio stream by path.

Implements audio_tools::AudioSource.

◆ selectStream() [3/6]

virtual Stream * audio_tools::AudioSourceSDFAT::selectStream ( const char *  path)
inlineoverridevirtual

Returns audio stream by path.

Implements audio_tools::AudioSource.

◆ selectStream() [4/6]

virtual Stream * audio_tools::AudioSourceSDFAT::selectStream ( int  index)
inlineoverridevirtual

Returns audio stream at the indicated index (the index is zero based, so the first value is 0!)

Reimplemented from audio_tools::AudioSource.

◆ selectStream() [5/6]

virtual Stream * audio_tools::AudioSourceSDFAT::selectStream ( int  index)
inlineoverridevirtual

Returns audio stream at the indicated index (the index is zero based, so the first value is 0!)

Reimplemented from audio_tools::AudioSource.

◆ selectStream() [6/6]

virtual Stream * audio_tools::AudioSourceSDFAT::selectStream ( int  index)
inlineoverridevirtual

Returns audio stream at the indicated index (the index is zero based, so the first value is 0!)

Reimplemented from audio_tools::AudioSource.

◆ setFileFilter() [1/2]

void audio_tools::AudioSourceSDFAT::setFileFilter ( const char *  filter)
inline

Defines the regex filter criteria for selecting files. E.g. ".*Bob Dylan.*"

◆ setFileFilter() [2/2]

void audio_tools::AudioSourceSDFAT::setFileFilter ( const char *  filter)
inline

Defines the regex filter criteria for selecting files. E.g. ".*Bob Dylan.*"

◆ setTimeout()

virtual void audio_tools::AudioSourceSDFAT::setTimeout ( int  millisec)
inlinevirtual

Sets the timeout of Stream in milliseconds.

Reimplemented from audio_tools::AudioSource.


The documentation for this class was generated from the following files: