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.
@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?