CRI ADX  Last Updated: 2025-05-07 13:34 p
Voice Pool ID

Sample directory

/cri/pc/samples/criatomex/voice_pool_identifier

Data used in the sample

/cri/common/smpdata/criatomex/
  • SampleProject.acf
  • AtomCueSheet.acb
  • AtomCueSheet.awb

Sample Description

When multiple voice pools exist and a player plays a song, which voice pool the player will get a voice from will vary depending on the situation at the time of playback.
Therefore, if multiple sounds are played back without setting a priority, it may cause unintended undesirable situations, for example, the BGM Voice stops and is replaced by a playback of an SE.
When there is a sound which you want to play back such as BGM or dialogue regardless of the situation of other sounds, you must allocate dedicated Voice Pool for these sounds.
To achieve this, Atom library provides "Voice Pool ID."
Voice Pool ID is a unique number which identifies a Voice Pool.
When you specify a Voice Pool ID when creating a Voice Pool, the Voice Pool is referenced only from players who know the ID.
Following code shows the procedure to associate a Voice Pool and a player using the Voice Pool ID.
/* Create Voice Pool 1 */
/* Set unique ID "0x1234" to the Voice Pool */
pool_config.identifier = 0x1234;
pool_config.num_voices = 4;
app_obj->voice_pool1 = criAtomExVoicePool_AllocateAdxVoicePool(&pool_config, NULL, 0);
/* Create Voice Pool 2 */
/* Set unique ID "0x5678" to the Voice Pool */
pool_config.identifier = 0x5678;
pool_config.num_voices = 4;
app_obj->voice_pool2 = criAtomExVoicePool_AllocateAdxVoicePool(&pool_config, NULL, 0);
/* Create player 1 */
app_obj->player1 = criAtomExPlayer_Create(NULL, NULL, 0);
/* Limit the Voice Pool referenced by player 1 to the Voice Pool with ID "0x1234" */
criAtomExPlayer_SetVoicePoolIdentifier(app_obj->player1, 0x1234);
/* Create player 2 */
app_obj->player2 = criAtomExPlayer_Create(NULL, NULL, 0);
/* Limit the Voice Pool referenced by player 2 to the Voice Pool with ID "0x5678" */
criAtomExPlayer_SetVoicePoolIdentifier(app_obj->player2, 0x5678);
void criAtomExPlayer_SetVoicePoolIdentifier(CriAtomExPlayerHn player, CriAtomExVoicePoolIdentifier identifier)
Specify the Voice Pool identifier.
CriAtomExPlayerHn criAtomExPlayer_Create(const CriAtomExPlayerConfig *config, void *work, CriSint32 work_size)
Create an AtomEx player.
#define criAtomExVoicePool_SetDefaultConfigForAdxVoicePool(p_config)
Assign the default values to the configuration structure used to create an ADX Voice Pool.
Definition: cri_le_atom_ex.h:582
CriAtomExVoicePoolHn criAtomExVoicePool_AllocateAdxVoicePool(const CriAtomExAdxVoicePoolConfig *config, void *work, CriSint32 work_size)
Create an ADX Voice Pool.
CriSint32 num_voices
Definition: cri_le_atom_ex.h:3257
CriAtomExVoicePoolIdentifier identifier
Definition: cri_le_atom_ex.h:3256
 
In the above sample, ID "0x1234" is set to Voice Pool 1 and ID "0x5678" is set to Voice Pool 2.
The sample uses the criAtomExPlayer_SetVoicePoolIdentifier function to instruct the player 1 to acquire Voices from the Voice Pool with ID "0x1234", so all playbacks using player 1 is performed using Voices in Voice Pool 1.
(Even if player 1 performs many playbacks, Voice is not taken off from Voice Pool 2.)
Similarly, since player 2 is instructed to obtain voices only from the voice pool with identifier "0x5678", all playback processing for player 2 will be performed using voices from voice pool 2.