CRIWARE Unity Plugin Manual  Last Updated: 2024-07-12
CriAtomEx3dListener Class Reference

3D listener More...

Inherits CriDisposable.

Public Member Functions

 CriAtomEx3dListener ()
 Creates a 3D listener More...
 
override void Dispose ()
 Discards the 3D listener object More...
 
void Update ()
 Updates the 3D listener More...
 
void ResetParameters ()
 Initializes 3D sound source parameters More...
 
void SetPosition (float x, float y, float z)
 Sets the position of the 3D listener More...
 
void SetVelocity (float x, float y, float z)
 Sets the velocity of the 3D listener More...
 
void SetOrientation (float fx, float fy, float fz, float ux, float uy, float uz)
 Sets the orientation of the 3D listener More...
 
void SetDistanceFactor (float distanceFactor)
 Sets the distance factor of the 3D listener More...
 
void SetDopplerMultiplier (float dopplerMultiplier)
 Sets the Doppler scale factor of the 3D listener More...
 
void SetFocusPoint (float x, float y, float z)
 Sets the focus point of the 3D listener More...
 
void SetDistanceFocusLevel (float distanceFocusLevel)
 Sets the distance sensor focus level More...
 
void SetDirectionFocusLevel (float directionFocusLevel)
 Sets the focus level the direction sensor More...
 
void Set3dRegion (CriAtomEx3dRegion region3d)
 Sets the 3D region More...
 
bool IsDestroyable ()
 Check if the 3D listener can be discarded More...
 

Detailed Description

3D listener

Description:
An object for handling the 3D listener.
Used for 3D Positioning.

You set the parameters and position information of the 3D listener through the 3D listener object.

Constructor & Destructor Documentation

CriAtomEx3dListener ( )
inline

Creates a 3D listener

Description:
Creates a 3D listener object.
Note:
The library must be initialized before calling this function.

Member Function Documentation

override void Dispose ( )
inline

Discards the 3D listener object

Description:
Discards a 3D listener object.
When this function is called, all the resources allocated in the DLL when creating the 3D listener are released.
If there are any sounds being played by an AtomExPlayer with the 3D listener object set, either stop those sounds or discard the AtomExPlayer before calling this function.
void Update ( )
inline

Updates the 3D listener

Description:
Updates the 3D listener using the parameters set in the 3D listener.
This function updates all the parameters set in the 3D listener. It is more efficient to change multiple parameters before performing update than to update using this function each time a parameter is changed.
Note:
This function runs independently of the parameter update in the AtomExPlayer ( CriWare.CriAtomExPlayer::UpdateAll , CriWare.CriAtomExPlayer::Update ).
When you change the parameter of the 3D listener, perform the update process using this function.
Example:

: // リスナーの作成 CriAtomExListener listener = new CriAtomEx3dListener(); : // リスナー位置の設定 listener.SetPosition(0.0f, 0.0f, 1.0f);

// リスナー速度の設定 listener.SetVelocity(1.0f, 0.0f, 0.0f);

// 注意)この時点ではリスナーの位置や速度はまだ変更されていません。

// 変更の適用 listener.Update(); :

void ResetParameters ( )
inline

Initializes 3D sound source parameters

Description:
Clears the parameters set in the 3D listener and restores the initial values.
Note:
To actually apply the cleared parameters, you need to call the CriWare.CriAtomEx3dListener::Update function.
void SetPosition ( float  x,
float  y,
float  z 
)
inline

Sets the position of the 3D listener

Parameters
xX coordinate
yY coordinate
zZ coordinate
Description:
Sets the position of the 3D listener.
The position is used for calculating the distance attenuation and localization.
The position is specified as a 3D vector.
The unit of the position is determined by the distance factor of the 3D listener(set using the CriWare.CriAtomEx3dListener::SetDistanceFactor function).
The default is (0.0f, 0.0f, 0.0f).
Since the position cannot be set on the data, the value set using this function is always used.
Note:
To actually apply the set parameters, you need to call the CriWare.CriAtomEx3dListener::Update function.
See also
CriAtomEx3dListener::Update
void SetVelocity ( float  x,
float  y,
float  z 
)
inline

