home *** CD-ROM | disk | FTP | other *** search
/ GameStar 1998 November (Bonus) / GAMESTAR11B.ISO / ENCYC99 / MM / T235412A.DCR / 00079_SoundTrackerMaker.ls < prev    next >
Encoding:
Text File  |  1998-04-20  |  1.7 KB  |  85 lines

  1. property frameList, lastSoundBusy, lastFrameSound1, soundIsPlaying
  2. global ccTracker, soundStarts
  3.  
  4. on new me
  5.   initFrameList()
  6.   set lastSoundBusy to 0
  7.   set lastFrameSound1 to 0
  8.   return me
  9. end
  10.  
  11. on initFrameList
  12.   global soundInfo
  13.   set frameList to soundInfo
  14. end
  15.  
  16. on checkSound me, frameNum
  17.   if soundIsPlaying then
  18.     set thisFrameSound1 to the frameSound1
  19.   else
  20.     set thisFrameSound to 0
  21.   end if
  22.   set thisSoundBusy to checkSoundBusy(me)
  23.   set newSoundBusy to thisSoundBusy <> lastSoundBusy
  24.   set newFrameSound1 to thisFrameSound1 <> lastFrameSound1
  25.   if newFrameSound1 then
  26.     if thisFrameSound1 <> 0 then
  27.       ccOn(ccTracker, thisFrameSound1)
  28.     else
  29.       ccOff(ccTracker)
  30.     end if
  31.   end if
  32.   repeat with i in frameList
  33.     if i = frameNum then
  34.       if thisSoundBusy then
  35.         go(the frame)
  36.       end if
  37.       exit repeat
  38.     end if
  39.   end repeat
  40.   set lastSoundBusy to thisSoundBusy
  41.   set lastFrameSound1 to thisFrameSound1
  42. end
  43.  
  44. on soundOn me
  45.   if not soundIsPlaying then
  46.     jumpFrame(me)
  47.     set soundIsPlaying to 1
  48.     set the soundEnabled to 1
  49.     checkSound(me, the frame)
  50.   end if
  51. end
  52.  
  53. on soundOff me
  54.   if soundIsPlaying then
  55.     set soundIsPlaying to 0
  56.     set the soundEnabled to 0
  57.     checkSound(me, the frame)
  58.   end if
  59. end
  60.  
  61. on checkSoundBusy me
  62.   if soundBusy(1) then
  63.     return 1
  64.   else
  65.     return checkSoundBusy(ccTracker)
  66.   end if
  67. end
  68.  
  69. on jumpFrame me
  70.   if the frameSound1 <> 0 then
  71.     set theFrame to the frame
  72.     set jumpHere to theFrame
  73.     repeat with thisStart in soundStarts
  74.       if thisStart <= theFrame then
  75.         set jumpHere to thisStart
  76.         next repeat
  77.       end if
  78.       exit repeat
  79.     end repeat
  80.     if jumpHere <> theFrame then
  81.       go(jumpHere)
  82.     end if
  83.   end if
  84. end
  85.