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

Sample Directory

/CRIWARE/SDK/pc/samples/criatomex/playback_block


Sample Description

This sample program demonstrates how to branch to a jingle sound (that is a block Cue) during playback.


The block Cue is created in CRI Atom Craft.
For details, refer to the following: Block playback


In the program,
specify the first block index to the player with the criAtomExPlayer_SetFirstBlockIndex function,
and then specify the next block indexes for the playback ID with the criAtomExPlayback_SetNextBlockIndex.


The following code demonstrates how to play and control a block Cue that branches during playback.


/* 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 use the criAtomExPlayer_SetBlockTransitionCallback function, as shown in the code below, to receive a callback when the block transitions.
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.