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

AudioSource using the standard C++ api. In order to make this work you need to configure and provide a VFS object! More...

#include <AudioSourceVFS.h>

Inheritance diagram for AudioSourceVFS:
AudioSource

Public Member Functions

 AudioSourceVFS (const char *startFilePath="/", const char *ext="")
 Default constructor w/o VFS.
 
 AudioSourceVFS (VFS &vfs, const char *startFilePath="/", const char *ext="")
 Default constructor with VFS.
 
virtual ~AudioSourceVFS ()
 
virtual bool begin () override
 Reset actual stream and move to root.
 
virtual void end ()
 
int index ()
 Provides the current index position.
 
virtual bool isAutoNext ()
 Returns default setting go to the next.
 
virtual StreamnextStream (int offset=1) override
 Returns next audio stream.
 
Streamoperator[] (int idx)
 access with array syntax
 
virtual StreampreviousStream (int offset)
 Returns previous audio stream.
 
virtual StreamselectStream (const char *path) override
 Returns audio stream by path: The index is not changed!
 
virtual StreamselectStream (int index) override
 
virtual void setAutoNext (bool flag)
 
void setFileFilter (const char *filter)
 
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 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)
 
void setVFS (VFS &vfs)
 Assign the VFS: to be used before calling begin.
 
long size ()
 
virtual int timeoutAutoNext ()
 Provides the timeout which is triggering to move to the next stream.
 
const chartoStr ()
 provides the actual file name
 

Protected Member Functions

const charget (int idx)
 
bool isValidAudioFile (fs::directory_entry file)
 checks if the file is a valid audio file
 

Protected Attributes

fs::directory_entry entry
 
const charexension = ""
 
VFSFile file
 
const charfile_name
 
const charfile_name_pattern = "*"
 
size_t idx_pos = 0
 
bool is_auto_next = true
 
VFSp_vfs = nullptr
 
const charstart_path = "/"
 
int timeout_auto_next_value = 500
 

Detailed Description

AudioSource using the standard C++ api. In order to make this work you need to configure and provide a VFS object!

Author
Phil Schatzmann

Constructor & Destructor Documentation

◆ AudioSourceVFS() [1/2]

AudioSourceVFS ( VFS vfs,
const char startFilePath = "/",
const char ext = "" 
)
inline

Default constructor with VFS.

◆ AudioSourceVFS() [2/2]

AudioSourceVFS ( const char startFilePath = "/",
const char ext = "" 
)
inline

Default constructor w/o VFS.

◆ ~AudioSourceVFS()

virtual ~AudioSourceVFS ( )
inlinevirtual

Member Function Documentation

◆ begin()

virtual bool begin ( )
inlineoverridevirtual

Reset actual stream and move to root.

Implements AudioSource.

◆ end()

virtual void end ( )
inlinevirtual

◆ get()

const char * get ( int  idx)
inlineprotected

◆ index()

int index ( )
inlinevirtual

Provides the current index position.

Reimplemented from AudioSource.

◆ isAutoNext()

virtual bool isAutoNext ( )
inlinevirtual

Returns default setting go to the next.

Reimplemented from AudioSource.

◆ isValidAudioFile()

bool isValidAudioFile ( fs::directory_entry  file)
inlineprotected

checks if the file is a valid audio file

◆ nextStream()

virtual Stream * nextStream ( int  offset = 1)
inlineoverridevirtual

Returns next audio stream.

Implements AudioSource.

◆ operator[]()

Stream * operator[] ( int  idx)
inlineinherited

access with array syntax

◆ previousStream()

virtual Stream * previousStream ( int  offset)
inlinevirtualinherited

Returns previous audio stream.

Reimplemented in AudioSourceFTP< ClientType >, and AudioSourceURL.

◆ selectStream() [1/2]

virtual Stream * selectStream ( const char path)
inlineoverridevirtual

Returns audio stream by path: The index is not changed!

Implements AudioSource.

◆ selectStream() [2/2]

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

Reimplemented in AudioSourceCallback.

◆ setFileFilter()

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()

virtual bool setMetadataCallback ( void(*)(MetaDataType info, const char *str, int len)  fn,
ID3TypeSelection  sel = SELECT_ICY 
)
inlinevirtualinherited

Reimplemented in AudioSourceURL.

◆ setPath()

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

Sets the timeout of Stream in milliseconds.

Reimplemented in AudioSourceURL, and AudioSourceSDFAT< AudioFs, AudioFile >.

◆ 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

◆ setVFS()

void setVFS ( VFS vfs)
inline

Assign the VFS: to be used before calling begin.

◆ size()

long size ( )
inline

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()

const char * toStr ( )
inlinevirtual

provides the actual file name

Reimplemented from AudioSource.

Member Data Documentation

◆ entry

fs::directory_entry entry
protected

◆ exension

const char* exension = ""
protected

◆ file

VFSFile file
protected

◆ file_name

const char* file_name
protected

◆ file_name_pattern

const char* file_name_pattern = "*"
protected

◆ idx_pos

size_t idx_pos = 0
protected

◆ is_auto_next

bool is_auto_next = true
protectedinherited

◆ p_vfs

VFS* p_vfs = nullptr
protected

◆ start_path

const char* start_path = "/"
protected

◆ timeout_auto_next_value

int timeout_auto_next_value = 500
protectedinherited

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