This page has been translated automatically.
视频教程
界面
要领
高级
实用建议
基础
专业(SIM)
UnigineEditor
界面概述
资源工作流程
版本控制
设置和首选项
项目开发
调整节点参数
Setting Up Materials
设置属性
照明
Sandworm
使用编辑器工具执行特定任务
如何擴展編輯器功能
嵌入式节点类型
Nodes
Objects
Effects
Decals
光源
Geodetics
World Nodes
Sound Objects
Pathfinding Objects
Players
编程
基本原理
搭建开发环境
使用范例
C++
C#
UnigineScript
统一的Unigine着色器语言 UUSL (Unified UNIGINE Shader Language)
Plugins
File Formats
材质和着色器
Rebuilding the Engine Tools
GUI
双精度坐标
应用程序接口
Animations-Related Classes
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Objects-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
IG Plugin
CIGIConnector Plugin
Rendering-Related Classes
VR-Related Classes
创建内容
内容优化
材质
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Tutorials
注意! 这个版本的文档是过时的,因为它描述了一个较老的SDK版本!请切换到最新SDK版本的文档。
注意! 这个版本的文档描述了一个不再受支持的旧SDK版本!请升级到最新的SDK版本。

Unigine::SoundReverb Class

Header: #include <UnigineSounds.h>
Inherits from: Node

This class is used to create reverberation zones for sound sources with reverberation flag. Such sound will have initial reflections, reverberation and echo. It can have modified pitch.

If the sound passes through two reverberation zones (for example, one reverberation zone around the player and another one around the sound source), the heard sound reverberation effect will be twice as strong.

Creating a Reverberation Zone#

To create a reverberation zone, first, create a sound source that will reverberate, then create an instance of the SoundReverb class and specify all required settings:

Source code (C++)
// create a sound source
SoundSourcePtr sound = SoundSource::create("static_mono_00.oga");
sound->setWorldTransform(translate(Vec3(10.0f)));
// disable sound muffling when being occluded
sound->setOcclusion(0);
// set the distance at which the sound gets clear
sound->setMinDistance(1.0f);
// set the distance at which the sound becomes out of audible range
sound->setMaxDistance(10.0f);
// set the gain that result in attenuation of 6 dB
sound->setGain(0.5f);
// loop the sound
sound->setLoop(1);
// start playing the sound sample 
sound->play();

// create a reverberation zone
SoundReverbPtr reverb = SoundReverb::create(vec3(10.0f));
// set transformation
reverb->setWorldTransform(translate(Vec3(10.0f)));
// set the threshold size that determines the distance of changing from partial to full reverberation audibility
reverb->setThreshold(vec3(1.0f, 1.0f, 1.0f));
// set the other settings for the reverberation zone
reverb->setDensity(0.2f);
reverb->setDiffusion(0.5f);
reverb->setDecayTime(1.0f);
reverb->setReflectionGain(2.0f);
reverb->setLateReverbGain(8.0f);

To update the settings of the created reverberation zone, you can simply call the corresponding methods when necessary.

See Also#

  • A set of UnigineScript API samples located in the <UnigineSDK>/data/samples/sounds/ folder:

    • sound_reverb_00
    • sound_reverb_01
  • Sounds sample in C# Component Samples suite

SoundReverb Class

Members


static SoundReverbPtr create ( const Math::vec3 & size ) #

Constructor. Creates a new reverberation zone of specified size.

Arguments

  • const Math::vec3 & size - Size of the reverberation zone in units.

void setAirAbsorption ( float absorption ) #

Updates the air absorption value determining the distance-dependent attenuation at high frequencies caused by the propagation medium. The value of 0.994 per unit represents normal atmospheric humidity and temperature.

Arguments

  • float absorption - Air absorption value in range [0.892;1.0].

float getAirAbsorption ( ) const#

Returns the current air absorption value determining the distance-dependent attenuation at high frequencies caused by the propagation medium.

Return value

Air absorption value.

void setDecayHFRatio ( float ratio ) #

Updates the ratio of high-frequency decay time relative to the time set by general reverberation decay time. The value 1.0 is neutral.

