Difference between revisions of "love.audio.setEffect"

(Created page with "{{newin|11.0|110|type=function}} Defines an effect that can be applied to a Source. == Function == === Synopsis === <source lang="lua"> love.audio.setEffect(name, se...")
 
(add parent)
Line 109: Line 109:
  
 
== See Also ==
 
== See Also ==
 +
* [[parent::love.audio]]
 
* [[Source:setEffect]]
 
* [[Source:setEffect]]
  
 
[[Category:Functions]]
 
[[Category:Functions]]
 
{{#set:Description=Defines an effect that can be applied to a Source.}}
 
{{#set:Description=Defines an effect that can be applied to a Source.}}

Revision as of 05:47, 25 April 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:
string type
The type of effect to use.
number volume
The volume of the effect.
number ...
Effect-specific settings (listed below).

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

string waveform
number phase
number rate
number depth
number feedback
number delay

distortion

number gain
number edge
number lowcut
number center
number bandwidth

echo

number delay
number tapdelay
number damping
number feedback
number spread

flanger

string waveform
number phase
number rate
number depth
number feedback
number delay

ringmodulator

string waveform
number frequency
number highcut

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('effect', {type = 'reverb'})
local source = love.audio.newSource('music.ogg', 'stream')
source:setEffect 'effect'
source:play()

Playing music with distortion

love.audio.setEffect('effect', {
	type = 'distortion',
	gain = .5,
	edge = .25,
})
local source = love.audio.newSource('music.ogg', 'stream')
source:setEffect 'effect'
source:play()

See Also