Difference between revisions of "love.audio.setEffect"
(add parent) |
m (tweak examples for clarity) |
||
Line 90: | Line 90: | ||
=== Playing music with added reverb === | === Playing music with added reverb === | ||
<source lang="lua"> | <source lang="lua"> | ||
− | love.audio.setEffect(' | + | love.audio.setEffect('myEffect', {type = 'reverb'}) |
local source = love.audio.newSource('music.ogg', 'stream') | local source = love.audio.newSource('music.ogg', 'stream') | ||
− | source:setEffect ' | + | source:setEffect('myEffect') |
source:play() | source:play() | ||
</source> | </source> | ||
Line 98: | Line 98: | ||
=== Playing music with distortion === | === Playing music with distortion === | ||
<source lang="lua"> | <source lang="lua"> | ||
− | love.audio.setEffect(' | + | love.audio.setEffect('myEffect', { |
type = 'distortion', | type = 'distortion', | ||
gain = .5, | gain = .5, | ||
Line 104: | Line 104: | ||
}) | }) | ||
local source = love.audio.newSource('music.ogg', 'stream') | local source = love.audio.newSource('music.ogg', 'stream') | ||
− | source:setEffect ' | + | source:setEffect('myEffect') |
source:play() | source:play() | ||
</source> | </source> |
Revision as of 05:26, 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.
Contents
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.
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()