(phixonline)-->
--
-- demo\rosetta\Musical_scale.exw
--
with javascript_semantics
include pGUI.e
include builtins\beep.e
constant freq = {261.63,293.66,329.63,349.23,392,440,493.88,523.25},
durations = repeat(500,length(freq)-1) & 1000
function button_cb(Ihandle /*playbtn*/)
beep(freq,durations,0.5)
return IUP_DEFAULT
end function
IupOpen()
Ihandle label = IupLabel("Please don't shoot the piano player, he's doing the best that he can!"),
playbtn = IupButton("Play",Icallback("button_cb"),"PADDING=30x0"),
hbox = IupHbox({IupFill(),playbtn,IupFill()},"MARGIN=0x20"),
vbox = IupVbox({label,hbox}, "MARGIN=10x5, GAP=5"),
dlg = IupDialog(vbox,`TITLE="Musical Scale"`)
IupShow(dlg)
if platform()!=JS then
IupMainLoop()
IupClose()
end if