I have a complicated event (the “Music Event”) that implements dynamic music. It plays forever, looping and jumping around randomly so as not to repeat.
I have another complicated event (the “Jungle Event”) that is creating random ambient jungle noises. It is on a simple loop and also plays forever.
I want to have the Jungle Event periodically fire off the Music Event for a random period of time. The effect I’m going for is to have ambient jungle noises and then periodically have music fade in, run for a random period of time, and then fade out.
To make the Music Event run for random lengths of time and fade in and out when started and stopped, I have created a “Fade Music” event that has a single audio track which references the Music Event. It has a loop that triggers at a certain percentage to control how long the music runs, and uses AHDSR to fade in and out the Music Event. That all works fine.
I can’t figure out to use the Fade Music event inside the Jungle Event in such a way that it both a) runs for as long as it wants and b) keeps triggering.
If I simply add the Fade Music event in a Event Sound, Multisound or Scatterer sound and make it slightly smaller than the loop region in the Jungle Event, the music stops playing when the playhead hits the end of the sound (even if I choose Async on the Multisound).
If I make the Fade Music event be the same size as the loop region in the Jungle Event, it plays till the end, but won’t retrigger.
So: How can I get an event in a loop to play until it is finished AND retrigger, if the event is longer than the loop?
The answer to this question is complex, and touches on some of the more subtle and obscure details of how event sound modules work.
FMOD Studio automatically attempts to determine whether each event sound module in your project will end of its own accord - but unfortunately, is not able to do so accurately if the event contains any logic markers. (See https://en.wikipedia.org/wiki/Halting_problem for detailed information on why this is the case.) To be safe, if any logic markers are present in the nested event, FMOD Studio automatically assumes that event sound modules based on that event will not stop of their own accord. To prevent such sound modules from “leaking” event instances, FMOD Studio automatically stops any such sound module the moment the cursor leaves it. This is the cause of the behavior you’ve observed.
The good news is that this behavior is currently under review, and will likely be changed in an upcoming release of FMOD Studio. It made sense when it was first implemented because of the lack of transparency event sound modules had at that time, but times have changed, and we have decided that this behavior is in need of an update.
The bad news is that because this represents a significant change, it will have to be made in a major release of FMOD Studio rather than in a patch. In addition, we can’t include it in our next major release (FMOD Studio 1.10.00) because of scheduling issues, which means it will have to wait until a later major release than that.
In the mean time, the only thing I can suggest is to add an AHDSR modulator with a long release to the volume of your event sound module. There is no other way, that I am aware of, to ensure an event sound module that references an event with timeline logic does not immediately stop when untriggered.