CRIWARE Unity Plugin Manual  Last Updated: 2024-07-12
[CriAtom] Block playback

Description of the sample

Overview

cri4u_samples_criatom_scene06_game_mini.png

This is a sample demonstrating block playback.
When you click on the cube on the screen, block playback is started.

Operations

  • Start [Karimba], Start [beamUp], and Start Music buttons
    Start music or sound effects.

  • Stop
    Stops playback.

  • Current block index
    Index of the block that is being played.

  • Next block index
    Index of the next block to be played.

  • Buttons 0 to 3
    Specify the next block to play.

Scene information


Middleware CRI ADX (CRI Atom)
Sample Basic sample
Location /CRIWARE/SDK/unity/samples/UnityProject/Assets/Scenes/criatom/basic/
Scene file Scene_06_BlockPlayback.unity


Description of the program

"Block playback" is a feature that divides a sequence into several phrases (blocks), and combines them sequentially during playback.
Configuring the transition rules between the blocks allows for the creation of complex playback behaviors.

Data that supports block playback

If block-related settings have already been configured on the tool side in CRI Atom Craft, you can play a block simply by specifying it.
Once a CriAtomExPlayback object returned, you can use it to specify the next block you want to play.

private CriAtomExPlayback playback;
...
/* Plays a block and get the CriAtomExPlayback object*/
this.playback = audio.Play("kalimbaScaleUp");
...
/* Specify a block */
this.playback.SetNextBlockIndex(index);

Obtaining a block index

You can obtain the index of the block being played back by the CriAtomExPlayback object.


int cur = this.playback.GetCurrentBlockIndex();


Obtaining a block information

You can obtain the number of blocks from the cue information.

this.acb = CriAtom.GetAcb("DemoProj");
...
this.acb.GetCueInfo("kalimbaScaleUp", out this.cueInfo);
...
int index = -1;
GUILayout.BeginHorizontal();
for (int i = 0; i < this.cueInfo.numBlocks; i++) {
string s;
if (cur == i) {
s = "< " + i.ToString() + " > ";
} else {
s = i.ToString();
}
if (Scene_00_GUI.Button(s)) {
index = i;
}
}