'**********************************************************
'* 
'*   Tracker Player  
'* 
'**********************************************************

'   This a very simple little Workbench program that plays tracker modules 
' (everyones got a few of these kicking around their hard discs...)

'   The code was knocked up in about 20 minutes - the interface was drawn
' into GadToolsBox, and the code ported accross in the normal way. 
'   There isn't much added - just the definition of the file requester 
' and the _HANDLEMUSICGADS procedure which actually makes the program
' play the modules, bring up the requester, etc. 

'   To compile this, uncomment the Screen Open line from the _INITIALIZE 
' procedure, remove the Amos To Front line from _CLEANUP, and compile as a 
' Workbench program, with 'Amos to back on boot' and 'no default screen' 
' selected.  

'these are all from GadToolsBox
Global _SCRAPTAGS,SCRAPTAGS,_PORTLIST,_MESSLIST
Global PATH$,OSVER
Global FHEIGHT,FWIDTH,MBAR,OX,OY,SW,SH
Dim _MUSICGADS(4)
Global _MUSICGADS()
Global _FILESTR,_FILESEL,_PLAY,_STOP
Dim _MUSICZOOM(1)
Global _MUSICZOOM()
Global _MUSICWIND

'** this is used for the asl file requester  

Global MYASL

On Error Proc _CLEANUP
_INITIALIZE
_GUIDATA
_SETUPALL
_SETPORTS

'** here we create the file requester, with a few appropriate tags.
'Note that this is done AFTER opening the window otherwise ASLFR_Window
'would be rather pointless.
'Remember to add a J Free Asl Requester line to the _CLEANUP routine 

J Tag _SCRAPTAGS,1,Equ("ASLFR_TitleText"),J Make String("Select a med file")
J Tag Equ("ASLFR_SleepWindow"),True
J Tag Equ("ASLFR_Window"),_MUSICWIND
J Tag Equ("ASLFR_RejectIcons"),True
J Tag 0,0
MYASL=J Create Asl Requester(Equ("ASL_FileRequest"),_SCRAPTAGS)

Do 
   K=J Wait Message
   While K
      C=J Tag Data(_MESSLIST,1)
      If C=Equ("IDCMP_CLOSEWINDOW")
         _CLEANUP
      Else If C=Equ("IDCMP_REFRESHWINDOW")
         _DOREFRESH
         
         '** these two lines are added by me - if a gadget is clicked, my gadget
         ' handling routine is called 
      Else If C=Equ("IDCMP_GADGETUP")
         _HANDLEMUSICGADS
      End If 
      K=J Next Message
   Wend 
Loop 

'** This code is totally machine generated and is nothing to do with me... 
'by Gadtools 
Procedure _INITIALIZE
Procedure _SETUPALL
Procedure _GUIDATA
Procedure _MAKEMUSICGADS
Procedure _MAKEMUSICWIND[SC]
Procedure _MUSICRENDER
Procedure _DOREFRESH
Procedure _SETPORTS
Procedure _FREEWIND[W,G,M,A,C]
Procedure _CLEANUP

'** This procedure is mine - it handles the user clicking gadgets

Procedure _HANDLEMUSICGADS

