Any way to save on resources by "unloading" tracks in an event?

Say I have an event that’s environmental ambience (wind, thunder, birdsong) with 16 layered tracks. I have parameters setup to raise gain on some tracks as-needed, so they’re essentially fading in from silence.

Part of the purpose of this is allowing flexibility in a “unified” event while having a big-picture view (so I don’t have to jump between editing different events). Say I play an instance of this event that doesn’t need birdsong, so those tracks are silenced.

When those tracks are silent, is there any way to “unload” them so they’re not using memory or counting as active voices? Even if there’s some clever workaround to do this, I’m curious.

Yes and no. There’s no way to manually unload one specific track of an event at runtime, but FMOD already does most of what you’re asking for automatically.

When the volume of a channel (i.e.: a playing instance of an instrument) drops below a certain threshold (defined by the vol0virtualvol value set in FMOD_ADVANCEDSETTINGS by your game’s code), that channel is virtualized. Virtualized channels are not included in any submixes, and so require much less CPU when compared to active channels, and do not consume voices.

Virtualized channels do, however, still consume memory. This is because they need to keep the asset associated with the instrument loaded into memory (unless it’s a stream, of course), so that in the event that the channel’s volume increases again, it can resume playing the asset as if it had been playing silently the whole time.

1 Like

@joseph Always great to get your help! Also to clarify, if a vol0virtualvol is not specified, what is the default? E.g., if I add a Gain effect to a track and set that to ∞ , will that track of an event be virtualized without needing to set FMOD_ADVANCEDSETTINGS ? Is there a best practice for setting this if using Unity-FMOD integration?

If vol0virtualvol is not specified, it defaults to 0. The API uses a scale of 0-1 for volume, so a volume of zero in code corresponds to a volume of -oo dB in FMOD Studio.

Zero’s a good value for it to be at, since it means channels must be completely inaudible to be virtualized by this setting.

Incidentally, you can find the default values of various FMOD settings in our documentation.

It’s enabled by default, so you shouldn’t have to do anything special to get the behavior that’s best for most game projects.

1 Like

@joseph I appreciate the clarity! Makes sense. Thanks again… as always.