Undocumented methods eventInstance.clearHandle() && eventInstance.isValid()

Hello’,

I’m trying to understand how to use natively FMOD without using component. (I’m using it in Unity, but that is common API)

When an event is created.
What is the usage of isValid? a topic says that is for looping event and handle.
But…
What is an handle for fmod? What is the utility of an handle? Does it manage sound variation using parameters? (…) ?
To clear an Event, I was thinking I needed just to call .release() and stop() (for looping event)
But I saw on StudioEventEmitter that clearHandle is called.
Why that is not called internally by .release()? Why do we need to call that method?

Thanks in advance,

These are helper functions for dealing with the structs. Although the only one that should really be used is the isValid().

This is a wrapper for the isValid function of the FMOD classes, it checks with the System to see if it is valid but also has an early out if the handle is zero.

It is just a pointer to the FMOD object created in native code, calling functions on the struct passes this pointer to FMOD so that it knows which object to apply it to.

ClearHandle is just a nicer way to null out the pointer value, but this is not required. Even if the instance has been released but the handle has not been cleared, an isValid() check will catch that. Calling release() will release the actually memory used by the object, nothing needs to happen with the handle as it is just a pointer.

2 Likes