Arguments

  • float ratio - High-frequency decay ratio in range [0.1;2.0].

float getDecayHFRatio ( ) const#

Returns the current ratio of high-frequency decay time relative to the time set by general reverberation decay time. The value 1.0 is neutral.

Return value

High-frequency decay ratio.

void setDecayLFRatio ( float ratio ) #

Updates the ratio of low-frequency decay time relative to the time set by general reverberation decay time. The value 1.0 is neutral.

Arguments

  • float ratio - Low-frequency decay ratio in range [0.1;2.0].

float getDecayLFRatio ( ) const#

Returns the current ratio of low-frequency decay time relative to the time set by general reverberation decay time. The value 1.0 is neutral.

Return value

Low-frequency decay ratio.

void setDecayTime ( float time ) #

Updates the reverberation decay time.

Arguments

  • float time - Decay time in range [0.1;20.0] seconds.

float getDecayTime ( ) const#

Returns the current reverberation decay time.

Return value

Decay time in seconds.

void setDensity ( float density ) #

Updates the density of the resonances making up the reverberation sound.

Arguments

  • float density - Density value in range [0.0;1.0].

float getDensity ( ) const#

Returns the current density of the resonances making up the reverberation sound.

Return value

Density value.

void setDiffusion ( float diffusion ) #

Updates the diffusion determining the rate at which the reverberation resonances increase in density after the original sound.

Arguments

  • float diffusion - Diffusion value in range [0.0;1.0].

float getDiffusion ( ) const#

Returns the current diffusion determining the rate at which the reverberation resonances increase in density after the original sound.

Return value

Diffusion value.

void setEchoDepth ( float depth ) #

Updates the depth value determining how long the cyclic echo will persist along the reverberation decay.

Arguments

  • float depth - Echo depth value in range [0.0;1.0].

float getEchoDepth ( ) const#

Returns the current depth value determining how long the cyclic echo persists along the reverberation decay.

Return value

Echo depth value.

void setEchoTime ( float time ) #

Updates the time period for cyclic echo to repeat itself along the reverberation decay.

Arguments

  • float time - Echo repeating time in range [0.075,0.25] seconds.

float getEchoTime ( ) const#

Returns the current time period for cyclic echo to repeat itself along the reverberation decay.

Return value

Echo repeating time in seconds.

void setGain ( float gain ) #

Updates the gain controlling the overall amount of the initial reflections and later reverberations. Setting the value to 0.0 mutes the reverberation sound.

Arguments

  • float gain - Gain value in range [0.0;1.0].

float getGain ( ) const#

Returns the current gain controlling the overall amount of the initial reflections and later reverberations. If set to 0.0, the reverberation sound is muted.

Return value

Gain value.

void setGainHF ( float gainhf ) #

Updates the gain filter value for attenuating the reverberation sound at high frequencies. When setting the value to 1.0, no filter is applied.

Arguments

  • float gainhf - High frequencies gain value in range [0.0;1.0].

float getGainHF ( ) const#

Returns the current gain filter value for attenuating the reverberation sound at high frequencies. If set to 1.0, no filter is applied.

Return value

High-frequency gain value.

void setGainLF ( float gainlf ) #

Updates the gain filter value for attenuating the reverberation sound at low frequencies. When setting the value to 1.0, no filter is applied.

Arguments

  • float gainlf - Low frequencies gain value in range [0.0;1.0].

float getGainLF ( ) const#

Returns the current gain filter value for attenuating the reverberation sound at low frequencies. If set to 1.0, no filter is applied.

Return value

Low-frequency gain value.

void setLateReverbDelay ( float delay ) #

Updates the late reverberation delay determining the begin time of the late reverberation relative to the time of the initial reflection (the first of the early reflections).

Arguments

  • float delay - Late reverberation delay in range [0.0;0.1] seconds.

float getLateReverbDelay ( ) const#

Returns the current late reverberation delay determining the begin time of the late reverberation relative to the time of the initial reflection (the first of the early reflections).

Return value

Late reverberation delay in seconds.

void setLateReverbGain ( float gain ) #

