CRIWARE Unity Plugin Manual  Last Updated: 2024-07-12
[CriAtom] Coexistence with sounds from other applciations

Sample description

Overview

cri4u_samples_criatom_adv03_game_mini.png

This sample mutes the BGM category when another application is playing sounds.
It assumes that the system is iOS.

Scene information


Middleware CRI ADX (CRI Atom)
Sample Advanced samples
Location /CRIWARE/SDK/unity/samples/UnityProject/Assets/Scenes/criatom/advanced/
Scene file Scene_03_PlaybackWithOtherAudio.unity


Description of the program

Configuring the CRIWARE Library Initializer

For ADX to coexist with sounds from other applications, in the CRIWARE Library Initializer component, "Override iPod Music" in [iOS Config] must be disabled.

The other_audio_is_playing function

The other_audio_is_playing function, which checks whether other applications are playing sounds, is defined in Assets/Plugins/iOS/other_audio_is_playing.c.
This function is used by importing it from a C# script.

Muting the BGM category

At the following times, it is checked whether other applications are playing sounds in the background, in order to mute the BGM category.
  • When a scene is started
  • When an application is resumed
The sounds that do not belong to the BGM category are not affected.
Although this sample mutes a category, you could also mute a specific CriAtomSource.