Unverified Commit 5d289fd8 authored by Wolle's avatar Wolle Committed by GitHub

close audiofile in stopSong()

parent b2061b15
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* Audio.cpp * Audio.cpp
* *
* Created on: Oct 26,2018 * Created on: Oct 26,2018
* Updated on: Apr 06,2022 * Updated on: Apr 12,2022
* Author: Wolle (schreibfaul1) * Author: Wolle (schreibfaul1)
* *
*/ */
...@@ -2053,10 +2053,18 @@ uint32_t Audio::stopSong() { ...@@ -2053,10 +2053,18 @@ uint32_t Audio::stopSong() {
if(m_f_running) { if(m_f_running) {
m_f_running = false; m_f_running = false;
if(m_f_localfile){ if(m_f_localfile){
m_f_localfile = false;
pos = getFilePos() - inBufferFilled(); pos = getFilePos() - inBufferFilled();
audiofile.close(); audiofile.close();
if(audio_info) audio_info("Closing audio file");
} }
} }
if(audiofile){
// added this before putting 'm_f_localfile = false' in stopSong(); shoulf never occur....
audiofile.close();
if(audio_info) audio_info("Closing audio file");
log_w("Closing audio file"); // for debug
}
memset(m_outBuff, 0, sizeof(m_outBuff)); //Clear OutputBuffer memset(m_outBuff, 0, sizeof(m_outBuff)); //Clear OutputBuffer
i2s_zero_dma_buffer((i2s_port_t) m_i2s_num); i2s_zero_dma_buffer((i2s_port_t) m_i2s_num);
return pos; return pos;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment