Can I rewind sound files or fast forward them?

QuestionManQuestionMan Member Posts: 81
edited October 2012 in Working with GS (Mac)
I know that I can stop/play/pause, but I would like to have more functionality such as set back 10 seconds, or just rewind. Thanks!

Best Answers

  • RPRP Posts: 1,990
    Accepted Answer
    If you are doing this as an in game effect you could do a work around, but it you are actually talking about the necessitation of playback RWD, FF you will need a more robust game engine, or build it from the ground up in Xcode (interface builder and objective c).

    If this is purely for effect, the work around would be create different sound files (from the master) at different intervals for your sound file, so when you hit RW button it "pretends" track back 10 seconds or whatever you want. You can even add an additional sound file that plays a reversed play sound when rewound.
  • LumpAppsLumpApps Posts: 2,881
    Accepted Answer
    FF is possible. RWD also but it takes some calculation.
    Make a game attribute named trackspeed.
    Then in the sound behaviour (so use a sound not a music behaviour) in the pitch click on the expression button (the little e). Choose the game.trackspeed behaviour you made earlier.
    Now make an actor with a rule when pressed
    - change trackspeed to 1 (or 1-trackspeed if you want it to be a pause button as well).
    This will be the play button.
    In this case the sound file should already be playing. You will need some more rules to make a real play button.

    Then make a FF button like so:
    Rule: when pressed
    - change track speed to 2
    And onother rule: when released
    - change trackspeed to 1

    For the RWD you must keep track of the time the track is playing. Then when you push a rewind button you must calculate how long this RWD button is pressed. a fake RWD sound is needed here.
    when the button is released the playing sound file should stop, replayed and then the math comes in. The point where you would want it to continue playing is the time the track was playing minus the time the RWD button was pressed. Let's call this RWDoffset. So you should play the file with volume is 0 and for example pitch = 100 for the duration of the RDWoffset*0.01
    Then play it at a normal pitch (1) and
    At volume 1 and the sound file should be at the point where it would be at a normal rewind.

    I have the FF already working but the other part takes a lot of tweaking but I don't have time at the moment. I'll try later.

    My calculations on the RWD might be wrong but it's just to give you the idea that it is possible to make an RDW button.

    Cheers!
  • LumpAppsLumpApps Posts: 2,881
    Accepted Answer
    Hé, thats strange, the post order is mixed up.

    Anyway, I might have time this afternoon to work this out and post a template. Otherwise next week. Maybe ;)

Answers

Sign In or Register to comment.