Set the attenuation mode of 3d sound effects||doc135614

September 20, 2022

Format

 TdAudioEngine:set3DRollOffMode(nSoundId, mode)

Description

Set the weakening mode of the 3d sound effect corresponding to the sound effect ID.


Precautions

To set the attenuation mode of the sound effect volume, you must first obtain the id number of the sound effect to be set. So this function should be matched with the playback function of the sound effectplay3dSoundorplay2dSoundto use.


Parameters

Variable name type Description
nSoundId int sound effectId
mode Sound3DRollOffType Debilitating types of 3d sound effects


Code Samples

local TdAudioEngine = TdAudioEngine.Instance()
local soundID = TdAudioEngine:play3dSound( "asset/Audio/Sound/click.mp3", {x = 0,y = 3,z = 0} ,true)
TdAudioEngine:set3DRollOffMode(soundID,0x00100000)
end