CRI ADX  Last Updated: 2024-07-17 10:48 p
多个编解码器播放

示例目录

/cri/pc/samples/criatomex/playback_multi_codec


示例描述

如果ACB文件中包含多个Cue编解码器,通过预先为各编解码器创建Voice池, 可以在无需了解要播放的Cue实际使用哪个编解码器的情况下播放Cue。
CriAtomExVoicePoolHn adxvoice_pool;
CriAtomExVoicePoolHn hcavoice_pool;
/* 创建ADX Voice池 */
adxvoice_pool = criAtomExVoicePool_AllocateAdxVoicePool(NULL, NULL, 0);
/* 创建HCA Voice池 */
hcavoice_pool = criAtomExVoicePool_AllocateHcaVoicePool(NULL, NULL, 0);
/* 创建Player */
player = criAtomExPlayer_Create(NULL, NULL, 0);
/* 指定Cue ID */
criAtomExPlayer_SetCueId(player, acb_hn, CRI_ATOMCUESHEET_THUNDER1);
/* 开始播放 */
CriAtomExAcbObj * CriAtomExAcbHn
ACB handle
Definition: cri_le_atom_ex.h:3033
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)
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
CriAtomExVoicePoolHn criAtomExVoicePool_AllocateHcaVoicePool(const CriAtomExHcaVoicePoolConfig *config, void *work, CriSint32 work_size)
Create an HCA Voice Pool


请注意:此方法要准备多个Voice池,因此需要很多工作区。
需要调整工作区大小时,如果根据所使用的编解码器的Cue数量来设置各编解码器的Voice池的Voice数量, 则可以减小工作区大小。


示例使用的数据中Atom Craft项目的目录

/cri/tools/criatomex/examples/tutorial_data_for_runtime