Sets the velocity of the 3D listener

Parameters
xVelocity along X axis
yVelocity along Y axis
zVelocity along Z axis
Description:
Sets the velocity of the 3D listener.
The velocity is used to calculate the Doppler effect.
The velocity is specified as a 3D vector.
The unit of velocity is the distance traveled per second.
The unit of the distance is determined by the distance factor of the 3D listener (set using the CriWare.CriAtomEx3dListener::SetDistanceFactor function).
The default is (0.0f, 0.0f, 0.0f).
Since the velocity cannot be set on the data, the value set using this function is always used.
Note:
To actually apply the set parameters, you need to call the CriWare.CriAtomEx3dListener::Update function.
See also
CriAtomEx3dListener::Update
void SetOrientation ( float  fx,
float  fy,
float  fz,
float  ux,
float  uy,
float  uz 
)
inline

Sets the orientation of the 3D listener

Parameters
fxValue of the forward vector in the X direction
fyValue of the forward vector in the Y direction
fzValue of the forward vector in the Z direction
uxValue of the upper vector in the X direction
uyValue of the upper vector in the Y direction
uzValue of the upper vector in the Z direction
Description:
Sets the orientation of the 3D listener using the forward and upward vectors.
The orientation is specified using a 3D vector.
The orientation vector that is set is normalized inside the library before being used.
The default values are as follows:
  • Forward vector: (0.0f, 0.0f, 1.0f)
  • Upward vector: (0.0f, 1.0f, 0.0f)
As you cannot set the orientation of the listener on the data, the setting in this function is always used.
Note:
To actually apply the set parameters, you need to call the CriWare.CriAtomEx3dListener::Update function.
See also
CriAtomEx3dListener::Update
void SetDistanceFactor ( float  distanceFactor)
inline

Sets the distance factor of the 3D listener

Deprecated:
削除予定の非推奨APIです。 CriWareErrorHandler.OnCallback event の使用を検討してください。
Parameters
distanceFactorDistance factor
Description:
Sets the distance factor of the 3D listener.
This factor is used to calculate the Doppler effect.
For example, if you set distance_factor to 0.1f, the speed 1.0f is treated as 10 meters.
Possible value for distanceFactor is 0 or a value greater than 0.0f. The default is 1.0f.
As you cannot set the distance factor of the listener on the data, the setting in this function is always used.
Note:
To actually apply the set parameters, you need to call the CriWare.CriAtomEx3dListener::Update function.
See also
CriAtomEx3dListener::Update
void SetDopplerMultiplier ( float  dopplerMultiplier)
inline

Sets the Doppler scale factor of the 3D listener

Parameters
dopplerMultiplierDoppler scale factor
Description:
Sets the Doppler scale factor of the 3D listener. This scale factor is used to calculate the Doppler effect.
For example, if you set dopplerMultiplier to 10.0f, the Doppler effect will be 10 times more intense than usual.
Possible value for dopplerMultiplier is 0 or a value greater than 0.0f. The default is 1.0f.
As you cannot set the Doppler scale value to the listener on the data, the setting in this function is always used.
Note:
To actually apply the set parameters, you need to call the CriWare.CriAtomEx3dListener::Update function.
See also
CriAtomEx3dListener::Update
void SetFocusPoint ( float  x,
float  y,
float  z 
)
inline

Sets the focus point of the 3D listener

Description:
Set the focus point of the 3D listener.
When performing the 3D Positioning, by setting the focus point, the listener's position and the focus point are connected by a straight line, and the microphone can be moved on that line.
For example, by keeping the listener synchronized with the camera and setting the focus point on the position of the main character, you can flexibly express/adjust objective and subjective representation depending on the situation.
Unlike the real-world microphone, the microphone that can be moved between the listener's position and the focus point has separate distance sensor (for distance attenuation calculation) and orientation sensor (for localization calculation).
By operating these independently, a representation is possible such as "I want to focus on the main character, so the distance attenuation should be based on the character position." or "I want to match the localization with the screen, so the localization calculation should be based on the camera position"
The default is (0.0f, 0.0f, 0.0f). In situations where the focus level of the distance sensor or orientation sensor is not set, it is not necessary to set the focus point. In that case, all the 3D Positioning calculations are done based on the listener position as usual.
Note:
To actually apply the set parameters, you need to call the CriWare.CriAtomEx3dListener::Update function.
See also
CriAtomEx3dListener::Update, CriAtomEx3dListener::SetDistanceFocusLevel, CriAtomEx3dListener::SetDirectionFocusLevel
void SetDistanceFocusLevel ( float  distanceFocusLevel)
inline

