Hi,
there is no standard way, but you can try this patch (untested yet!)
void SdPlayClass::worker(void) {
if(!_WorkerRunning && _pBuf && _fileinfo.Size) {
uint16_t buflencpy;
_WorkerRunning = 1;
ATOMIC_BLOCK(ATOMIC_RESTORESTATE)
{
buflencpy = _Buflen;
}
if(_fileinfo.ActBytePos < _fileinfo.Size) {
// At least space for 1 sector?
if(buflencpy < _BufsizeMinus512) {
int16_t ret;
ret = SD_L1_ReadBlock(_fileinfo.ActSector++, _pBuf + _Bufin);
if(!ret) {
uint32_t BytesLeft = _fileinfo.Size - _fileinfo.ActBytePos;
_Bufin += 512;
_fileinfo.ActBytePos += 512;
if(_Bufin >= _Bufsize) _Bufin -= _Bufsize;
if(BytesLeft > 512UL) {
ATOMIC_BLOCK(ATOMIC_RESTORESTATE)
{
_Buflen += 512;
}
} else {
ATOMIC_BLOCK(ATOMIC_RESTORESTATE)
{
_Buflen += BytesLeft;
}
while(1) {
ATOMIC_BLOCK(ATOMIC_RESTORESTATE)
{
buflencpy = _Buflen;
}
if(buflencpy == 0) break;
}
play();
}
} else {
stop();
_lastError = ret;
}
}
} else {
// Playback done
if(buflencpy <= 1) {
stop();
}
}
_WorkerRunning = 0;
}
}
Replace the worker-function inside the lib (file SimpleSDAudio.cpp) with the one above. To stop playback you need to use stop() then.
Please try it and tell if it works...
Tuttut