self:add_fx

Client

Adds an audio effect to the audio-2d instance's effect chain


Syntax

local status = self:add_fx(
    name,
    effect,
    parameters = {}
)

Parameters

TypeNameDescription
stringnameUnique name for this effect slot
core.audio_2d.effecteffectEffect to instantiate
tableparametersParameters specific to the assigned effect
Omitted keys fall back to the engine's default value

Returns

TypeNameDescription
boolstatustrue on successful addition, false otherwise

Examples

Add a reverb effect to an audio-2d instance
local entity = core.audio_2d.create("sounds/ambient.ogg")

entity:add_fx("my_reverb", core.audio_2d.effect.REVERB, {
    room_size = 0.8,
    wet = 0.5,
    dry = 0.5
})

entity:play()
Add a 10-band EQ effect to an audio-2d instance
local entity = core.audio_2d.create("sounds/ambient.ogg")

entity:add_fx("my_eq", core.audio_2d.effect.EQ10, {
    bands = { 0.0, 0.0, -3.0, -3.0, 0.0, 0.0, 2.0, 2.0, 0.0, 0.0 }
})

entity:play()

On this page