Arduino library to play MOD, WAV, FLAC, MIDI, RTTTL, MP3, and AAC files on I2S DACs or with a software emulated delta-sigma DAC on the ESP8266 and ESP32
AudioGenerator should let AudioOutput finish playing buffered samples.
Reproduction:
ESP32, Create AudioOutputI2S with large number of buffers: AudioOutputI2S(port, 1, 80)
play mp3 or WAV file
=> large part of sound file is not played
The common loop:
if (mp3->isRunning()) {
if (!mp3->loop()) mp3->stop();
} else {
Serial.printf("MP3 done\n");
delay(1000);
}
stops AudioOutput as soon as last sample is pushed to output. All buferred samples are discarded.
Solution:
After pushing last sample, AudioGenerator should call AudioOutput->finish() as long as it returns false.
While finishing, AudioGenerator should return true from AudioGenerator->IsRunning() and AudioGenerator->loop().
Implemented for AudioOutputI2S ( and AudioOutputNoDAC effectivelly ) , and AudioGeneratorMP3 and AudioGeneratorWAV.
Other classes work as before ( not affected ).
AudioGenerator should let AudioOutput finish playing buffered samples.
Reproduction:
The common loop:
if (mp3->isRunning()) { if (!mp3->loop()) mp3->stop(); } else { Serial.printf("MP3 done\n"); delay(1000); }
stops AudioOutput as soon as last sample is pushed to output. All buferred samples are discarded.
Solution: After pushing last sample, AudioGenerator should call AudioOutput->finish() as long as it returns false. While finishing, AudioGenerator should return true from AudioGenerator->IsRunning() and AudioGenerator->loop().
Implemented for AudioOutputI2S ( and AudioOutputNoDAC effectivelly ) , and AudioGeneratorMP3 and AudioGeneratorWAV. Other classes work as before ( not affected ).