CRI ADX  Last Updated: 2025-05-07 13:34 p
Block playback

Sample directory

/cri/pc/samples/criatomex/playback_block

Data used in the sample

/cri/common/smpdata/criatomex/
  • SampleProject.acf
  • AtomCueSheet.acb
  • AtomCueSheet.awb

Sample description

This is a sample program that branches the jingle sound, which is a block cue, during playback.


Block queues are created with CRI Atom Craft.
See here for details → Block playback


On the program side,
the first block index is specified to the player with the criAtomExPlayer_SetFirstBlockIndex function,
and the second and subsequent block indexes are specified to the playback ID with the criAtomExPlayback_SetNextBlockIndex function.
The code to play and control a block queue with a branch in the middle is shown below.
/* Create the player */
player = criAtomExPlayer_Create(NULL, NULL, 0);
/* Set the block Cue */
player = criAtomExPlayer_SetCueName(acb, "block");
/* Select the first block */
/* Start playback */
CriAtomExPlaybackId playback_id;
playback_id = criAtomExPlayer_Start(player);
:
/* Specify the next block */
if (status_of_something) {
} else {
}
void criAtomExPlayback_SetNextBlockIndex(CriAtomExPlaybackId id, CriAtomExBlockIndex index)
Set the index of the next block.
void criAtomExPlayer_SetFirstBlockIndex(CriAtomExPlayerHn player, CriAtomExBlockIndex index)
Set the start block (by specifying a block index)
void criAtomExPlayer_SetCueName(CriAtomExPlayerHn player, CriAtomExAcbHn acb_hn, const CriChar8 *cue_name)
Set the sound data to play (specifying a Cue name)
CriAtomExPlaybackId criAtomExPlayer_Start(CriAtomExPlayerHn player)
Start the playback.
CriAtomExPlayerHn criAtomExPlayer_Create(const CriAtomExPlayerConfig *config, void *work, CriSint32 work_size)
Create an AtomEx player.
CriUint32 CriAtomExPlaybackId
Playback ID.
Definition: cri_le_atom_ex.h:3722
You can also receive a callback when blocks switch by using the criAtomExPlayer_SetBlockTransitionCallback function, as in the code below.
void main()
{
/* Register transition callback */
app_obj->player, &user_transition_callback_func, app_obj);
}
void user_transition_callback_func(
{
printf("PlaybackId:%d, BlockIndex:%d\n", id, index);
}
CriSint32 CriAtomExBlockIndex
Block Index.
Definition: cri_le_atom_ex.h:2304
void criAtomExPlayer_SetBlockTransitionCallback(CriAtomExPlayerHn player, CriAtomExPlayerBlockTransitionCbFunc func, void *obj)
Register the block transition callback function.