Difference between revisions of "Source:setEffect"

(Created page)
 
(Notes: Note about dry/wet sound.)
 
(One intermediate revision by the same user not shown)
Line 26: Line 26:
 
{{param|table|filtersettings|The filter settings to apply prior to the effect, with the following fields:}}
 
{{param|table|filtersettings|The filter settings to apply prior to the effect, with the following fields:}}
 
{{subparam|FilterType|type|The type of filter to use.}}
 
{{subparam|FilterType|type|The type of filter to use.}}
{{subparam|number|volume|The overall volume of the audio. Must be between 0 and 1.}}
+
{{subparam|number|volume|The overall audio input volume for the effect. Must be between 0 and 1. (Does not affect the dry audio output for the source.)}}
{{subparam|number|highgain|Volume of high-frequency audio. Only applies to low-pass and band-pass filters. Must be between 0 and 1.}}
+
{{subparam|number|highgain|Volume of high-frequency audio. Only applies to <code>lowpass</code> and <code>bandpass</code> filters. Must be between 0 and 1.}}
{{subparam|number|lowgain|Volume of low-frequency audio. Only applies to high-pass and band-pass filters. Must be between 0 and 1.}}
+
{{subparam|number|lowgain|Volume of low-frequency audio. Only applies to <code>highpass</code> and <code>bandpass</code> filters. Must be between 0 and 1.}}
 +
 
 
=== Returns ===
 
=== Returns ===
 
{{param|boolean|success|Whether the effect and filter were successfully applied to this Source.}}
 
{{param|boolean|success|Whether the effect and filter were successfully applied to this Source.}}
Line 34: Line 35:
 
== Notes ==
 
== Notes ==
 
Audio effect functionality is not supported on iOS.
 
Audio effect functionality is not supported on iOS.
 +
 +
Audio produced by effects are added on top of the normal dry sound from Sources. [[Source:setFilter]] can be used to change the volume of, or mute, the Source without affecting the effects.
 +
 +
While the cutoff frequency for the filter cannot be set directly, changing high/lowgain has the effect of altering the cutoff. See it explained in [https://github.com/kcat/openal-soft/issues/164 this thread].
  
 
== See Also ==
 
== See Also ==

Latest revision as of 11:00, 17 August 2022

Available since LÖVE 11.0
This function is not supported in earlier versions.

Applies an audio effect to the Source.

The effect must have been previously defined using love.audio.setEffect.

Function

Applies the given previously defined effect to this Source.

Synopsis

success = Source:setEffect( name, enable )

Arguments

string name
The name of the effect previously set up with love.audio.setEffect.
boolean enable (true)
If false and the given effect name was previously enabled on this Source, disables the effect.

Returns

boolean success
Whether the effect was successfully applied to this Source.

Function

Applies the given previously defined effect to this Source, and applies a filter to the Source which affects the sound fed into the effect.

Synopsis

success = Source:setEffect( name, filtersettings )

Arguments

string name
The name of the effect previously set up with love.audio.setEffect.
table filtersettings
The filter settings to apply prior to the effect, with the following fields:
FilterType type
The type of filter to use.
number volume
The overall audio input volume for the effect. Must be between 0 and 1. (Does not affect the dry audio output for the source.)
number highgain
Volume of high-frequency audio. Only applies to lowpass and bandpass filters. Must be between 0 and 1.
number lowgain
Volume of low-frequency audio. Only applies to highpass and bandpass filters. Must be between 0 and 1.

Returns

boolean success
Whether the effect and filter were successfully applied to this Source.

Notes

Audio effect functionality is not supported on iOS.

Audio produced by effects are added on top of the normal dry sound from Sources. Source:setFilter can be used to change the volume of, or mute, the Source without affecting the effects.

While the cutoff frequency for the filter cannot be set directly, changing high/lowgain has the effect of altering the cutoff. See it explained in this thread.

See Also

Other Languages