CRI ADX  Last Updated: 2024-07-17 10:47 p
Playing Back Large Amount of Streaming Voices

Samples Directory

/CRIWARE/SDK/pc/samples/criatomex/playback_many_streaming_voices


Sample Description

The user can prepare large amount of streaming Voices and play back large streaming data.

#define SMP_NUM_VOICE (100)
CriFsConfig fs_config;
CriAtomExConfig atomex_config;
/* Initialize CRI File System setting parameter with default value */
criFs_SetDefaultConfig(&fs_config);
/* Increase the number of loaders to (default + the number of Voices to be played back) */
fs_config.num_loaders = fs_config.num_loaders + SMP_NUM_VOICE;
/* Increase the number of file handles to (default + the number of Voices to be played back) */
fs_config.max_files = fs_config.max_files + SMP_NUM_VOICE;
/* 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;
/* Pass initialization parameter for CRI File System */
atomex_config.fs_config = &fs_config;
/* 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
const CriFsConfig * fs_config
Pointer to the CRI File System initialization parameters.
Definition: cri_le_atom_ex.h:1812
Configuration.
Definition: cri_le_file_system.h:193
CriSint32 num_loaders
Number of CriFsLoader loaders to use.
Definition: cri_le_file_system.h:238
CriSint32 max_files
Definition: cri_le_file_system.h:375


CRI Atom accesses files through CRI File System library and consumes one loader handle for each streaming processing.
Therefore, in order to playback large amount of streaming data in CRI Atom, the number of loader handles and file handles must be increased in CRI File System.

In order to modify CRI File System parameter settings in application, modify the value of ::CriFsConfigstructure, then register it to fs_config member of CriAtomExConfig structure and initialize CRI Atom.

In addition, set streaming_flag member to CRI_TRUE since this is a streaming playback.