adafruit / Adafruit_VS1053_Library

This is a Arduino library for the Adafruit VS1053 Codec Breakout and Music Maker Shields
https://www.adafruit.com/products/1381
133 stars 112 forks source link

FilePlayer: Add playback position to .startPlayingFile function #66

Open MrTolchock opened 4 years ago

MrTolchock commented 4 years ago

The original .startPlayingFile function of the Adafruit_VS1053_FilePlayer class always starts playback from position 0. This pull request proposes very few changes to allow for an optional position input for the .startPlayingFile function in order to start playback also from a defined position which is not 0. In addition, the new getFilePosition function allows to check for the current playback position of a file.

These changes were proposed by adafruit_support_rick in this post: https://forums.adafruit.com/viewtopic.php?f=25&t=123646. I only changed the seek part a bit, such that the approach also works for mp3 files.

The changes were successfully tested with the Arduino 1.8.11 IDE, an Adafruit Feather ESP8266 and the Music Maker FeatherWing w/ Amp.

TheNitek commented 4 years ago

Does this work for all file formats? Any file headers will be skipped as well.

MrTolchock commented 4 years ago

Does this work for all file formats? Any file headers will be skipped as well.

Because only the mp3 file header is skipped and not the ones of other formats? I did not change it vs the current Adafruit version, which means that skipping any headers other than mp3 has not been implemented to the master version so far.

TheNitek commented 4 years ago

I meant it the other way around: Some file format NEED the file headers to be sent to the decoder

MrTolchock commented 4 years ago

I meant it the other way around: Some file format NEED the file headers to be sent to the decoder

Ah now I get it! Uff, I don't think that I have the skills to implement the position for other file types, so I rather close the pull request. Thank you for the input!

TheNitek commented 4 years ago

Nono, please don‘t give up because of me. Maybe it makes sense to make the jump for MP3s only. If other file types are needed, this could still be extended.

MrTolchock commented 4 years ago

Thanks mate. Sorry, it is my first pull request and I'm not a programmer, so I was not sure.

jonfroehlich commented 1 year ago

I would love to see this feature get implemented. Could we consider merging this PR?

johnwargo commented 10 months ago

This is more than three years old, do we close it or does someone want to pick it up and make it mergeable?