CRI ADX  Last Updated: 2024-07-17 10:47 p
Playback by Cue ID

Samples Directory

/CRIWARE/SDK/pc/samples/criatomex/playback_cue


Sample Description

Procedure to play back Cue created by an authoring tool is as follows:

  1. Register an ACF file generated by the authoring tool using the criAtomEx_RegisterAcfFile function.
  2. Register an ACB and AWB files generated by the authoring tool using the criAtomExAcb_LoadAcbFile function.
  3. Create a Voice Pool, D-BAS, and player for Cue playback.
  4. Set the ID of the Cue to be played back using the criAtomExPlayer_SetCueId function.
  5. Start playback of the Cue using the criAtomExPlayer_Start function.
Following is a code to play sound by specifying a Cue ID.

/* Create a Voice Pool which allows streaming playback */
vp_config.player_config.streaming_flag = CRI_TRUE;
stmvoice_pool = criAtomExVoicePool_AllocateStandardVoicePool(&vp_config, NULL, 0);
/* Create D-BAS */
dbas_id = criAtomExDbas_Create(NULL, NULL, 0);
/* Load an ACB file */
acb_hn = criAtomExAcb_LoadAcbFile(NULL, PATH ACB_FILE, NULL, PATH AWB_FILE, NULL, 0);
/* Create a player */
player = criAtomExPlayer_Create(NULL, NULL, 0);
/* Set the ID of the Cue to be played back */
criAtomExPlayer_SetCueId(player, acb_hn, 15);
/* Start playback */
CriAtomDbasId CriAtomExDbasId
AtomEx D-BAS ID.
Definition: cri_le_atom_ex.h:4450
#define criAtomExDbas_Create(config, work, work_size)
Create a D-BAS.
Definition: cri_le_atom_ex.h:811
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)
#define criAtomExVoicePool_SetDefaultConfigForStandardVoicePool(p_config)
Assign the default values to the configuration structure used to create a standard Voice Pool.
Definition: cri_le_atom_ex.h:564
CriAtomExVoicePoolHn criAtomExVoicePool_AllocateStandardVoicePool(const CriAtomExStandardVoicePoolConfig *config, void *work, CriSint32 work_size)
Create a standard Voice Pool.
struct CriAtomExVoicePoolTag * CriAtomExVoicePoolHn
Voice Pool handle.
Definition: cri_le_atom_ex.h:3220
Configuration structure used when creating a standard Voice Pool.
Definition: cri_le_atom_ex.h:3255
CriAtomStandardPlayerConfig player_config
Definition: cri_le_atom_ex.h:3258
CriBool streaming_flag
Whether to perform streaming playback.
Definition: cri_le_atom.h:1484


Specifying Cue
In the above sample, Cue ID is used to specify a Cue.
Using criAtomExPlayer_SetCueName or criAtomExPlayer_SetCueIndex function, it is also possible to specify the Cue using Cue name or Cue index (offset number of the Cue in the file).
In addition, by including a header file generated by the authoring tool, you can specify Cue ID by macro definition name instead of Cue ID.

About the Number of Channels in the Sound to Be Played Back
In the above sample, standard Voice Pool which allows streaming playback is created for sound playback.
Although generic sound data (monophonic/stereo ADX/HCA data) can be played back using the above code, some of the code must be modified when you want to play back multichannel sound.
Specifically, in order to support playing back multichannel sound, you must increase the value for player_config.max_channels when creating Voice Pool.

When You Use Only On-memory Playback
When you use only on-memory playback (using only ACB files) and not use streaming playback, you can save memory consumption by applying the following modification.
  • When loading ACB file, do not specify the path of the AWB file.
  • Do not create D-BAS.
  • When creating the Voice Pool, set player_config.streaming_flag to CRI_FALSE.