Is the FMOD_Channel_IsPlaying() always guaranteed to work properly?

Do I need to set the value of the variable isPlaying to 0 before calling FMOD_Channel_IsPlaying(myChannel, &isPlaying)?

A long time ago when I used the function of the older FMOD Ex version, it always returned “true”.
It caused very serious bugs in our app back then, and assigning “false” right before the FMOD_Channel_IsPlaying() calls solved them.

I still don’t know the exact reason for the bug, but initializing FMOD_BOOLs with “false” became my habit ever since.

Is the FMOD_Channel_IsPlaying() always guaranteed to return a correct value regardless of whether the variable’s initialized before use?

Hi,

The best way to check that FMOD functions have run correctly is to use FMOD_RESULT. Most FMOD Functions will return a FMOD_RESULT which you can then debug, a full list of the return values can be found under Core API Reference | Common.

It is a good idea to initialize variables, doing so avoids the possibility of using uninitialized values which may lead to undefined behavior.

Hope this helps!

1 Like