CRI ADX  Last Updated: 2025-05-07 13:34 p
Massive streaming voice playback

Sample directory

/cri/pc/samples/criatomex/playback_many_streaming_voices

Data used in the sample

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

Sample explanation

Prepare a large number of streaming voices and play a large amount of streaming data.
#define SMP_NUM_VOICE (100)
CriAtomExConfig atomex_config;
/* Initialize the library setting with default value */
criAtomEx_SetDefaultConfig(&atomex_config);
/* Set the number of virtual voices */
atomex_config.max_virtual_voices = SMP_NUM_VOICE;
/* Initialize the library */
criAtomEx_Initialize(&atomex_config, NULL, 0);
/* Read and register ACF file */
criAtomEx_RegisterAcfFile(NULL, PATH ACF_FILE, NULL, 0);
/* Load an ACB file and create an ACB handle */
acb_hn = criAtomExAcb_LoadAcbFile(NULL, PATH ACB_FILE, NULL, PATH AWB_FILE, NULL, 0);
/* Create an ADX Voice Pool */
adxvp_config.num_voices = SMP_NUM_VOICE;
adxvp_config.player_config.streaming_flag = CRI_TRUE;
voice_pool = criAtomExVoicePool_AllocateAdxVoicePool(&adxvp_config, NULL, 0);
/* Create a player */
player = criAtomExPlayer_Create(NULL, NULL, 0);
/* Set Cue ID */
criAtomExPlayer_SetCueId(player, acb_hn, CRI_ATOMCUESHEET_MUSIC_LOOP);
/* Start playback */
CriAtomExAcbObj * CriAtomExAcbHn
ACB handle.
Definition: cri_le_atom_ex.h:3033
CriAtomExAcbHn criAtomExAcb_LoadAcbFile(CriFsBinderHn acb_binder, const CriChar8 *acb_path, CriFsBinderHn awb_binder, const CriChar8 *awb_path, void *work, CriSint32 work_size)
Load an ACB file.
CriBool criAtomEx_Initialize(const CriAtomExConfig *config, void *work, CriSint32 work_size)
Initialize the library.
#define criAtomEx_SetDefaultConfig(p_config)
Assign the default values to the configuration structure used for the library's initialization.
Definition: cri_le_atom_ex.h:322
CriBool criAtomEx_RegisterAcfFile(CriFsBinderHn binder, const CriChar8 *path, void *work, CriSint32 work_size)
Register an ACF file.
CriAtomExPlaybackId criAtomExPlayer_Start(CriAtomExPlayerHn player)
Start the playback.
CriAtomExPlayerObj * CriAtomExPlayerHn
Player handle.
Definition: cri_le_atom_ex.h:3622
CriAtomExPlayerHn criAtomExPlayer_Create(const CriAtomExPlayerConfig *config, void *work, CriSint32 work_size)
Create an AtomEx player.
void criAtomExPlayer_SetCueId(CriAtomExPlayerHn player, CriAtomExAcbHn acb_hn, CriAtomExCueId id)
Set the sound data to play (specifying a Cue ID)
#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
struct CriAtomExVoicePoolTag * CriAtomExVoicePoolHn
Voice Pool handle.
Definition: cri_le_atom_ex.h:3220
CriAtomExVoicePoolHn criAtomExVoicePool_AllocateAdxVoicePool(const CriAtomExAdxVoicePoolConfig *config, void *work, CriSint32 work_size)
Create an ADX Voice Pool.
CriBool streaming_flag
Whether to perform streaming playback.
Definition: cri_le_atom.h:1641
Configuration structure used when creating an ADX Voice Pool.
Definition: cri_le_atom_ex.h:3277
CriSint32 num_voices
Definition: cri_le_atom_ex.h:3279
CriAtomAdxPlayerConfig player_config
Definition: cri_le_atom_ex.h:3280
Configuration structure used to initialize the Atom libraryThis structure is used to specify the beha...
Definition: cri_le_atom_ex.h:1461
CriSint32 max_virtual_voices
Maximum number of virtual voices.
Definition: cri_le_atom_ex.h:1585

The number of virtual voices must be increased according to the number of voices.
Specifically, the maximum number of available voices is set in the max_virtual_voices member of the CriAtomExConfig structure, which is passed to the library initialization function criAtomEx_Initialize .
Also, since streaming playback will be performed, set the streaming_flag member to CRI_TRUE when creating the voice pool.