Hi Cellie,
Some thoughts here...
stream.stopSong() does stop a playing radio station, but somehow the buffers aren't completely emptied, or maybe it is not the buffers on the ESP side of things, but some buffer in the VS1053 - just wild guessing here.
Once a radio station is stopped, and a mp3/wav file is started, I hear a very short snippet (sometimes sound as an audible click) of that last radio station. The next mp3/wav file starts without that snippet/click.
Tried a lot, to no avail.
My last attempt seems to solve it, where I use it in my own application code:
stream.stopSong(); // stop whatever stream or file was playing
chunkplayer.switchToMp3Mode(); // which does a softReset() also!
stream.connectToFile(SD, filepath); // play it
Moved it to function void ESP32_VS1053_Stream::stopSong(), just at the very end of that:
void ESP32_VS1053_Stream::stopSong()
{ ...
...
_http->end();
delete _http;
_http = nullptr;
_bytesLeftInChunk = 0;
_dataSeen = false;
_vs1053->switchToMp3Mode(); // does a softReset() also !!
}
Anyway, no weird extra sounds anymore, when switching from radio station to file playing.
Although I do still hear a noisy-click when switching between radiostations.
Hope that helps.
Cheers, Frank
Hi Cellie,
Some thoughts here...
stream.stopSong() does stop a playing radio station, but somehow the buffers aren't completely emptied, or maybe it is not the buffers on the ESP side of things, but some buffer in the VS1053 - just wild guessing here.
Once a radio station is stopped, and a mp3/wav file is started, I hear a very short snippet (sometimes sound as an audible click) of that last radio station. The next mp3/wav file starts without that snippet/click.
Tried a lot, to no avail.
My last attempt seems to solve it, where I use it in my own application code:
stream.stopSong(); // stop whatever stream or file was playing
chunkplayer.switchToMp3Mode(); // which does a softReset() also!
stream.connectToFile(SD, filepath); // play it
Moved it to function void ESP32_VS1053_Stream::stopSong(), just at the very end of that:
void ESP32_VS1053_Stream::stopSong()
{ ...
...
_http->end();
delete _http;
_http = nullptr;
_bytesLeftInChunk = 0;
_dataSeen = false;
_vs1053->switchToMp3Mode(); // does a softReset() also !!
}
Anyway, no weird extra sounds anymore, when switching from radio station to file playing.
Although I do still hear a noisy-click when switching between radiostations.
Hope that helps.
Cheers, Frank