Total Channel Count Grows Forever

Hey there. I’m having an issue with audio cutting out “randomly” as I play, and profiling/debug shows that my total channel count grows until it reaches the set limit, then things start cutting out.

The odd thing is that I am most definitely releasing my instances after stopping them, but they just seem to go virtual and never actually clean up, even when loading into a new scene (after making sure to release instances on destroy).

The return result of my stop() and release() calls are “OK” as well.



Any help would be appreciated, I feel like I missed something obvious here…

Figures I’d start finding what’s wrong as soon as I post here, but I’m still not sure on the proper way to do this.

The issue was that the events use a sustain point to play a start and stop sound for the event, but when you press stop, the timeline never actually stops. I assume I’m just not doing this “the right way” so what would the right way to wrap a loop with a start and stop one-shot be?

Hi,

Thank you for the screenshots and the information.

Could I grab the exact integration version you are using?


Could you elaborate on the expected behaviour for the event?

Thanks for the info

Hey Conner, sure thing.

I honestly expected the timeline to automatically go from “stopping” to “stopped” after the playhead had moved off of the last clip in the timeline.

But overall, the event is supposed to encompass a car’s engine. So when you press play, it plays a one-shot of the cars starter turning over, then the main idle/rpm loop takes over. This can be controlled through parameters to change RPM and load on/off etc. Once the engine is stopped it would “stop” the event, which causes the idle/rpm loop to stop, and the “engine off” sound to play so that it sounds like it’s sputtering out.

Thank you for the explanation.

Unfortunately, I cannot reproduce the issue.

I think it may be solved by adding

var keyOffResult = _engineEventInstance.keyOff();

to your stop function to allow the event to fade out as expected.

However, I would prefer to test it with your project if that is possible?

Absolutely. I’ll do you one better and make a minimum repro project with just this case in it.
I’m not sure where best to upload it, so I have it on my personal CDN here:
http://zipline.janooba.com/u/fmodRepro.zip

All you need to do is:

  1. Open event:/Mercedes/Mercedes_Engine
  2. Press Play and let run for a few seconds
  3. Press stop once and observe that the state does not go to “STOPPED”, but just continues playing the “Timeline” timeline until stop is pressed again.

Something about having another Parameter sheet in here seems to be what causes the issue.

Thank you for your time, it’s much appreciated!

1 Like

Thank you very much for creating that so quickly! Would it be possible to upload the project to your profile here: https://fmod.com/profile#uploads.

For sure! It’s done now

Hi, since Connor is away, I will be continuing the investigation.

Thank you very much for uploading the project, that’s really helpful.

It looks like that the reason the event wasn’t stopped previously was because events with logic marker in the timeline logic track have no natural end, so they require manual stopping using Studio::EventInstance::stop().

Hope this helps, let me know if the issue persists

So then I would have to call stop twice it seems, once to trigger the stopping effect, then again to stop it completely later, does that sound correct?

Using the profiler, t have noticed that calling stop twice doesn’t fully terminate the event instance, leaving some resources active.

To address the issue, you could consider using a Command Instrument. Placing it at the end of the clip and set the command type to Stop Event - Immediate. This ensures the event stops completely when the timeline reaches the end of the clip.

This solution should work! Thank you!

1 Like