love.audio.setEffect
Available since LÖVE 11.0 |
This function is not supported in earlier versions. |
Defines an effect that can be applied to a Source.
Not all system supports audio effects. Use love.audio.isEffectsSupported to check.
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:
EffectType type
- The type of effect to use.
number volume
- The volume of the effect.
number ...
- Effect-specific settings. See EffectType for available effects and their corresponding settings.
Returns
boolean success
- Whether the effect was successfully created.
Notes
It's worth noting that you need to specify the effects in numerically indexed tables like this
love.audio.setEffect("effect", {
{
type = "chorus",
volume = 1
},
{
type = "reverb",
volume = 0.5
}
})
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.
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()
See Also
Other Languages
Dansk –
Deutsch –
English –
Español –
Français –
Indonesia –
Italiano –
Lietuviškai –
Magyar –
Nederlands –
Polski –
Português –
Română –
Slovenský –
Suomi –
Svenska –
Türkçe –
Česky –
Ελληνικά –
Български –
Русский –
Српски –
Українська –
עברית –
ไทย –
日本語 –
正體中文 –
简体中文 –
Tiếng Việt –
한국어
More info