Difference between revisions of "love.audio.setEffect"
m (tweak examples for clarity) |
(document disabling effects) |
||
Line 18: | Line 18: | ||
=== Returns === | === Returns === | ||
{{param|boolean|success|Whether the effect was successfully created.}} | {{param|boolean|success|Whether the effect was successfully created.}} | ||
+ | |||
+ | == Function == | ||
+ | |||
+ | === Synopsis === | ||
+ | <source lang="lua"> | ||
+ | love.audio.setEffect(name, enabled) | ||
+ | </source> | ||
+ | |||
+ | === Arguments === | ||
+ | {{param|string|name|The name of the effect.}} | ||
+ | {{param|boolean|enabled (true)|If false and the given effect name was previously set, disables the effect.}} | ||
+ | |||
+ | === Returns === | ||
+ | {{param|boolean|success|Whether the effect was successfully disabled.}} | ||
== Available effects and corresponding settings == | == Available effects and corresponding settings == |
Revision as of 06:03, 20 October 2018
Available since LÖVE 11.0 |
This function is not supported in earlier versions. |
Defines an effect that can be applied to a Source.
Function
Synopsis
love.audio.setEffect(name, settings)
Arguments
string name
- The name of the effect.
table settings
- The settings to use for this effect, with the following fields:
Returns
boolean success
- Whether the effect was successfully created.
Function
Synopsis
love.audio.setEffect(name, enabled)
Arguments
string name
- The name of the effect.
boolean enabled (true)
- If false and the given effect name was previously set, disables the effect.
Returns
boolean success
- Whether the effect was successfully disabled.
Available effects and corresponding settings
reverb
number gain
number highgain
number density
number diffusion
number decaytime
number decayhighratio
number earlygain
number earlydelay
number lategain
number latedelay
number roomrolloff
number airabsorption
number highlimit
chorus
distortion
echo
flanger
ringmodulator
compressor
boolean enable
equalizer
number lowgain
number lowcut
number lowmidgain
number lowmidfrequency
number lowmidbandwidth
number highmidgain
number highmidfrequency
number highmidbandwidth
number highgain
number highcut
Examples
Playing music with added reverb
love.audio.setEffect('myEffect', {type = 'reverb'})
local source = love.audio.newSource('music.ogg', 'stream')
source:setEffect('myEffect')
source:play()
Playing music with distortion
love.audio.setEffect('myEffect', {
type = 'distortion',
gain = .5,
edge = .25,
})
local source = love.audio.newSource('music.ogg', 'stream')
source:setEffect('myEffect')
source:play()