CRI ADX  Last Updated: 2024-07-17 10:47 p
3D positioning

Samples Directory

/CRIWARE/SDK/pc/samples/criatomex/control_3d_pos


Sample Description

In order to perform 3D positioning , first set a 3D listener handle ( CriAtomEx3dListenerHn ) and 3D sound source handle ( CriAtomEx3dSourceHn ) to the AtomEx player ( CriAtomExPlayerHn ) using the criAtomExPlayer_Set3dListenerHn and criAtomExPlayer_Set3dSourceHn function.

In order to move listener or sound source, use the following functions respectively.

In addition, several parameters can be set to listener or sound source.
Please refer to the sample source which configures several parameters.

After setting parameters, by calling the criAtomEx3dListener_Update or criAtomEx3dSource_Update function, parameters are updated and position of the sound being played moves.

The following is a simple code to do 3D positioning.

listener = criAtomEx3dListener_Create(NULL, NULL, 0);
source = criAtomEx3dSource_Create(NULL, NULL, 0);
player = criAtomExPlayer_Create(NULL, NULL, 0);
pos.x = 0.0f;
pos.y = 0.0f;
pos.z = 0.0f;
// Start playback
id = criAtomExPlayer_Start(player);
:
pos.x += 10.0f;
void criAtomEx3dSource_Update(CriAtomEx3dSourceHn ex_3d_source)
Update a 3D sound source.
CriAtomEx3dListenerObj * CriAtomEx3dListenerHn
3D listener handle
Definition: cri_le_atom_ex.h:4622
CriAtomEx3dListenerHn criAtomEx3dListener_Create(const CriAtomEx3dListenerConfig *config, void *work, CriSint32 work_size)
Create a 3D listener handle.
CriAtomEx3dSourceObj * CriAtomEx3dSourceHn
3D sound source handle
Definition: cri_le_atom_ex.h:4596
void criAtomEx3dSource_SetPosition(CriAtomEx3dSourceHn ex_3d_source, const CriAtomExVector *position)
Set the position of a 3D sound source.
CriAtomEx3dSourceHn criAtomEx3dSource_Create(const CriAtomEx3dSourceConfig *config, void *work, CriSint32 work_size)
Create a 3D sound source.
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_Set3dSourceHn(CriAtomExPlayerHn player, CriAtomEx3dSourceHn source)
Set the 3D sound source handle.
void criAtomExPlayer_Set3dListenerHn(CriAtomExPlayerHn player, CriAtomEx3dListenerHn listener)
Set the 3D listener handle.
3D vector structure
Definition: cri_le_atom_ex.h:4504
CriFloat32 z
Definition: cri_le_atom_ex.h:4507
CriFloat32 y
Definition: cri_le_atom_ex.h:4506
CriFloat32 x
Definition: cri_le_atom_ex.h:4505