Sequential Playlist Reset


#1

It would be nice to have a definable-length “cooldown” to reset global sequential playlists.

Is there an API command to reset the global playlist, say, after 1 second?

All I’m trying to achieve is a sound attached to a game object that when hit, it plays a tone, and each successive time you hit it, it plays up a chromatic scale. But after a certain time passes where you don’t hit it, I want the scale to reset to the first pitch in the playlist.

Not sure I fully understand the effectiveness of local playlists as they currently function. In Studio, if you click play repeatedly, even if the event has not yet finished plating out, it still plays the first file in the playlist. So obviously each click is representing the in-game creation of a new instance of the event. So, if you want use Sequential-local effectively, it has to trigger the same instrument more than once in a single instance of the event. The only method to do that is a loop or transition, which of course has its uses. I’d love to hear an example of how someone has used Sequential - Local Scope in practice, in a non-theoretical way. In the API is it possible to, instead of triggering an event repeatedly (causing multiple instances), keep it alive after the first trigger and reset the playhead to 0 for successive triggers (effectively different than hitting the play button over and over in Studio)?

To use sequential-local in the case I described at the top and keep it within FMOD as much as possible, I would have to create an instrument with the sequential playlist, move it slightly forward from 0sec on the timeline, place a sustain point very shortly after 0sec, then place a transition to a “start” destination marker which sits at 0sec. Then use a “key off” trigger to retrigger the sound. After 1 second passes, instead of triggering the key off, just replay the event. This is so cumbersome and kinda feels like a hack of the use of the sequential local playlist, and still requires the engineer to program in the cooldown which would be frustrating if there are hundreds of triggers like this each with different cooldown times. Could cause a memory leak as well with the event being kept alive. Would be so much easier if there was a non-API global playlist reset cooldown option/value.


#2

Regarding the “cooldown” of global sequential playlists - you can achieve this by instead using parameters and game code. Set up a parameter to play a sound in a single instrument at fixed values such as 1.00, 2.00, etc. (see the Footsteps example in the Examples project). When your player triggers this event instance, have some game code to set the parameter value and then a countdown function to reset the parameter value if it goes over 1 second.

If there will be only one event instance of this event then you can set the multi instrument to Sequential Local Scope. Upon the first hit of the game object, the event instance is created and played. Using a similar countdown function, release the event instance if the time goes over 1 second and create a new event instance.

Regarding the sequential local behavior - when you are using the event editor an event instance is created when played and released when it has stopped. Since the “local” is per event instance, this is why you are seeing the multi instrument play the first entry only as it is creating a new instance each time. You can enable the “Persistent” event macro to keep the event instance alive until “Stop” has been pressed.

I have put a feature request into our task tracker to look into a cooldown feature.


#3

This is something I tried. Testing this again in Studio, and still doesn’t progress through the playlist even when “persist” is on (using Sequential-Local). I assumed that pressing play in Studio is always as if creating a new event, which makes this kind of functionality difficult (impossible?) to audition in Studio.

Again, my only reason to not want to use persist is to mitigate any chance of memory leaks. We’re making pinball machines, which are likely to be left running for days.

Is there really no way using the API to reset/restart a global playlist? I appreciate you adding a global cooldown to the tracker.

This is just one of those issues where my engineers who are less familiar with audio middleware say to me: “why are we using FMOD? I still have to code things I would have had to code in Unity’s built-in audio engine anyway.” Obviously they just don’t know any better but…


#4

My mistake, you are correct that Persistent won’t keep the event instance alive if you restart the event in the event editor.

A workaround you could try is to use the sequential local scope playlist mode and on the event’s timeline have an empty single instrument 1 second after the multi instrument. This way you can play then and release the event instance immediately - if 1 second has passed then the event instance is automatically stopped and released. You can then have a much smaller piece of game code to check if an instance already exists and replay it (starting it from the beginning and choosing the next playlist entry), otherwise create and release a new instance.

Unity’s built in audio engine is an older version of FMOD, so it would be a similar situation. But yes, currently there isn’t any API to reset global sequences but we will look into it.