Music plays twice, even with instance limited to 1

Hey guys,

I made an observation and I don’t quite know what is really happening.

I build up a dynamic music system event with a global parameter, which is controlled by area-related triggers.
There are two ways to enter a specific game area. The music system is made with the longer route in mind. So in my trigger script, I have a logical issue. However, that’s just so that you know, it’s the cause of the problem, which should not happen in the first place:

Having that in mind I set the instance limit to 1 (to make sure that there can only be one active music event).
The music system event has 6 parts that are logically sequentially ordered. With the logical issue, the music system should jump from part 3 to 6 and get stopped there (by another situational music event; command instrument).
The music system gets stuck in part 3 because of the logical issue (it does not get the sequence 3 to 6 in order) and it can’t execute the stop phase (coming from a command instrument) - it loops infinitely (I suppose in the stopping status) and is still an active instance. (to that point that’s my fault)

Now, after the other special music event is finished, the first (and still running) event should restart again - that happens, but now the event runs twice!
My question would be: What is the process behind the instance limitation? Why is the restarted event running while the first instance of the event also continues playing?
It’s set to 1 instance with stealing to “oldest”

In my understanding, the instance limit should kill the first event instantly.

Hi,

What version of FMOD are you using, and could I grab a screenshot of the event in FMOD Studio?

You are correct, if the Instance Limit is set to 1 and Stealing is set to oldest that is the behavior you would expect, more details of Limits and Stealing can be found under FMOD Studio | Advanced Topics. You may be wanting to change the Polyphony of the instrument (FMOD Studio | Instrument Reference) as you are not stopping and starting a new Event Instance rather restarting the current one. Setting the Polyphony to ‘1’ and Stealing to Oldest


Will hopefully have the behavior you want.

Hello Connor,
of course: Here is the screenshot.

In the second part of Music Status 1 (global parameter), the event is stuck in the Loop.

I think I am starting a new Event Instance since the first one is still running in the loop in Music Status 1. I mean, is it possible to run the same Event Instance at the same time?

Thanks for the screenshot.

It is possible to trigger an instrument more than once using Polyphony. Could you run a Profiler session (FMOD Studio | Profiling)? Keeping an eye on how many instances of this event are being created during runtime (FMOD Studio | Profiling). If the instance limit is working then there should never be more than one created and this will be shown in the session. How are you changing the parameter? Is it via code or a command instrument?

Would it be possible to get a copy of your project without any assets uploaded to your Profile so I can have a closer look at the parameter issue?

Hi Connor,

the issue with the parameter is solved. As I wrote in the original post the logical issue was my mistake.
However, with this mistake, I noticed, that the Event Instance Limit does not work as I thought it would.

I made a run with the Profiler and at the end, the music event shows Instances (self) 2!
That is not how it should be, when the Instance Limit is 1.
Btw. I am using FMOD Studio 2.02.11

Could it be, that the “stopping” play-status interferes with the Instance Limit?

My music structure is basically:
Area Music starts, runs sequentially global parameter “music_status” 0-6,
“special music”-event takes over (by giving the stop command via instrument),
after finishing special music code (Unreal BluePrint) starts Area Music with global parameter 1

On another route of the game, the first Area Music ends not at 5 to 6, but in the second half of 1 (see screenshot) and can’t jump to 6. Now it is stuck in the loop, while it gets the Stop Command from the Special Music Event and is unable to finish the stopping status. In that status, the event later gets started again, which makes a second instance (seen in Profiler) but still can’t stop the first instance.

I upload my project on my profile - including the Profiler Session.

Thank you for the profiling session.

The Command Instrument you use to stop the event won’t stop it immediately. However, it puts it in the Stopping state. There is a known issue where an Event in the Stopping state will not be considered for stealing. We are currently working on a fix and it will be released with the next update.

1 Like

Yes, the Command Instrument is not Stopping immediately is what I want for the music transition from one event to the other.
Good to know that there is an issue with stealing in the stopping state.
Thanks for addressing this!

1 Like