Table des matières

typedef AKRESULT( * AkAudioSourceChangeCallbackFunc)(bool in_bOtherAudioPlaying,void *in_pCookie)

Callback function prototype used for when another app starts or stops playing its audio. It is useful for reacting to user music playback.

  • Under an unmixable audio session category, e.g. AkAudioSessionCategorySoloAmbient, an audio session interruption occurs when another app's audio starts playing, and the interruption callback AudioInterruptionCallbackFunc is called at this time. When another app's audio stops playing while the app remains foreground the whole time, the interruption callback is not called by Apple's design and this callback is called instead. Under a mixable audio session category, e.g. this callback is called both when another app starts and stops playing.
  • When the audio sessoin category is under AkAudioSessionCategoryAmbient, this callback behaves much like the AVFoundation callback for the notification AVAudioSessionSilenceSecondaryAudioHintNotification. In fact, this callback is called via an observer of the notification on devices running iOS 8 and later, after the sound engine handles the muting/unmuting.
  • Before calling this callback, the sound engine checks the playback status of other audio status change and mutes/unmutes registered busses according to that status. When other audio is playing, the sound engine mutes the specified busses, and unmutes them when other audio stops playing.
  • To make the app's audio mutually exclusive (unmixable) with another app's audio, it is recommended to use an unmixable audio session category with AudioInterruptionCallbackFunc instead of this callback.
See also:

Definition at line 93 of file AkSoundEngine.h.