;Script mp3.gls ;Last modified by brunskills at 4/7/00 4:22:39 PM ;DRAW THE WINDOW windowTitle "JAMBE MultiMedia Player" windowStyle popup sysmenu windowSize 345 88 24 windowSHAPE on 255 0 0 ;this causes the red background of the graphic used to be transparent ; and show the windows desktop through it imagePUT mp3.jpg ;show the graphic color lightgreen ; the colour used to show the file name mci "sound SystemExclamation" ;VARIABLES global PauseClicked 0 imageGETCLIP bluebox 6 6 215 33 ;saves the area that will display the file name fontLOAD mp3 ;a small font created to show the filne name font mp3 ;set the current font to Display set textCENTER on ;HOTSPOTS hotspot openMP3 openMP3clicked 12 60 72 35 ;the Open button, jumps to openMP3Clicked hotspot playMP3 playMP3clicked 85 60 131 35 ;the Play button hotspot stopMP3 stopMP3Clicked 153 60 204 35 ; the Stop button hotspot rewindMP3 rewindMP3clicked 210 60 290 35; the Rewind button hotspot exitMP3 exitMP3clicked 292 60 345 35 ;The exit Button forever ;wait here ;>>>>>>>>>SUBROUTINES>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ; if the Open button is clicked openMP3Clicked: sound file stop fileOPENDIALOG "Choose an MP3 or WAV file" "MP3~*.MP3;WAV~*.wav" "" FILEMUSTEXIST if @0<>"CANCEL" ;if the dialog box's Cancel button is NOT pressed... SoundLOAD @0 file ;load the chosen sound into an object called file @0 is a special variableholding the file name drawregion 7 7 217 34 ;this defines the region that will contain the title of the file imagePUT bluebox ; this overwrites any text already there ; this routine finds the file name by counting backwards to the last directory symbol searchtext="\\" ;because \ is a special symbol in GLPRO, we need to use \\ searchstring=@0 pos=strSEARCHreverse(@searchstring,@searchtext) ; searches from the end position=strLEN(@searchstring)-@pos ; converts the position from the end to a position counted from the beginning displaytext=strRIGHT(@searchstring,@position) ;now contains the file name and extension displaytext=strLEFT(@displaytext,strLEN(@displaytext)-4) ; strips the extension text 150 3 @displaytext; shows the text endif return ;if Stop is clicked stopMP3Clicked: pauseclicked=1 ;indicates that the Stop button was clicked sound file PAUSE ;pauses the sound file return ; if the Play button is clicked playMP3Clicked: if @pauseclicked=="0" ;if Stop was NOT clicked to pause the sound if !@soundplaying ;and if a sound is NOT already playing (the ! indicates NOT) sound file play ;play the sound from the beginning endif else sound file resume ;otherwise it must have been paused using STOP, so continue from where it stopped pauseclicked=0 ; and reset pauseclicked endif return ;if the Rewind button is clicked rewindMP3Clicked: sound file stop ;stops the sound and rewinds to the beginning return ;If the Exit button is Clicked exitMP3Clicked: exit