home *** CD-ROM | disk | FTP | other *** search
/ GQ - Louise, World Cup, …remy Clarkson, Armageddon / GQCD.iso / files / startup.dxr / 00004_soundScript.ls < prev    next >
Encoding:
Text File  |  1998-05-21  |  1.9 KB  |  77 lines

  1. property myCurrentTrack, trackPlaying, timerStart, myDelay, myMaxSound, checkFlag
  2.  
  3. on new me
  4.   set trackPlaying to 0
  5.   set myCurrentTrack to 0
  6.   set checkFlag to 0
  7.   append(the actorList, me)
  8.   return me
  9. end
  10.  
  11. on stepFrame me
  12.   if trackPlaying and not soundBusy(1) and not checkFlag then
  13.     set checkFlag to 1
  14.     puppetSound(myCurrentTrack)
  15.   else
  16.     if trackPlaying and not soundBusy(1) then
  17.       set checkFlag to 0
  18.     else
  19.       if soundBusy(1) then
  20.         set checkFlag to 0
  21.       end if
  22.     end if
  23.   end if
  24. end
  25.  
  26. on playSoundTrack me, whichTrack, whatDelay, maxSound
  27.   if whichTrack <> myCurrentTrack then
  28.     set myMaxSound to maxSound
  29.     set the volume of sound 1 to myMaxSound
  30.     set myDelay to whatDelay * 60
  31.     if trackHasFadedOut(me) then
  32.       set myCurrentTrack to whichTrack
  33.       if myCurrentTrack <> 0 then
  34.         set trackPlaying to 1
  35.       else
  36.         set trackPlaying to 0
  37.       end if
  38.     end if
  39.   end if
  40. end
  41.  
  42. on trackHasFadedOut me
  43.   if soundBusy(1) then
  44.     set startSoundVolume to the volume of sound 1
  45.     set timerStart to the timer
  46.     repeat while 1
  47.       cursor(4)
  48.       if the timer > (timerStart + (myDelay / 10.0)) then
  49.         set timerStart to the timer
  50.         set the volume of sound 1 to the volume of sound 1 - (startSoundVolume / 10.0)
  51.         updateStage()
  52.         if the volume of sound 1 <= 0 then
  53.           puppetSound(1, 0)
  54.           set the volume of sound 1 to myMaxSound
  55.           cursor(-1)
  56.           exit repeat
  57.         end if
  58.       end if
  59.     end repeat
  60.   end if
  61.   return 1
  62. end
  63.  
  64. on alterVolume me, myIncrement
  65.   if (myIncrement = 1) and (myMaxSound < 255) then
  66.     set myMaxSound to myMaxSound + (255 / 10.0)
  67.     set the volume of sound 1 to myMaxSound
  68.   else
  69.     if (myIncrement = -1) and (myMaxSound > 0) then
  70.       set myMaxSound to myMaxSound - (255 / 10.0)
  71.       set the volume of sound 1 to myMaxSound
  72.     else
  73.       beep()
  74.     end if
  75.   end if
  76. end
  77.