File tree Expand file tree Collapse file tree 6 files changed +13
-0
lines changed Expand file tree Collapse file tree 6 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -72,6 +72,7 @@ class AudioSourceSD : public AudioSource {
7272 }
7373
7474 void end () {
75+ file.close ();
7576 SD.end ();
7677 is_sd_setup = false ;
7778 }
Original file line number Diff line number Diff line change @@ -87,6 +87,8 @@ class AudioSourceSDFAT : public AudioSource {
8787 }
8888
8989 void end () {
90+ file.close ();
91+
9092 if (is_sd_setup) {
9193 TRACEI ();
9294#ifdef ESP32
Original file line number Diff line number Diff line change @@ -53,6 +53,7 @@ class AudioSourceSDMMC : public AudioSource {
5353 }
5454
5555 void end () {
56+ file.close ();
5657 SD_MMC.end ();
5758 is_sd_setup = false ;
5859 }
@@ -65,6 +66,7 @@ class AudioSourceSDMMC : public AudioSource {
6566
6667 virtual Stream *selectStream (int index) override {
6768 LOGI (" selectStream: %d" , index);
69+ file.close ();
6870 idx_pos = index;
6971 file_name = idx[index];
7072 if (file_name==nullptr ) return nullptr ;
Original file line number Diff line number Diff line change @@ -40,6 +40,7 @@ class AudioSourceSPIFFS : public AudioSource {
4040 }
4141
4242 void end () {
43+ file.close ();
4344 SPIFFS.end ();
4445 is_sd_setup = false ;
4546 }
@@ -51,6 +52,7 @@ class AudioSourceSPIFFS : public AudioSource {
5152
5253 virtual Stream *selectStream (int index) override {
5354 LOGI (" selectStream: %d" , index);
55+ file.close ();
5456 idx_pos = index;
5557 file_name = idx[index];
5658 if (file_name==nullptr ) return nullptr ;
Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ class AudioSourceSTD : public AudioSource {
3232 }
3333
3434 virtual void end () {
35+ file.close ();
3536 }
3637
3738 virtual Stream *nextStream (int offset = 1 ) override {
Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ class AudioSourceVFS : public AudioSource {
4343 }
4444
4545 virtual void end () {
46+ file.close ();
4647 if (p_vfs) p_vfs->end ();
4748 }
4849
@@ -64,6 +65,10 @@ class AudioSourceVFS : public AudioSource {
6465
6566 virtual Stream *selectStream (const char *path) override {
6667 file.close ();
68+ if (path == nullptr ) {
69+ LOGE (" Filename is null" )
70+ return nullptr ;
71+ }
6772 assert (p_vfs != nullptr );
6873 file = p_vfs->open (path);
6974 file_name = file.name ();
You can’t perform that action at this time.
0 commit comments