self:set_volume

Client

Sets the linear volume of the audio-2d instance


Syntax

local status = self:set_volume(
    volume
)

Parameters

TypeNameDescription
floatvolumeLinear volume to apply - where 0.0 is silent and 1.0 is full volume
Values above 1.0 amplify the audio beyond its original level

Returns

TypeNameDescription
boolstatustrue on successful execution, false otherwise

Examples

Reduce the volume of an audio-2d instance
local entity = core.audio_2d.create("sounds/ambient.ogg")

entity:set_volume(0.5)

On this page