Playing URLS from list on a SD Card #1735
-
I need help with a coding issue. I have stored my URL stations in a text file: "http://station1",\n, "htto:\station2",\n .... "http:laststation". That is one station in quotes per line of text. I am able to read the SD Card and stored the stations into a String Array. Putting the station lists on the SD card will let me customize the list for my grandkids or wife without having to reprogram. Now I am stuck. I have not figured out how to move String url[100] to const char * urls[] ={...} which the AudioSource for the player seems to require. Also instead of sending the whole list of possible stations to the player is there a way to just send a single url to play? My current actual list only has 46 stations to choose from. I also reprogramed the player button keys so key1 moves index down -1, i key 2 -nothing, 3 up index+1, 4 up index10, key 5 sets the position to index and plays, 6 cycles the volume from 0 to 1.00 in 0.25 steps. This let me select station list fairly quickly and allows to jump to different stations positions in the list. The following reads the stations into a_url but fails to move to the urls[] const pointer array. '''
} ''' |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
The current AudioSourceURL implementation is designed to store a big amount of urls in PROGMEM w/o impacting the available RAM. My recommendation would be to do something like this:
This has the advantage that you can store a huge number of urls w/o impacting your RAM and that you don't need to mess up your sketch with any file processing logic! ps. I suggest to change your file format and that you remove the unnecessary string delimiters which just complicate the processing |
Beta Was this translation helpful? Give feedback.
The current AudioSourceURL implementation is designed to store a big amount of urls in PROGMEM w/o impacting the available RAM.
My recommendation would be to do something like this:
Read your file from the beginning until the requested index and return the string at the requested position.
keep the last index and result in some variables, so that you can return them quickly when they are requested multiple times
This has…