CRI ADX  Last Updated: 2024-07-17 10:47 p
AWB Playback

Samples Directory

/CRIWARE/SDK/pc/samples/criatomex/playback_awb


Sample Description

In CRI Atom, the user can directly play back the sound data from AWB files.
Following is a code to play back sound data from AWB file in streaming.

CriAtomExAdxVoicePoolConfig voice_pool_config;
CriAtomAwbHn awb_hn;
/* Create an AWB handle */
awb_hn = criAtomAwb_LoadToc(NULL, PATH AWB_FILE, NULL, 0);
/* Initialize parameters for creating Voice Pool with default value */
/* Enable streaming playback because we want to play back from AWB file in streaming */
voice_pool_config.player_config.streaming_flag = CRI_TRUE;
/* Create a Voice Pool which allows streaming playback */
voice_pool = criAtomExVoicePool_AllocateAdxVoicePool(&voice_pool_config, NULL, 0);
/* Create a player */
player = criAtomExPlayer_Create(NULL, NULL, 0);
/* Set WaveID */
criAtomExPlayer_SetWaveId(player, awb_hn, 0);
/* Start playback */
CriAtomExPlaybackId criAtomExPlayer_Start(CriAtomExPlayerHn player)
Start the playback.
CriAtomExPlayerObj * CriAtomExPlayerHn
Player handle.
Definition: cri_le_atom_ex.h:3622
void criAtomExPlayer_SetWaveId(CriAtomExPlayerHn player, CriAtomAwbHn awb, CriAtomExWaveId id)
Set the wave data to play (specifying a wave data ID)
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.
struct CriAtomAwbTag * CriAtomAwbHn
AWB handle.
Definition: cri_le_atom.h:1349
CriAtomAwbHn criAtomAwb_LoadToc(CriFsBinderHn binder, const CriChar8 *path, void *work, CriSint32 work_size)
Load AWB file's TOC information (synchronous version)
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
CriAtomAdxPlayerConfig player_config
Definition: cri_le_atom_ex.h:3280


The third argument of the criAtomExPlayer_SetWaveId function is an index of the sound data in the AWB file.

Above is a sample code for streaming playback; you can load AWB file onto memory and use the criAtomAwb_LoadFromMemory function to create an AWB handle from the AWB file image to achieve on-memory playback.