Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

rateShift again

Status
Not open for further replies.

manfishj

Programmer
May 30, 2002
44
0
0
US
Hello,

I know I asked this basic question before, but I still haven't gotten anywhere. I am experimenting by using the rateShift property for FF and REW buttons. I would like to click on a FF button. While the mouse is down, I'd like the rateShift to increase to 15. On mouseUp, I'd like it to go back to zero, but it should be continuing from the same point in the audio, as opposed to starting from the beginning.

I have been able to control the rateShift, but whenever I I unclick the button, it starts the audio from the beginning. Please--any help would be appreciated. I don't have much time to perfect it. Thanks in advance.

manfishj
 
Sorry I would have responded earlier to the earlier post, but I was too busy to get a chance. You might need to work with the numbers but I got it to work quite well.
First I set a global var in a prepareMovie handler, call gTime

and in a enterFrame handler on the frame script put:
set gTime=sound(channelNum).currentTime
end

Then on the button script
on mouseDown
timey=gTime/2
sound(channelNum).play ([#member:member("soundFileName"), #rateShift: 12, #startTime: timey])
end

on mouseUP
timey=gTime*2
sound(channelNum).play ([#member:member("soundFileName"),#startTime: timey])
end

so I set a global variable equal to the currentTime of the sound playing in your channel. Only problem was that it did not account for the rateShift. So the variable timey is set equal to the current time, but I divided by two and multiplied by two to compensate as I noticed the difference in the currentTime (It was playing about twice as fast as the currentTime) and ( I also used: put gTime into field "fieldName" on the enterframe handler to track the currentTime).
So this is where you will need to work with the numbers. I used 12 as the rateShift not 15, so do a little math and you should be set.

Good luck with it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top