Understanding automatic virtualization

Hi,

I am trying to understand how automatic virtualization in FMOD works. I thought FMOD would automatically virtualize a silent event, but it doesn’t seem to be the case when I am checking in the profiler.

Am I misunderstanding how virtualization works?

Thank you!

You are misunderstanding how virtualization works - which is common, because virtualization is a complex topic.

You’re right that the FMOD Engine automatically virtualizes silent content, but this virtualization is applied to individual channels, rather than to their parent event instances. An event instance may have multiple playing channels, as a new channel is spawned whenever a single instrument or programmer instrument begins playing - which is to say, a single instrument that plays only once in the lifetime of an event instance will spawn a single channel, whereas a single instrument that can be triggered repeatedly or loops will spawn multiple channels, and a scatterer instrument with a single instrument in its playlist will spawn one channel each time it starts playing a new instance of that single instrument.

Virtualization is applied at the channel level because the audibility of a channel can differ from that of the parent event instance. For example, in the case of the scatterer instrument I mentioned earlier, some of the channels it spawns might be a greater distance from the listener than others, and so might be attenuated to silence (and thus virtualized) while other channels in the same event instance remain audible.

Event instance virtualization does exist. However, isn’t tied to silence; instead, event instances are virtualized only when the number of instances of a particular event exceeds that event’s “max instances” property. When this occurs, the quietest instances are virtualized first - which may mean event instances that are silent or close to it, but not necessarily.

So: An event instance being silent will not cause that event instance to be virtualized, but will cause all the channels associated with that event instance to be virtualized. This actually results in a greater resource saving, since it allows event instances that have some audible channels and some inaudible channels to be partly-virtualized, alongside the fully-silent and fully-virtualized event instances.

2 Likes

Thank you for the explanation Joseph! Yeah I was confusing event virtualization with voice virtualization, so thank you for clearing that up!
How would you recommend checking if all voices of an event are virtualized from code? Can I use something like ChannelGroup.getNumChannels for that?

You’d have to iterate through all the channels associated with the event and check them with Channel::isVirtual.

I’m, curious as to why you’d want to do this, though. If it’s for profiling, I reccomend using FMOD Studio’s profiler, which can display a graph of the number of channels associated with an event over time if you click on “Voices” in the transport bar.

Cool, thank you Joseph.

I was mainly curious if we hook into the “virtual events” to disable some of our own audio systems in Unity. So when all voices of an event are virtual we could stop some of our systems from using resources (except those that might put the event back into non-virtual mode of course)