CRI ADX  Last Updated: 2024-07-17 10:47 p
Basics of Controlling Playback

Player Handle

The application sets the sound file name or the Cue to the player handle and plays back the sound in the following steps.
(1) Create a player handle (CriAtomExPlayerHn)
(2) Set a Cue or the sound file name
(3) Start a playback

/* Create a player */
player = criAtomExPlayer_Create(NULL, NULL, 0);
/* Set the Cue ID */
criAtomExPlayer_SetCueId(player, acb_hn, CRI_ATOMCUESHEET_BOMB2);
/* Start a playback */
CriAtomExPlaybackId criAtomExPlayer_Start(CriAtomExPlayerHn player)
Start the playback.
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)


When the application instructs to start a playback, the player handle acquires a Voice from the Voice Pool and starts the playback.
After finishing the playback, the Voice is automatically released and returned to the Voice Pool.
The status transition of the player handle during this process is shown below.
  1. Changes to the playback preparation status (PREP) at the time when executing the criAtomExPlayer_Start function.
  2. Changes to the playback status (PLAYING) when having read audio data necessary for playback.
  3. Changes to the playback end status (PLAYEND) when having finished playback of audio data.
Multiple sounds can be played back simultaneously with a single player handle.


[Remarks]
Besides the above situations, there may be cases where the player status changes to the error (ERROR).
For details about the status transition, see 'CriAtomExPlayer'.
Playback Using a Sequence
Playback time acquired from a player handle is the starting time of the sound being played back by the first playback instruction.
When playing back a Cue that is designed as a "Sequence" in the tool, the sounds placed on the time axis are played back in sequence at the designated time.
During a sequence playback, the sequencer acquires and plays Voices for which the playback timing has been reached, and automatically releases the Voices as their playback is completed.
Application can set the tempo of the playback to the sequencer so that the sound is played back slowly or quickly.
Sound played back by Cue can be easily paused or resumed.

/* Pausing the playback */
void criAtomExPlayer_Pause(CriAtomExPlayerHn player, CriBool sw)
Pause/resume.

Playing Back from Arbitrary Position
Playback from an arbitrary position ("Seek Playback" ) is also supported.
The starting position is specified in millisecond increments.