Here is the main source file:
Rem Project: OGGConverter
Rem Created: 12/28/2005 7:49:01 PM
Rem ***** Main Source File *****
startblue "UserID","UserNumber"
gosub _guithing
createUI()
settrackbarRange Gadget7,1,10
quality# as float
do
getEvent
if eventSource()=Gadget2
if eventType()=MOUSE_CLICK
wav$=openDialog("Wave","Wave Sound Files (*.wav)|*.wav")
setGadgetEnabled Gadget9,0
if Get ogg vorbis exists(1)=1 then stop ogg vorbis 1
setProgressBarpos Gadget5,0
endif
endif
if eventSource()=Gadget8
if eventType()=MOUSE_CLICK
ogg$=saveDialog("OGG","OGG Sound Files (*.ogg)|*.ogg")
setGadgetEnabled Gadget9,0
if Get ogg vorbis exists(1)=1 then stop ogg vorbis 1
setProgressBarpos Gadget5,0
endif
endif
if eventSource()=Gadget4
if eventType()=MOUSE_CLICK
if Get ogg vorbis exists(1)=1 then stop ogg vorbis 1
gosub _convert
endif
endif
if eventSource()=Gadget9
if eventType()=MOUSE_CLICK
if Get ogg vorbis exists(1)=1 then delete ogg vorbis 1
if file exist(ogg$) then load ogg vorbis ogg$,1 : play ogg vorbis 1 : else errormessage "Cannot find OGG file! Unable to test OGG."
endif
endif
if ogg$="" and wav$="" then setGadgetEnabled Gadget4,0 else setGadgetEnabled Gadget4,1
q1#=getTrackbarPosition(Gadget7)
quality#=q1#/10
if escapekey()=1 then end
sync
loop
_convert:
setProgressBarRange Gadget5,0,2
setProgressBarpos Gadget5,0
do
setProgressBarpos Gadget5,getProgressBarpos(Gadget5)+1
gosub _check
if getProgressBarpos(Gadget5)=1 and ok=1 then encode to ogg vorbis wav$,ogg$,quality#
if getProgressBarPos(gadget5)=2 and ok=1 then message "Complete","Successfully Converted File!" : setGadgetEnabled Gadget9,1 : exit
if getProgressBarPos(gadget5)=2 and ok=0 then warningmessage "Could not successfully convert file!" : exit
sync
loop
return
_check:
if file exist(wav$)=0 then errormessage "Wave file not found!" : ok=0
if file exist(wav$)=1 then ok=1
return
You also need this:
`User Interface Setup Code
`Generated by Rainbow version 1.02
`===========================================
`Call createUI() to setup the user interface
`-------------------------------------------
`Global Variable Declarations for Gadgets
`----------------------------------------
global Gadget1
global Gadget2
global Gadget3
global Gadget4
global Gadget5
global Gadget6
global Gadget7
global Gadget8
global Gadget9
`Menu Gloals
`-----------
`Create User Interface
`---------------------
function createUI()
If Not GUI_CONSTANTS Then errorMessage "GUI Constants not defined. Please include gui.dba when you compile" : end
Gadget1=createPanel(180,125,265,205,0)
setPanelBorderStyle Gadget1,2
Gadget2=createButton(52,17,75,25,"Wave",0,Gadget1)
Gadget3=createLabel(7,2,95,20,"Wave To OGG",Gadget1)
` setPanelBorderStyle Gadget3,2
Gadget4=createButton(92,87,75,25,"Convert",0,Gadget1)
setGadgetEnabled Gadget4,0
Gadget5=createProgressBar(17,122,230,25,Gadget1)
Gadget6=createLabel(7,42,50,20,"Quality:",Gadget1)
Gadget7=createTrackBar(-3,62,75,25,0,Gadget1)
Gadget8=createButton(137,17,75,25,"Output",0,Gadget1)
Gadget9=createButton(92,157,75,25,"Test",0,Gadget1)
setGadgetEnabled Gadget9,0
endfunction
`Create Main Menu
`----------------
function createMainMenu()
menu=createMenu(0)
endfunction
And of course you need the BlueGUI "GUI.DBA" file.