SDFat source– getting number of files in directory after change of path #1360
Unanswered
pypypypywong
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi All!!
I am follow the example in https://github.com/pschatzmann/arduino-audio-tools/blob/main/examples/examples-player/player-sdfat-i2s/README.md
I wish to change the source path to a different directory on the SD card then find out the total number of .wav files in that directory in order to use them as a max index value.
I start my audioplayer as per the example and then (upon a button press) change the directory by calling:
player.end();
source.setPath(myNewPath);
player.begin();
however when I call
int maxFilesInDirectory = source.size();
I am finding that the number of files returned is as per the original path (set in the source's constructor), not the new path I have just set via source.setPath(myNewPath)
The audio files from the new path play just fine, just the source.size() is incorrect.
Am I missing something here?
Hardware is esp32 with standard SD card reader as per readme above. Audio chip is Max98357A.
Beta Was this translation helpful? Give feedback.
All reactions