TMRh20/TMRpcm

Unable to seek

llynix opened this issue · 1 comments

I found myself unable to seek forward into a track because I was unable to figure out what time I was currently playing.

I made the fPosition function public. And came up with this seek code to seek x second forward into the song.

void aseek(int stime) {
if(audio.isPlaying()) {
unsigned long cur = audio.fPosition();
unsigned long cursec = cur / sample_rate;
audio.stopPlayback();
char file_name[20] = "";
itoa(play_number,file_name,10);
strcat(file_name,".wav");
int ftime = cursec + stime;
#ifdef AR_DEBUG
Serial.println(ftime);
#endif
audio.play(file_name, ftime);
}
}

Just wanted to let you know my solution. Not really an issue.

TMRh20 commented

Thanks for the contribution, I will mark this as an enhancement, and if I ever get a chance, will think about incorporating it into the library.