home *** CD-ROM | disk | FTP | other *** search
- property myCurrentTrack, trackPlaying, timerStart, myDelay, myMaxSound, checkFlag
- global gMasterObj
-
- on new me
- set trackPlaying to 0
- set myCurrentTrack to 0
- set checkFlag to 0
- append(the actorList, me)
- return me
- end
-
- on stepFrame me
- if trackPlaying and not soundBusy(1) and not checkFlag then
- set checkFlag to 1
- puppetSound(myCurrentTrack)
- else
- if trackPlaying and not soundBusy(1) then
- set checkFlag to 0
- else
- if soundBusy(1) then
- set checkFlag to 0
- end if
- end if
- end if
- end
-
- on playSoundTrack me, whichTrack, whatDelay, maxSound
- if whichTrack <> myCurrentTrack then
- set myMaxSound to maxSound
- set the volume of sound 1 to myMaxSound
- set myDelay to whatDelay * 60
- if trackHasFadedOut(me) then
- set myCurrentTrack to whichTrack
- if myCurrentTrack <> 0 then
- set trackPlaying to 1
- else
- set trackPlaying to 0
- end if
- end if
- end if
- end
-
- on trackHasFadedOut me
- if soundBusy(1) then
- set startSoundVolume to the volume of sound 1
- set timerStart to the timer
- repeat while 1
- cursor(4)
- if the timer > (timerStart + (myDelay / 10.0)) then
- set timerStart to the timer
- set the volume of sound 1 to the volume of sound 1 - (startSoundVolume / 10.0)
- updateStage()
- if the volume of sound 1 <= 0 then
- puppetSound(1, 0)
- set the volume of sound 1 to myMaxSound
- cursor(-1)
- exit repeat
- end if
- end if
- end repeat
- end if
- return 1
- end
-
- on alterVolume me, myIncrement
- if (myIncrement = 1) and (myMaxSound < 255) then
- set myMaxSound to myMaxSound + (255 / 10.0)
- set the volume of sound 1 to myMaxSound
- else
- if (myIncrement = -1) and (myMaxSound > 0) then
- set myMaxSound to myMaxSound - (255 / 10.0)
- set the volume of sound 1 to myMaxSound
- else
- beep()
- end if
- end if
- end
-