|
arduino-audio-tools
|
Audio Data Source managing a static array of file names (const char*). Designed for PROGMEM storage on Arduino platforms with static file lists. This class is a template to support multiple SD libraries and other Streams. More...
#include <AudioSource.h>
Public Types | |
| typedef FileType *(* | FileToStreamCallback) (const char *path, FileType &file) |
Public Member Functions | |
| AudioSourceArray ()=default | |
| template<size_t N> | |
| AudioSourceArray (const char *(&nameArray)[N], FileToStreamCallback callback) | |
| Constructor with array and callback. | |
| AudioSourceArray (const char *const *nameArray, size_t size, FileToStreamCallback callback) | |
| Constructor with array pointer, size and callback. | |
| virtual bool | begin () override |
| Reset actual stream and move to root. | |
| FileType & | getCurrentFile () |
| const char * | getFilePath (int index) const |
| Get file path at index. | |
| virtual int | index () override |
| Returns the actual index of the stream. | |
| int | indexOf (const char *path) |
| Find index of file by path. | |
| virtual bool | isAutoNext () |
| Returns default setting go to the next. | |
| bool | isEmpty () const |
| Check if empty. | |
| const char * | name (int index) |
| provides the name at the given index | |
| virtual FileType * | nextStream (int offset) override |
| Returns next audio stream. | |
| Stream * | operator[] (int idx) |
| access with array syntax | |
| virtual Stream * | previousStream (int offset) |
| Returns previous audio stream. | |
| virtual FileType * | selectStream (const char *path) override |
| Returns audio stream by path. | |
| virtual FileType * | selectStream (int index) override |
| Returns audio stream at the indicated index. | |
| template<size_t N> | |
| void | setArray (const char *(&nameArray)[N]) |
| Set the array of file names. | |
| void | setArray (const char *const *nameArray, size_t size) |
| Set the array with pointer and size. | |
| virtual void | setAutoNext (bool flag) |
| 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) |
| void | setNameToStreamCallback (FileToStreamCallback callback) |
| Set the callback for converting file path to stream. | |
| virtual void | setTimeout (int millisec) |
| Sets the timeout of Stream in milliseconds. | |
| virtual void | setTimeoutAutoNext (int millisec) |
| int | size () const |
| Get the number of files. | |
| virtual int | timeoutAutoNext () |
| Provides the timeout which is triggering to move to the next stream. | |
| virtual const char * | toStr () override |
| provides the actual stream (e.g. file) name or url | |
Protected Attributes | |
| size_t | array_size = 0 |
| int | current_index = 0 |
| FileType * | current_stream = nullptr |
| const char *const * | file_array = nullptr |
| bool | is_auto_next = true |
| FileToStreamCallback | nameToStreamCallback = nullptr |
| int | timeout_auto_next_value = 500 |
Audio Data Source managing a static array of file names (const char*). Designed for PROGMEM storage on Arduino platforms with static file lists. This class is a template to support multiple SD libraries and other Streams.
Example callback signature: FileType* callback(const char* path, FileType& oldFile);
Without this callback, the class cannot open or access files for playback. Also don't forget to close the old file to prevent any memory leaks.
|
default |
|
inline |
Constructor with array and callback.
|
inline |
Constructor with array pointer, size and callback.
Reset actual stream and move to root.
Implements AudioSource.
Get file path at index.
Returns the actual index of the stream.
Reimplemented from AudioSource.
Returns default setting go to the next.
Reimplemented in AudioSourceIdxSD, AudioSourceIdxSDFAT< AudioFs, AudioFile >, AudioSourceIdxSDMMC, AudioSourceLittleFS, AudioSourceSD, AudioSourceSDFAT< AudioFs, AudioFile >, AudioSourceSDMMC, AudioSourceSPIFFS, AudioSourceSTD, AudioSourceURL, AudioSourceVFS, AudioSourceSDFAT< AudioFs, AudioFile >, and AudioSourceCallback.
provides the name at the given index
Returns next audio stream.
Implements AudioSource.
Returns previous audio stream.
Reimplemented in AudioSourceFTP< ClientType >, and AudioSourceURL.
Returns audio stream by path.
Implements AudioSource.
Returns audio stream at the indicated index.
Reimplemented from AudioSource.
Set the array of file names.
Set the array with pointer and size.
Reimplemented in AudioSourceCallback.
same as selectStream - I just prefer this name
|
inlinevirtualinherited |
Reimplemented in AudioSourceURL.
|
inline |
Set the callback for converting file path to stream.
Sets the timeout of Stream in milliseconds.
Reimplemented in AudioSourceURL, and AudioSourceSDFAT< AudioFs, AudioFile >.
Sets the timeout which is triggering to move to the next stream. - the default value is 500 ms
Provides the timeout which is triggering to move to the next stream.
provides the actual stream (e.g. file) name or url
Reimplemented from AudioSource.
|
protected |
|
protectedinherited |