CRI ADX  Last Updated: 2024-07-17 10:48 p
播放多个ACB

示例目录

/cri/pc/samples/criatomex/playback_multi_acb


示例描述

此SDK中包含的大多数示例,基本上只使用一个ACB文件;但当然也可以同时使用多个ACB文件。
以下代码是加载两个ACB文件并播放每个ACB文件的Cue的示例。
CriAtomExAcbHn acb_hn[2];
/* 读取ACB文件,创建ACB句柄 */
acb_hn[0] = criAtomExAcb_LoadAcbFile(NULL, PATH ACB_FILE, NULL, PATH AWB_FILE, NULL, 0);
acb_hn[1] = criAtomExAcb_LoadAcbFile(NULL, PATH ACB2_FILE, NULL, NULL, NULL, 0);
player[0] = criAtomExPlayer_Create(NULL, NULL, 0);
player[1] = criAtomExPlayer_Create(NULL, NULL, 0);
/* 指定Cue ID */
criAtomExPlayer_SetCueId(player[0], acb_hn[0], CRI_ATOMCUESHEET_BOMB2);
criAtomExPlayer_SetCueId(player[1], acb_hn[1], CRI_ATOMCUESHEET2_SIN32K1SHOT);
/* 开始播放 */
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
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)


因为是为每个ACB文件输出ACB头文件,因此在用Cue ID播放时需要注意与ACB文件的对应关系。


示例使用的数据中AtomCraft项目的目录

/cri/tools/criatomex/examples/tutorial_data_for_runtime