Sets the distance sensor focus level

Parameters
distanceFocusLevelDistance sensor focus level
Description:
Sets the focus level of the distance sensor.
The distance sensor represents the position that is the basis of the distance attenuation calculation among the 3D Positioning calculations. It is treated as a microphone that ignores localization and senses only the degree of distance attenuation.
The focus level indicates how close the sensor (microphone) can be to the focus point. The sensor (microphone) can be moved on a straight line connecting the listener position and the focus point, with 0.0f being the listener position and 1.0f being the same position as the focus point.
For example, by setting the focus level of the distance sensor to 1.0f and the focus level of the direction sensor to 0.0f, distance attenuation is applied based on the focus point, and localization is determined based on the listener position.
The default is 0.0f. In the situation where the focus level of the distance sensor or direction sensor is not set, all 3D Positioning calculations are done based on the listener position as before.
Note:
To actually apply the set parameters, you need to call the CriWare.CriAtomEx3dListener::Update function.
See also
CriAtomEx3dListener::Update, CriAtomEx3dListener::SetFocusPoint, CriAtomEx3dListener::SetDirectionFocusLevel
void SetDirectionFocusLevel ( float  directionFocusLevel)
inline

Sets the focus level the direction sensor

Parameters
directionFocusLevelThe focus level the direction sensor
Description:
Sets the focus level of the direction sensor.
The direction sensor represents the position that serves as the reference for localization calculation in the 3D Positioning calculation. It is treated as a microphone that ignores distance attenuation and senses only localization.
For the orientation of the direction sensor, the orientation of the listener (set by the SetOrientation function) is used as is.
The focus level indicates how close the sensor (microphone) can be to the focus point. The sensor (microphone) can be moved on a straight line connecting the listener position and the focus point, with 0.0f being the listener position and 1.0f being the same position as the focus point.
For example, by setting the focus level of the distance sensor to 1.0f and the focus level of the direction sensor to 0.0f, distance attenuation is applied based on the focus point, and localization is determined based on the listener position.
The default is 0.0f. In the situation where the focus level of the distance sensor or direction sensor is not set, all 3D Positioning calculations are done based on the listener position as before.
Note:
To actually apply the set parameters, you need to call the CriWare.CriAtomEx3dListener::Update function.
See also
CriAtomEx3dListener::Update, CriAtomEx3dListener::SetFocusPoint, CriAtomEx3dListener::SetDistanceFocusLevel
void Set3dRegion ( CriAtomEx3dRegion  region3d)
inline

Sets the 3D region

Description:
Sets the 3D region to the 3D listener.
Note:
If the regions set to the 3D sound source and 3D listener set to the same ExPlayer are different,
and if there is no 3D Transceiver that has the same region as the 3D sound source, the sound is muted.
To actually apply the set parameters, you need to call the CriWare.CriAtomEx3dListener::Update function.
See also
CriAtomEx3dRegion::Create, CriAtomEx3dListener::Update
bool IsDestroyable ( )
inline

Check if the 3D listener can be discarded

Returns
Status of 3D listener (true = can be discarded, false = cannot be discarded)
Description:
Checks if a 3D Listener can be destroyed.
Calling the Dispose function will not destroy a listener if it is attached to an AtomExPlayer still playing audio.
In this case, you will need to either destroy all AtomExPlayers that have this 3D Listener attached, or attach a different 3D Listener to them in order to destroy the listener.
See also
Dispose, CriAtomExPlayer.Set3dListener

The documentation for this class was generated from the following file: