home *** CD-ROM | disk | FTP | other *** search
- property frameList, lastSoundBusy, lastFrameSound1, soundIsPlaying
- global ccTracker, soundStarts
-
- on new me
- initFrameList()
- set lastSoundBusy to 0
- set lastFrameSound1 to 0
- return me
- end
-
- on initFrameList
- global soundInfo
- set frameList to soundInfo
- end
-
- on checkSound me, frameNum
- if soundIsPlaying then
- set thisFrameSound1 to the frameSound1
- else
- set thisFrameSound to 0
- end if
- set thisSoundBusy to checkSoundBusy(me)
- set newSoundBusy to thisSoundBusy <> lastSoundBusy
- set newFrameSound1 to thisFrameSound1 <> lastFrameSound1
- if newFrameSound1 then
- if thisFrameSound1 <> 0 then
- ccOn(ccTracker, thisFrameSound1)
- else
- ccOff(ccTracker)
- end if
- end if
- repeat with i in frameList
- if i = frameNum then
- if thisSoundBusy then
- go(the frame)
- end if
- exit repeat
- end if
- end repeat
- set lastSoundBusy to thisSoundBusy
- set lastFrameSound1 to thisFrameSound1
- end
-
- on soundOn me
- if not soundIsPlaying then
- jumpFrame(me)
- set soundIsPlaying to 1
- set the soundEnabled to 1
- checkSound(me, the frame)
- end if
- end
-
- on soundOff me
- if soundIsPlaying then
- set soundIsPlaying to 0
- set the soundEnabled to 0
- checkSound(me, the frame)
- end if
- end
-
- on checkSoundBusy me
- if soundBusy(1) then
- return 1
- else
- return checkSoundBusy(ccTracker)
- end if
- end
-
- on jumpFrame me
- if the frameSound1 <> 0 then
- set theFrame to the frame
- set jumpHere to theFrame
- repeat with thisStart in soundStarts
- if thisStart <= theFrame then
- set jumpHere to thisStart
- next repeat
- end if
- exit repeat
- end repeat
- if jumpHere <> theFrame then
- go(jumpHere)
- end if
- end if
- end
-