1 Reply Latest reply on Mar 2, 2009 2:47 PM by Newsgroup_User

    recognizing Markers in .WAV files

      ok so I have a .WAV file where I have placed markers ( literally named Marker 1, 2, etc ) at different locations in the file. I imported my .WAV into director 10. I have next buttons where I want them, onDown to skip to the next marker in the .WAV. What code do I use to do this?
        • 1. Re: recognizing Markers in .WAV files
          Level 7
          You could start by grabbing the cuePointTimes list from the WAVE file,
          executing a findPosNear based on the currentTime of the sound playing,
          and set the currentTime to the next one found.

          Something like the following might get you started (watch for unintended
          line breaks):
          on mouseUp me
          -- assume the sound file is playing in channel 1 (alter the
          channelIndex to suit):
          tSound = sound(1)
          -- check whether the channel is currently playing a sound
          if tSound.isBusy() then
          -- get the currently playing #sound member into a local variable
          for faster re-use later
          tMember = tSound.member
          -- ditto its list of cue point (marker) times
          cpTimes = tMember.cuePointTimes
          -- how many cue points are defined
          nTimesListed = count(cpTimes)
          -- if there are *any*
          if nTimesListed then
          -- what's the current time of the sound playing
          curTime = tSound.currentTime
          -- what's the next listed cue point
          tPos = cpTimes.findPosNear(curTime) + 1
          -- if there is such an index in the cue point list...
          if tPos <= nTimesListed then
          -- ... then get its time
          tTime = cpTimes[tPos]
          -- and start the sound playing from here
          tSound.play([#member: tMember, #startTime: tTime])
          end if
          end if
          end if