So far I’ve never had any problem so haven’t thought about this at all,
but suddenly became curious, if calling FMOD_Channel_IsPlaying() after a long period of time can cause any problem, or at least return a wrong value when the sound is already stopped.

When FMOD_System_Init() is called, requested numbers of channels will be created in FMOD_SYSTEM. And when FMOD_System_PlaySound() is called, it’ll work just like FMOD Ex’s FMOD_CHANNEL_FREE, so a pointer to a free channel will be returned.
When no channels are available, channel stealing will occur, stopping one of the sounds whose priority is the lowest.

This is what I know.
So, I think channel related functions can’t guarantee their behavior 100%, even though most of the time this won’t be any problem at all with enough channels and good code.
FMOD_Channel_IsPlaying() may return TRUE if some other sound is reusing the same channel.
FMOD_Channel_SetVolume() may affect the other sound too after reaching the end or calling FMOD_Channel_Stop().

Is my theory wrong?

  • You must to post comments
Best Answer

The maxChannels argument passed into FMOD::System:init() is the maximum number of channels to be used in FMOD.
This should always be larger than the maximum number of events you want to use at any one point, the system will error if you exceed this number.

You can find more information in our API reference:

Virtual channels.
These types of voices are the ones you work with using the FMOD::Channel API. The advantage of virtual channels are, unlike older versions of FMOD, you can now play as many sounds as you like without fear of ever running out of voices, or playsound failing. You can also avoid ‘channel stealing’ if you specify enough virtual voices.

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.