CRI ADX  Last Updated: 2025-05-07 13:34 p
Tween
The Atom library has a function called Tween as a way to change the parameters of the AtomEx player (volume, pitch, etc.) over a certain period of time.

About Tween

Tween is a module that allows you to change a specific parameter to a desired value at a specified time.
Using Tween, you can easily implement operations such as dropping the volume to 0 after 0.5 seconds.
Tween is attached to the AtomEx player.
Specific operation steps are as follows.
  1. Create a Tween handle corresponding to the parameter you want to operate using the criAtomExTween_Create function.
  2. Attach the created Tween handle to the AtomEx player using the criAtomExPlayer_AttachTween function.
    (Use the criAtomExPlayer_Start function, etc., to play as needed.)
  3. Execute the criAtomExTween_MoveTo function to change the parameters.
For example, the following code can be used to reduce the volume over 0.5 seconds.
:
/* Create a Tween that fades the volume */
CriAtomExTweenHn tween = criAtomExTween_Create(&config, NULL, 0);
/* Attach the Tween to the player */
/* Start playback */
:
/* Instruct the volume to drop over 0.5 seconds (= 500 milliseconds) */
criAtomExTween_MoveTo(tween, 500, 0.0f);
:
void criAtomExPlayer_AttachTween(CriAtomExPlayerHn player, CriAtomExTweenHn tween)
Attach a Tween to a player.
CriAtomExPlaybackId criAtomExPlayer_Start(CriAtomExPlayerHn player)
Start the playback.
@ CRIATOMEX_PARAMETER_ID_VOLUME
Definition: cri_le_atom_ex.h:4007
struct CriAtomExTweenTag * CriAtomExTweenHn
Tween handle.
Definition: cri_le_atom_ex.h:5091
#define criAtomExTween_SetDefaultConfig(p_config)
Assign the default values to the configuration structure used to create a Tween.
Definition: cri_le_atom_ex.h:1162
CriAtomExTweenHn criAtomExTween_Create(const CriAtomExTweenConfig *config, void *work, CriSint32 work_size)
Create Tween.
void criAtomExTween_MoveTo(CriAtomExTweenHn tween, CriUint16 time_ms, CriFloat32 value)
Smoothly change the current value of the parameter to the specified value.
@ CRIATOMEX_PARAMETER_TYPE_BASIC
Basic parameters.
Definition: cri_le_atom_ex.h:5024
Configuration structure used to create a Tween.
Definition: cri_le_atom_ex.h:5047
CriAtomExTweenParameterType parameter_type
Parameter type.
Definition: cri_le_atom_ex.h:5074
CriAtomExParameterId parameter_id
Parameter ID.
Definition: cri_le_atom_ex.h:5059
Note:
Tween is a runtime function.
Tween settings cannot be made on the tool.

About parameters that can be operated

The parameters to be operated by Tween are specified when creating the Tween handle.
Parameters can be specified in two main ways.
  • CRIATOMEX_PARAMETER_TYPE_BASIC
  • CRIATOMEX_PARAMETER_TYPE_AISAC
To control general parameters such as volume, pan, and pitch, set CRIATOMEX_PARAMETER_TYPE_BASIC to parameter_type in the CriAtomExTweenConfig structure, and specify the ID of the parameter you want to control in id.parameter_id.
If you want to control the AISAC control value using Tween, set CRIATOMEX_PARAMETER_TYPE_AISAC to parameter_type in the CriAtomExTweenConfig structure, and specify the AISAC control ID you want to control in id.aisac_control_id .
Note:
For a list of parameters that can be operated when CRIATOMEX_PARAMETER_TYPE_BASIC is specified, see CriAtomExParameterId in the reference.
Next:Preview