G4C - by dck 13/1/96 ; MULTIMEDIA GUI ; This file contains a GUI for playing graphics & sound together. ; It uses the following programs, which are not included, but are ; widely available. All of them are considered to be in the c: directory. ; Viewer : PPShow 4.0 ILBM/ANIM/GIF/JPEG/DataTypes viewer ; Copyright © 1991-1994 Nico François (17.2.94) ; Additional code by Rafael D'Halleweyn ; Module Player : ProPlay2.exe - 1993 by Kenneth Nilsen / Digital Surface ; Sample Player : SFX (c) 1992 Imagine Software Inc / Trevor Andrews. ; (This is an old program, but very good) ; You can adjust it accordingly for any other players you prefer. ; most of the command line options will be similar. ; Run it with : RUN gui4cli MMedia.gc - Or, click on the icon. ; This GUI has two other GUIs that it operates, PPShow.gc and SFX.gc. ; They are GUIs that offer more options for the respective programs but ; they can also be loaded and operated on their own. ; Look at them also to get the full picture of what's going on. ;.... and heeeeere we go... ;====================> Global definitions. WINBIG -1 30 290 145 "Multi-Media!" wintype 11110001 ; a resizable window WINOUT "NIL:" WinBackground SOLID 3 0 ; You can make a nicer background, believe me.. ;======> some lines and colored text (we could use other fonts for effect, ; but I don't know if you have them, so well just leave it as it is) Line 80 130 278 130 1 Line 80 131 278 131 2 LINE 8 70 282 70 2 LINE 8 71 282 71 1 LINE 8 110 282 110 2 LINE 8 111 282 111 1 CTEXT 10 13 "Display" default 8 2 3 000 CTEXT 10 83 "Music" default 8 2 3 000 BOX 0 0 0 0 OUT ICONDROP ; A window sized box ;======> an AppMenu which will open this GUI's window. ; Any icons chosen will be placed in ppsDummy, but we will not use them, ; since we have not built into the GUI the ability to distinguish if ; the files are Graphics, Samples or Mods. It'd be too confusing for now. xAppMenu GUI-MMedia ppsDummy ON GuiOpen MMedia.gc ;====================> To be done on startup ; We check if the other 2 GUIs (ppshow.gc and sfx.gc) are loaded or not ; and if they are we use their values (filenames etc). ; Otherwise, we set the starting default values of our variables. ; Don't get confused by this stuff - It's not vital. xONLOAD setvar ppsDisplay "PPshow" ; These we set anyway. setvar ppsmusic "mod" SETGAD MMedia.gc 3 OFF ; Set the Music "adjust" button off IfExists GUI ppshow.gc ; If ppshow.gc has already been loaded update MMedia.gc 1 $ppsfile ; we update the file name update MMedia.gc 21 $ppstimes ; update the Times to play update MMedia.gc 22 $ppsjifs ; and the Jifs (speed) else ; otherwise... GUILOAD GUIs:Demos/ppshow.gc ; we load it, and set the default values.. setvar ppsjifs 3 ; Jiffs (speed) - less is faster setvar ppsJifGad "J=3" ; Command line option for jifs setvar ppstimes 100 ; Times to play animation setvar ppsTimesGad "T=100" ; command line option for times to play setvar ppstime 60 ; Time to play each picture setvar ppsTimeGad "" ; Command line option for Time - (OFF) setvar ppslace NL ; Lace / NoLace setvar ppsmouse NOMOUSE ; Mouse / NoMouse setvar ppsfile "" ; File(s) to play for ppshow endif IfExists GUI sfx.gc ; If sfx.gc is already loaded update MMedia.gc 2 $ppsmod ; update filename else ; otherwise... GUILOAD GUIs:Demos/sfx.gc ; load it, and set defaults setvar ppsmod "" ; Name of music file (none) setvar ppsleft -l ; Left speacker setvar ppsright -r ; Right speacker setvar ppsvol 64 ; Sample volume setvar ppshz 30000 ; Sample rate (speed) setvar ppsrep 100 ; No of times to repeat sample setvar ppsRepGad "-c 100" ; Command line option for repeat endif ;==========> On closing, we also close the other 2 GUIs ; You may not like this - if not, just delete these 3 lines. xONCLOSE GUICLOSE ppshow.gc ; (nothing happens if they were not open) GUICLOSE sfx.gc ;=========> On quitting we unload the other 2 GUIs also and delete all ; the variables we declared. You may also not like this - delete it. xONQUIT GUIQuit ppshow.gc ; (no problem if they were not loaded) GUIQuit sfx.gc ; Here, we would normally have to delete all the variables we declared, ; ... but I can't be bothered for now. ;*************************** PPSHOW ************************************* ;==================== PPShow adjust ========================== ; This is a cycler which lets you choose if you want to have ppshow on ; or off - if off, the graphics files will not be played - only the sound. ; you could add choices for other graphics players on this cycler, and ; have dedicated "adjust" GUIs for each of them. xCYCLER 75 5 100 12 "" ppsDisplay CSTR "PPShow" "PPShow" CSTR "OFF" "Off" if $ppsDisplay = "Off" SETGAD MMedia.gc 5 OFF else SETGAD MMedia.gc 5 ON endif xBUTTON 180 5 100 12 Adjust.. GadID 5 GUIOPEN ppshow.gc ;===================== TIMES & Jiffs Sliders =========================== ; for animations - note that I use only these two sliders because that's ; the way I like it. You may change it, by just editing this file. ; When the user changes the slider, we also update the relevant ; slider in the ppshow.gc GUI. (nothing will happen if ppshow.gc is not open) xHSLIDER 65 35 185 11 "Times:" ppstimes 1 999 100 "%3ld" GadID 21 setvar ppsTimesGad "T= $ppstimes" ; This is the full command line option update ppshow.gc 11 $ppstimes ;----------------> JIFS Slider xHSLIDER 65 20 185 11 Jiffs: ppsjifs 0 10 3 "%2ld" GadID 22 update ppshow.gc 15 $ppsjifs setvar ppsJifGad "J= $ppsjifs" ;================= File request for PPShow ============================ ; We make a TEXT gadget to show the file name chosen to play (if any) ; and place a button next to it, which will open a requester and let ; you choose file(s) - we also update the ppshow.gc TEXT gadget xBUTTON 10 50 20 15 "R" REQFILE -1 -1 300 -40 "Choose Graphics" MULTI ppsfile sys: IF $ppsfile = "" update MMedia.gc 1 "No file chosen" update ppshow.gc 1 "No file chosen" else update MMedia.gc 1 $ppsfile update ppshow.gc 1 $ppsfile endif TEXT 35 50 245 15 "No file chosen" 80 BOX GADID 1 ;***************************** MUSIC *********************************** ; In this section we choose whether we want the mod player (ProPlay2.exe) ; or the sample player (sfx) - the logic and gadgets are about the same ; as for ppshow above. ;====================> Cycler to let us choose the music player program xCYCLER 75 75 100 12 " " ppsmusic CSTR "MODULE" "mod" CSTR "SAMPLE" "samp" CSTR "OFF" "" if $ppsmusic = samp ;Only samples can be adjusted. SETGAD MMedia.gc 3 ON else SETGAD MMedia.gc 3 OFF endif ;====================> Call the gui for adjusting sfx parameters xBUTTON 180 75 100 12 Adjust.. GADID 3 ; give it an ID so we can SETGAD it. GUIOPEN sfx.gc ;===================> Text & LoadFile button for music to play with anim ; we also update the sfx.gc GUI xBUTTON 10 90 20 15 "R" REQFILE -1 -1 300 -40 "Choose Music" LOAD ppsmod sys: IF $ppsmod = "" update MMedia.gc 2 "No file chosen" update sfx.gc 2 "No file chosen" else update MMedia.gc 2 $ppsmod update sfx.gc 2 $ppsmod endif TEXT 35 90 245 15 "No Music file chosen" 150 BOX GADID 2 ;**************************** EXECUTE COMMAND LINES ****************** ;===================> Run The Multi Media Super Show :) xICON 10 113 guis:info/Play ; gosub the relevant routines SetWinTitle MMedia.gc "Loading Players..." gosub MMedia.gc PlayMusic gosub MMedia.gc PlayGraphics SetWinTitle MMedia.gc "Multi-Media!" ;--------------> ROUTINE : Play music if not OFF and if there is a file xROUTINE PlayMusic if $ppsmusic = OFF return endif if $ppsmod = "" update MMedia.gc 2 "No Music file." return endif if $ppsmusic = "mod" RUN 'run >NIL: dh0:graphics/music/proplay2.exe $ppsmod' else RUN 'run >NIL: sfx $ppsVolGad $ppsRepGad $ppsHzGad $ppsleft $ppsright $ppsscript $ppsdisk $ppsquiet $ppsmod' endif ;--------------> ROUTINE : Play graphics if not OFF and if there is a file xROUTINE PlayGraphics if $ppsDisplay != OFF if $ppsfile != "" RUN 'ppshow >NIL: $ppsfile $ppsJifGad $ppsTimeGad $ppsTimesGad $ppsmode $ppsres $ppsplay $ppslace $ppsflik $ppsdatt $ppsmouse $ppsoscn $ppscycle $ppsnoan' endif endif ;****************** SAVE AND REPLAY COMMAND LINES ********************* ; These are 2 buttons for saving and replaying the command lines we have formed ; with our GUIs - You can make slideshows with music etc.. ; - To save them, we write the command lines into a env:variable and copy to file. ; - To replay them, we just execute the saved file. xBUTTON 80 114 100 14 "Save.." setvar ppsSaveFile "" ; Get name of file to save in. ReqFile -1 -1 300 -40 "Save Commands" SAVE ppsSaveFile "" if $ppsSaveFile = "" ; User canceled Stop endif SetWinTitle MMedia.gc "Saving..." SetVar .ppsSave "" ; Put command lines into an env: variable ; save them afterwards - see later on.. if $ppsmusic != OFF if $ppsmod != "" if $ppsmusic = "mod" SetVar .ppsSave 'run >NIL: proplay2.exe $ppsmod' else SetVar .ppsSave 'run >NIL: sfx $ppsVolGad $ppsRepGad $ppsHzGad $ppsleft $ppsright $ppsscript $ppsdisk $ppsquiet $ppsmod' endif endif endif append env:.ppsSave "\n" ; Append a newline character (ENTER) if $ppsDisplay != OFF if $ppsfile != "" append env:.ppsSave 'run >NIL: ppshow $ppsfile $ppsJifGad $ppsTimeGad $ppsTimesGad $ppsres $ppsplay $ppslace $ppsflik $ppsdatt $ppsmouse $ppsoscn $ppscycle $ppsnoan' endif endif if $.ppsSave != '\n' ; If there is something to save - save it! CLI 'Copy >NIL: env:.ppsSave TO $ppsSaveFile' endif SetWinTitle MMedia.gc "Multi-Media!" ;-----------------> Replay a previously saved file (just execute it) xBUTTON 180 114 100 14 "Replay.." SetVar ppsSaveFile "" ReqFile -1 -1 300 -40 "Load Commands" LOAD ppsSaveFile "" if $ppsSaveFile > "" SetWinTitle MMedia.gc "Loading...." RUN 'Execute >NIL: $ppsSaveFile' SetWinTitle MMedia.gc "Multi-Media!" endif ;****************************** The END ******************************** ;====================== and that's all it takes ! ========================= ; Yes, I know.. SCALA 400, it ain't - but it's not bad either. ; I've tried to keep things simple (!!??) You could add much more to this ; GUI (and the supporting ones), such as other sound/graphics players ; file recognition (with the H= operator) etc. ; Also, if you find any players which have ARexx ports you could make ; this an interactive GUI - i.e. change the volume while the sample is ; playing for example etc. Imagination, is the only barrier. ; Am I tiring you ? ; dck