Channel events

(Mark81) #1

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!

(リチャード清水) #2

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:

I hope this helped.


(Mark81) #3

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?

(リチャード清水) #4

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.