I’m trying to set up something in FMOD and I’m not sure how to go about it:
In this puzzle game, the characters are connected to a powerline that they can be disconnected from. If they get disconnected, I want the music to slow, pitch down, and come to a stop with a light reverb tail (kind of like unplugging a record player while it’s spinning). The player can then hit the restart button to reload, in which case I want the music to continue playing from where it stopped when the characters were unplugged. Any help with this would be greatly appreciated!
You want to do two things. You want to be able to pitch down the music over time, and you want to be able to pause the music and resume it from where you left off later.
To pitch down music over time, automate the pitch property of the music event on a parameter with seek speed. The pitch property can be found in the event macro controls when the event’s master track is selected in the event editor window; giving the parameter seek speed ensures that it doesn’t change instantly when set to a new value. Oh, and you might want to set the seek speed to be asymmetric, so that you can return the event to normal pitch instantly instead of having to wait for it to spin back up when the player reloads.
To pause the event, call Studio::EventInstance::setPaused. This command pauses the event, allowing it to resume later from where it left off.
To achieve a reverb tail after an event has been paused, ensure there is an effect on the group bus into which the event is routed that provides such a tail. The FMOD Reverb effect seems like the obvious choice.
Putting those things together, it sounds like you want your game’s code to set the parameter with seek speed to the value that will pitch down the audio as soon as the character is disconnected from the power line, pause the event after a period of time equal to the time it takes for the parameter to reach its fully-pitched-down value, and then set the parameter back to its unpitched value and unpause the event when the player reloads.