Channel events

Hi! I’m sorry if my question was already asked but I cannot find anything in the past threads. I’m looking for events (callback) to know when the state of a channel change. Example:

  • isPlaying changed
  • getLoopCount changed

I really don’t want to polling all that functions!

Hi Mark,

There aren’t any callbacks for those sort of state changes like those; you will need to query them periodically to check if they are changed.

There are some Studio Event callbacks that you can use to check various states:

https://www.fmod.com/resources/documentation-api?page=content/generated/FMOD_STUDIO_EVENT_CALLBACK_TYPE.html

I hope this helped.

Thanks,
Richard

1 Like

Thanks. In low-level API what is the right way to know if a sound has ended? I would check both isPlaying() == false && getPause() == false. Is it correct?

Hi Mark81,

If you’re using FMOD Studio events, you can use the FMOD_STUDIO_EVENT_CALLBACK_SOUND_STOPPED callback from the FMOD_STUDIO_EVENT_CALLBACK_TYPE. If you’re using the low-level API (ie. FMOD::Sound) then you will need to use the two functions you listed.

Thanks,
Richard