' ------------------------------------------------------------------
'
'      Loading AND Playing LIST DATA Saved from SoundMachine
'
'      (c) 1988  Tom Beale
'
' ------------------------------------------------------------------
WaveName$ = "Bike1.w"
ListName$ = "Bike1.l"

ON BREAK GOSUB Aus: BREAK ON

DIM V%(255)       ' The number (255) should always be 255

DIM Freq(200)     ' The number (100) may be larger or smaller,
DIM Duration(200) ' depending on your needs and how much memory you
DIM Vol(200)      ' have.

Voice = 0         ' The value can be 0, 1, 2 or 3

PRINT "Loading Wave..."
GOSUB LoadWave
PRINT "Loading List..."
GOSUB LoadList
PRINT 
PRINT "Hit any Key to Play List... Press <ESC> to break program."

main: ' ----------------------------------------------------  Main Loop
    a$=INKEY$:IF a$="" THEN GOTO main
    IF a$=CHR$(27) THEN GOTO runout
    GOSUB PlayList
    GOTO main
END

LoadWave: ' ----------------------- Load Wave Data and Put it into Array
   OPEN "I", #1, WaveName$
   FOR a = 0 TO 255
       INPUT #1, V%(a)
   NEXT    
   CLOSE 1
   WAVE Voice,V%  ' ------------- This Line assigns the wave to the voice
RETURN

LoadList: ' ----------------------- Load List Data and Put it into Arrays
   a=0
   OPEN "I", #1, ListName$
   WHILE NOT EOF(1)
       INPUT #1, Freq(a)
       INPUT #1, Duration(a)
       INPUT #1, Vol(a)
       a=a+1
   WEND
   CLOSE 1
   LastLine=a-1
RETURN

PlayList: ' ----------------------------------------------- Play List Back
   FOR a = 0 TO LastLine
      SOUND Freq(a), Duration(a), Vol(a)
   NEXT
RETURN

Aus: SYSTEM
runout:
