An AudioSource that uses the SMBClient of the https://github.com/pschatzmann/TinySMB library to retrieve the files from a Windows, macOS, Samba or NAS share. You need to provide an SMBClient object to the constructor and make sure that you call begin() on it before you access the files.
More...
#include <AudioSourceSMB.h>
An AudioSource that uses the SMBClient of the https://github.com/pschatzmann/TinySMB library to retrieve the files from a Windows, macOS, Samba or NAS share. You need to provide an SMBClient object to the constructor and make sure that you call begin() on it before you access the files.
The directory is scanned recursively and the files that match the extension are played in the order in which the server lists them. The file names are not stored: the share is listed each time a new file is selected, so only the name of the actual file is kept in memory.
- Author
- Phil Schatzmann
- Copyright
- GPLv3
◆ AudioSourceSMB()
| AudioSourceSMB |
( |
smb::SMBClient & |
client, |
|
|
const char * |
path = "/", |
|
|
const char * |
ext = nullptr, |
|
|
int |
files = 0 |
|
) |
| |
|
inline |
Default constructor: provide the (opened) SMBClient, the start directory relative to the share, the file extension and optionally the max number of files (0 = unlimited)
◆ begin()
Counts the audio files in the start directory.
Implements AudioSource.
◆ end()
◆ endsWith()
| bool endsWith |
( |
const char * |
file, |
|
|
const char * |
ext |
|
) |
| |
|
inlineprotected |
◆ index()
Returns the actual index of the stream.
Reimplemented from AudioSource.
◆ isAutoNext()
| virtual bool isAutoNext |
( |
| ) |
|
|
inlinevirtualinherited |
Returns default setting go to the next.
Reimplemented in AudioSourceIdxSD, AudioSourceIdxSDFAT< AudioFs, AudioFile >, AudioSourceIdxSDMMC, AudioSourceLittleFS, AudioSourceSD, AudioSourceSDFAT< AudioFs, AudioFile >, AudioSourceSDMMC, AudioSourceSPIFFS, AudioSourceSTD, AudioSourceURL, AudioSourceVFS, AudioSourceCallback, and AudioSourceZephyr.
◆ isMaxReached()
| bool isMaxReached |
( |
int |
n | ) |
|
|
inlineprotected |
◆ isValidIdx()
| bool isValidIdx |
( |
int |
index | ) |
|
|
inlineprotected |
◆ nextStream()
| Stream * nextStream |
( |
int |
offset | ) |
|
|
inlineoverridevirtual |
◆ openFile()
| Stream * openFile |
( |
const char * |
path | ) |
|
|
inlineprotected |
◆ operator[]()
| Stream * operator[] |
( |
int |
idx | ) |
|
|
inlineinherited |
◆ previousStream()
| Stream * previousStream |
( |
int |
offset | ) |
|
|
inlineoverridevirtual |
Returns previous audio stream.
Reimplemented from AudioSource.
◆ selectStream() [1/2]
| Stream * selectStream |
( |
const char * |
path | ) |
|
|
inlineoverridevirtual |
Opens the indicated file. If the path is a directory, it becomes the new start directory and the first file is opened.
Implements AudioSource.
◆ selectStream() [2/2]
| 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 |
◆ setBufferSize()
| void setBufferSize |
( |
size_t |
size | ) |
|
|
inline |
Defines the read buffer size of the opened files (default 4096)
◆ setDirectory()
| void setDirectory |
( |
const char * |
path | ) |
|
|
inline |
Defines the start directory: call begin() afterwards.
◆ setFileExtension()
| void setFileExtension |
( |
const char * |
ext | ) |
|
|
inline |
Defines the file extension filter (e.g. "mp3"): nullptr for all files.
◆ setIndex()
| virtual Stream * setIndex |
( |
int |
index | ) |
|
|
inlinevirtualinherited |
same as selectStream - I just prefer this name
◆ setMaxFiles()
| void setMaxFiles |
( |
int |
maxCount | ) |
|
|
inline |
Defines the max number of files (if value is >0)
◆ setMetadataCallback()
◆ 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()
Returns the number of files that were found by begin()
◆ timeoutAutoNext()
| virtual int timeoutAutoNext |
( |
| ) |
|
|
inlinevirtualinherited |
Provides the timeout which is triggering to move to the next stream.
◆ toStr()
provides the actual file name with path
Reimplemented from AudioSource.
◆ walk()
| bool walk |
( |
Str & |
dir, |
|
|
int |
target, |
|
|
int & |
n, |
|
|
Str * |
result |
|
) |
| |
|
inlineprotected |
Lists the directory recursively and counts the matching files in n. If target >= 0 we stop at the file with this index and provide its path in result. Returns false if the directory could not be listed.
◆ buffer_size
◆ directory
◆ file
◆ file_count
◆ idx
◆ is_auto_next
◆ max_files
◆ p_client
| smb::SMBClient* p_client = nullptr |
|
protected |
◆ p_ext
| const char* p_ext = nullptr |
|
protected |
◆ timeout_auto_next_value
| int timeout_auto_next_value = 500 |
|
protectedinherited |
The documentation for this class was generated from the following file: