GetSoundRollOff

Definition

double GetSoundRollOff(string 3DSoundObjectName)

Description

This function returns the rolloff of 3D sound 3DSoundObjectName.

Parameters

3DSoundObjectName
Specifies the 3D sound name. You can also use the name “this” for this parameter. In this case, “this” string refers to the name of the 3D sound to which this script is attached.

Return Value

Rolloff of 3D sound.

Example 1

rolloff = 0.0

function Init()
    rolloff = GetSoundRollOff("sound1")

    message = string.format("\nSound rolloff is > %.2f", rolloff)
    PrintConsole(message)
end

function Update()

end
First, we get the rolloff of 3D sound “sound1”. Then we display it in the console using the PrintConsole function.

Example 2

--Name of script is GetSoundRollOff2.lua

rolloff = 0.0

function Init()
    rolloff = GetSoundRollOff("this")

    message = string.format("\nSound rolloff is > %.2f", rolloff)
    PrintConsole(message)
end

function Update()

end
Assume that the above script named GetSoundRollOff2.lua is attached to a 3D sound object named “sound1”. In this case, string “this”  in the GetSoundRollOff function will be equal to “sound1”. In our example, the function GetSoundRollOff returns the rolloff of current 3D sound, which is “sound1”.
adminGetSoundRollOff