Updates the gain controlling the amount of later reverberation relative to the general reverberation gain. Setting the value to 0.0 will result in sound having no late reverberation at all.

Arguments

  • float gain - Late reverberation gain value in range [0.0;10.0].

float getLateReverbGain ( ) const#

Returns the current gain controlling the amount of later reverberation relative to the general reverberation gain. If set to 0.0, the sound has no late reverberation at all.

Return value

Late reverberation gain value.

void setModulationDepth ( float depth ) #

Updates the modulation depth determining the amount of pitch change.

Arguments

  • float depth - Modulation depth value in range [0.0;1.0].

float getModulationDepth ( ) const#

Returns the current modulation depth determining the amount of pitch change.

Return value

Modulation depth value.

void setModulationTime ( float time ) #

Updates the time for repeating the pitch modulation in the reverberation sound.

Arguments

  • float time - Modulation repeating time in range [0.0;1.0] seconds.

float getModulationTime ( ) const#

Returns the current time for repeating the pitch modulation in the reverberation sound.

Return value

Modulation repeating time in seconds.

void setReflectionDelay ( float delay ) #

Updates the initial reflection delay determining the begin time of the first reflection from the source relative to the arrival time of the original sound.

Arguments

  • float delay - Initial reflection delay in range [0.0;0.3] seconds.

float getReflectionDelay ( ) const#

Returns the current initial reflection delay determining the begin time of the first reflection from the source relative to the arrival time of the original sound.

Return value

Initial reflection delay in seconds.

void setReflectionGain ( float gain ) #

Updates the gain controlling the amount of initial reflections relative to the general reverberation gain. Setting the value to 0.0 will result in sound having no initial reflections at all.

Arguments

  • float gain - Initial reflections gain value in range [0.0;3.1].

float getReflectionGain ( ) const#

Returns the current gain controlling the amount of initial reflections relative to the general reverberation gain. If set to 0.0, the sound has no initial reflections at all.

Return value

Initial reflections gain value.

void setReverbMask ( int mask ) #

Updates the bit mask that determines what reverberation zones can be heard. For sound to reverberate, at least one bit of this mask should match with the player's reverberation mask. At the same time, reverb mask of the sound source should also match with the player's one (but not necessarily in the same bit as this mask matches it).

Arguments

  • int mask - Integer, each bit of which is a mask for reverberating sound sources and reverberation zones.

int getReverbMask ( ) const#

Returns the current bit mask that determines what reverberation zones can be heard. For sound to reverberate, at least one bit of this mask should match with the player's reverberation mask. At the same time, reverb mask of the sound source should also match with the player's one (but not necessarily in the same bit as this mask matches it).

Return value

Integer, each bit of which is a mask for reverberating sound sources and reverberation zones.

void setRoomRolloff ( float rolloff ) #

Updates the scaling room rolloff factor determining attenuation of the reflected sound (containing both reflections and reverberation) over distance.

Arguments

  • float rolloff - Room rolloff factor in range [0.0;10.0].

float getRoomRolloff ( ) const#

Returns the current scaling room rolloff factor determining attenuation of the reflected sound (containing both reflections and reverberation) over distance.

Return value

Room rolloff factor.

void setSize ( const Math::vec3 & size ) #

Updates the size of the reverberation zone.

Arguments

  • const Math::vec3 & size - Size of the reverberation zone in units.

Math::vec3 getSize ( ) const#

Returns the current size of the reverberation zone.

Return value

Size of the reverberation zone in units.

void setThreshold ( const Math::vec3 & threshold ) #

Updates the threshold size values along the coordinates axes relative to the reverberation zone size. It determines the distance of changing from partial to full reverberation audibility.

Arguments

  • const Math::vec3 & threshold - Threshold size in units.

Math::vec3 getThreshold ( ) const#

Returns the current threshold size values along the coordinates axes relative to the reverberation zone size. It determines the distance of changing from partial to full reverberation audibility.

Return value

Threshold size in units.

static int type ( ) #

Returns the type of the node.

Return value

Sound type identifier.
Last update: 2024-04-19
Build: ()