following the integration the module ESP32-2432S028 with Annex32, I revisited an old project consisting of a little but nice WEB Radio player.
You can find the source code below, and the complete project, including all the icons, in the attached ZIP file.
Obviously, this project works with any ESP32 provided with a touch screen controller
Code: [Local Link Removed for Guests]
''Annex Web radio Player demo by cicciocb 2020
''''''''''''''''''''''''''''''''''''''
data "Beatles Radio", "http://www.beatlesradio.com:8000/stream/1/"
data "Jazz Radio Funk", "http://jazz-wr06.ice.infomaniak.ch/jazz-wr06-128.mp3"
data "Latina", "http://start-latina.ice.infomaniak.ch/start-latina-high.mp3"
data "Funky", "http://allzic08.ice.infomaniak.ch/allzic11.mp3"
data "Italo Disco", "http://streams.80s80s.de/italohits/mp3-192/streams.80s80s.de/"
data "Rai Radio 1", "http://icestreaming.rai.it/1.mp3"
data "Rai Radio 2", "http://icestreaming.rai.it/2.mp3"
data "Rai Radio 3", "http://icestreaming.rai.it/3.mp3"
data "Rai Radio 4", "http://icestreaming.rai.it/4.mp3"
data "Rai Radio 5", "http://icestreaming.rai.it/5.mp3"
data "Rai Radio 6", "http://icestreaming.rai.it/6.mp3"
data "Rai Radio 7", "http://icestreaming.rai.it/7.mp3"
data "Rai Radio 8", "http://icestreaming.rai.it/8.mp3"
data "Rai Radio 9", "http://icestreaming.rai.it/9.mp3"
data "Rai Radio 10", "http://icestreaming.rai.it/10.mp3"
data "Rai Radio 11", "http://icestreaming.rai.it/11.mp3"
data "Rai Radio 12", "http://icestreaming.rai.it/12.mp3"
data "Rai Radio 13", "http://icestreaming.rai.it/13.mp3"
data "Rai Radio 14", "http://icestreaming.rai.it/14.mp3"
data "Rai Radio 15", "http://icestreaming.rai.it/15.mp3"
data "Kiss Kiss", "http://ice07.fluidstream.net:8080/KissKiss.mp3"
data "Radio Pooh", "http://audio4.nemostream.tv:8011/autodj"
data "Jingle Programation", "http://stream.vestaradio.com:8091/RadioTeolis"
data "end"
play.setup 0, 64 'use internal DAC
vol = 50 ' default volume 50
dim radio$(100,2) ' max 100 radios
read r$
p = 0
while r$ <> "end"
radio$(p, 0) = r$
read radio$(p, 1)
read r$
p = p + 1
wend
nb_radios = p
wlog "nb radios "; nb_radios
current_radio = 0 ' file to be played
onplay play_event
gui.init 20
gui.image 0,0, 320, 240, "/mp3_demo/img/neptune_320.jpg"
'main buttons
gui.box 0, 177, 320, 64, black, black, black
rew = gui.buttonimage 10, 177, 64, 64, "/mp3_demo/icons/first2.bmp", "/mp3_demo/icons/first.bmp", momentary, 0, black
ply = gui.buttonimage 90, 177, 64, 64, "/mp3_demo/icons/play2.bmp", "/mp3_demo/icons/play.bmp", momentary, 0, black
stp = gui.buttonimage 170, 177, 64, 64, "/mp3_demo/icons/stop2.bmp", "/mp3_demo/icons/stop.bmp", momentary, 0, black
ffw = gui.buttonimage 250, 177, 64, 64, "/mp3_demo/icons/last2.bmp", "/mp3_demo/icons/last.bmp", momentary, 0, black
'set events on buttons
gui.setevent rew, 1, prev_radio
gui.setevent ply, 1, play_radio
gui.setevent stp, 1, stop_radio
gui.setevent ffw, 1, next_radio
' volume
gui.textline 270, 5, 50, 14, "VOLUME"
vol = gui.slider 280, 20, 30, 150, vol, vertical
gui.setevent vol, 3, vol_change ' change event
gui.setstyle vol, 12, 6, 5
'vu meter
vu_L = gui.progressbar 240, 30, 10, 130, 50, 1
vu_R = gui.progressbar 260, 30, 10, 130, 50, 1
' window with the web radio information
tt = gui.textline 120, 0, 0, 0, "Radio" , 4, White, black, black
Sitename = gui.textline 5, 22, 220, 18, "Annex32 WiFi RDS Web Radio Player", 1, cyan, black, yellow
gui.textline 120, 60, 0, 0, " Genre Bitrate" , 4, White, black, black
Genre = gui.textline 5, 70, 140, 18, "by cicciocb", 1, cyan, black, yellow
Bitrate = gui.textline 155, 70, 70, 18, "2020", 1, cyan, black, yellow
gui.textline 120, 110, 0, 0, "Title Online" , 4, White, black, black
gui.rect 4, 121, 222, 36, white
title1= gui.textline 5, 122, 220, 18, "Listen Web Radios from Internet", 1, green, black, black
title2 = gui.textline 5, 138, 220, 18, "The whole code is around 100 lines!", 1, green, black, black
gui.autorefresh 50, 1
timer0 50, update_vu
wait
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
stop_radio:
play.stop
return
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
play_radio:
' set the default text in the boxes
gui.settext Sitename, radio$(current_radio, 0) ' radio name
gui.SetText Genre, "" 'empty
gui.SetText Bitrate, "" 'empty
split_text title1, title2, "" 'empty
if (play.isPlaying = 1) or (GUI.TARGET = ply) then
play.stop
play.stream radio$(current_radio, 1), 20000
end if
return
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
prev_radio:
current_radio = current_radio -1
if current_radio < 0 then current_radio = nb_radios - 1
gosub play_radio
return
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
next_radio:
current_radio = current_radio + 1
if current_radio >= nb_radios then current_radio = 0
gosub play_radio
return
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
vol_change:
play.volume gui.getvalue(vol)
return
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
play_event:
pause 100
m$ = play.message$
SiteName$ = word.getparam$(m$, "SiteName")
Bitrate$ = word.getparam$(m$, "Bitrate")
Genre$ = word.getparam$(m$, "Genre")
Title$ = word.getparam$(m$, "StreamTitle")
if SiteName$ <> "" then gui.SetText Sitename, SiteName$
if Bitrate$ <> "" then gui.SetText Bitrate, Bitrate$ + " Kbps"
if Genre$ <> "" then gui.SetText Genre, Genre$
if Title$ <> "" then split_text title1, title2, Title$
return
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
update_vu:
gui.setvalue vu_L, log(play.VU_L/300 + 1) * 26'* 24.88 computed value
gui.setvalue vu_R, log(play.VU_R/300 + 1) * 26' * 24.88
return
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
sub split_text(obj1, obj2, txt$)
if len(txt$) < 35 then
gui.setText obj1, txt$
gui.setText obj2, " "
else
gui.setText obj1, left$(txt$, 35)
gui.setText obj2, mid$(txt$, 36)
end if
end sub
edit : icon file names corrected