CRIWARE Unity Plugin Manual  Last Updated: 2024-07-12
[CriAtom] Audio playback using Timeline expansion

Sample description

Overview

cri4u_samples_criatom_adv06_screenshot.png

This is a sample to play audio using the Timeline expansion plug-in.

How to use

  • When the Play button is pressed, the audio sequence starts playing.
    A progress bar indicates the playback position.
  • When the Pause button is pressed, the audio playback is paused.
  • When the Stop button is pressed, audio playback stops and the playback position becomes 0 seconds.
Operations in the editor
cri4u_samples_criatom_adv06_timeline.png
When the sample game object "AtomTimeline" is selected, the timeline asset to be played is displayed in the Timeline window.
If you move the playback position of the Timeline in Edit mode, you can preview (scrub playback) the sound at the moment the cursor points.

cri4u_samples_criatom_adv06_timeline_curve.png
You can also display the change curve of the parameters controlled by Timeline by pressing the curve view icon on the Timeline track.

Scene information


Middleware CRI ADX (CRI Atom)
Sample Advanced sample
Location /CRIWARE/SDK/unity/samples/UnityProject/Assets/Scenes/criatom/advanced/
Scene file Scene_06_TimelineExtension.unity
Timeline file Scene_06_TimelineExtension.playable


Description of the program

About Timeline Assets

The Timeline asset (.playable file) played in this sample is set in the PlayableDirector component of the game object "AtomTimeline".
In the Timeline window, you can add and edit CRI Atom tracks and clips.

About playback control

Playback control of Timeline is realized by Assets/Scripts/TimelineControl.cs (sample common script).
/* Code excerpt */
director = GetComponent<PlayableDirector>();
if (Scene_00_GUI.Button(playButtonRect, "Play")) {
director.Play();
}
if (Scene_00_GUI.Button(pauseButtonRect, "Pause")) {
director.Pause();
}
if (Scene_00_GUI.Button(stopButtonRect, "Stop")) {
director.Stop();
}
When paused, playback is resumed by executing Play().