CRI ADX  Last Updated: 2026-05-28 14:38 p
3Dポジショニング 直方体形状音源

サンプルのディレクトリ

/cri/pc/samples/criatomex/control_3d_pos_cuboid_shape

サンプルで使用しているデータ

/cri/common/smpdata/criatomex/
  • SampleProject.acf
  • AtomCueSheet.acb
  • AtomCueSheet.awb

サンプルの解説

3Dポジショニングの音源に直方体形状を設定することが出来ます。
直方体形状音源の具体的な説明は 直方体形状音源 をご参照ください。
3Dポジショニングについてはサンプル:3Dポジショニング の解説をご参照ください。
直方体形状のパラメーター設定は以下の関数を使います。

パラメーター設定後、実際にパラメーターを反映するには以下の関数を使います。

直方体形状音源を用いた3Dポジショニング再生を行うコードを以下に示します。
CriAtomExVector pos, orient_front, orient_top;
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;
/* 音源の向きを設定 */
/* 前方ベクトル (orient_front) は直方体の奥行き (depth) 方向 */
/* 上方ベクトル (orient_top) は直方体の高さ (height) 方向 */
orient_front.x = 0.0f;
orient_front.y = 0.0f;
orient_front.z = 1.0f;
orient_top.x = 0.0f;
orient_top.y = 1.0f;
orient_top.z = 0.0f;
criAtomEx3dSource_SetOrientation(source, &orient_front, &orient_top);
/* 直方体形状パラメーターを設定 */
cuboid_extent.width = 3.0f;
cuboid_extent.height = 4.0f;
cuboid_extent.depth = 5.0f;
criAtomEx3dSource_SetCuboidExtent(source, &cuboid_extent);
/* 音源のパラメーターを適用 */
/* 再生開始 */
id = criAtomExPlayer_Start(player);
void criAtomEx3dSource_Update(CriAtomEx3dSourceHn ex_3d_source)
3D音源の更新
CriAtomEx3dListenerObj * CriAtomEx3dListenerHn
3Dリスナーハンドル
Definition: cri_le_atom_ex.h:4735
CriAtomEx3dListenerHn criAtomEx3dListener_Create(const CriAtomEx3dListenerConfig *config, void *work, CriSint32 work_size)
3Dリスナーハンドルの作成
CriAtomEx3dSourceObj * CriAtomEx3dSourceHn
3D音源ハンドル
Definition: cri_le_atom_ex.h:4709
void criAtomEx3dSource_SetCuboidExtent(CriAtomEx3dSourceHn ex_3d_source, CriAtomEx3dSourceCuboidExtent *cuboid_extent)
3D音源の直方体形状パラメーター設定
void criAtomEx3dSource_SetPosition(CriAtomEx3dSourceHn ex_3d_source, const CriAtomExVector *position)
3D音源の位置の設定
void criAtomEx3dSource_SetOrientation(CriAtomEx3dSourceHn ex_3d_source, const CriAtomExVector *front, const CriAtomExVector *top)
3D音源の向きの設定
CriAtomEx3dSourceHn criAtomEx3dSource_Create(const CriAtomEx3dSourceConfig *config, void *work, CriSint32 work_size)
3D音源ハンドルの作成
CriAtomExPlaybackId criAtomExPlayer_Start(CriAtomExPlayerHn player)
再生の開始
CriAtomExPlayerHn criAtomExPlayer_Create(const CriAtomExPlayerConfig *config, void *work, CriSint32 work_size)
AtomExPlayerの作成
void criAtomExPlayer_Set3dSourceHn(CriAtomExPlayerHn player, CriAtomEx3dSourceHn source)
3D音源ハンドルの設定
void criAtomExPlayer_Set3dListenerHn(CriAtomExPlayerHn player, CriAtomEx3dListenerHn listener)
3Dリスナーハンドルの設定
3D音源の直方体形状パラメーター構造体
Definition: cri_le_atom_ex.h:5003
CriFloat32 depth
Definition: cri_le_atom_ex.h:5006
CriFloat32 width
Definition: cri_le_atom_ex.h:5004
CriFloat32 height
Definition: cri_le_atom_ex.h:5005
3次元ベクトル構造体
Definition: cri_le_atom_ex.h:4617
CriFloat32 z
Definition: cri_le_atom_ex.h:4620
CriFloat32 y
Definition: cri_le_atom_ex.h:4619
CriFloat32 x
Definition: cri_le_atom_ex.h:4618
サンプルプログラム:シーン1 直方体音源
サンプルプログラム:シーン1は、直方体形状音源のサンプルです。
Source 1 は最大減衰距離が設定された大きい直方体形状音源です。音源内部で音量は最大となり、外縁から離れるにつれて音量は減衰します。
Source 2, Source 3 には減衰距離が設定されていない小さい直方体形状音源です。音源内部では音声が再生されますが、音源外部では再生されません。
直方体形状音源の減衰範囲は音源の向きに影響されることにご注意ください。
Source 2, Source 3 は同一の直方体形状パラメーターが設定されていますが、音源の位置と向きがそれぞれ異なります。
サンプルプログラム:シーン2 コーンパラメータ
サンプルプログラム:シーン2は、コーンパラメータが設定された直方体形状音源のサンプルです。
直方体パラメータが設定された音源においてコーンパラメータが設定されている場合、リスナーとの位置関係に応じてコーンによる減衰が適用されます。
音源外部では、リスナーから直方体面上への最近傍点を基準とし、リスナーに向かう角度に応じてコーンによる減衰が適用されます。
音源内部ではコーンによる減衰は適用されません。
Source 1 は左側を向いたコーンの設定された直方体音源です。
Source 2、Source 3 はそれぞれ下側、右側を向いた平面音源です。
奥行きの辺の長さが0になっており、内部コーン角度、外部コーン角度が180°未満であるため、正面方向にいるときのみ音声が聞こえます。
サンプルプログラム:シーン3 線音源
サンプルプログラム:シーン3は、線形状音源のサンプルです。
直方体形状パラメータの一部に 0.0f を指定することで、厚みのない面形状や太さのない線形状の音源とすることが出来ます。
Source 1 は線形状の音源です。
Source 2 は折れ線形状の音源です。端点同士がつながった複数の線形状音源の音源リストとして表現されています。
音源リストを用いたマルチポジショニング再生についてはサンプル:3Dポジショニング マルチポジショニング再生 の解説をご参照ください。
criAtomEx3dSourceList_SetVolumeAdjustmentTypeCRIATOMEX3DSOURCELIST_VOLUME_ADJUSTMENT_TYPE_LOUDEST_SOURCE_BASELINE を指定することで、折れ線部分で音量が大きくなることを防いでいます。