TMRpcm icon indicating copy to clipboard operation
TMRpcm copied to clipboard

Unable to seek

Open llynix opened this issue 1 year ago • 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.

llynix avatar Mar 28 '23 14:03 llynix

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.

TMRh20 avatar May 05 '23 10:05 TMRh20