SoundChannel:setEffect: Difference between revisions

From GiderosMobile
Created page with "__NOTOC__ '''Available since:''' Gideros 2022.6<br/> '''Class:''' SoundChannel<br/> === Description === Sets effects on a sound channel. <source lang="lua"> SoundChannel:..."
 
m Text replacement - "</source>" to "</syntaxhighlight>"
 
(2 intermediate revisions by 2 users not shown)
Line 5: Line 5:
=== Description ===
=== Description ===
Sets effects on a sound channel.
Sets effects on a sound channel.
<source lang="lua">
<syntaxhighlight lang="lua">
SoundChannel:setEffect(effect,params)
SoundChannel:setEffect(effect,params)
</source>
</syntaxhighlight>


Available effects are:
* '''"equalizer"'''
* '''"biquad"'''


'''TODO: add a list of all possible effects'''
Available parameters for '''equalizer''' are:
* AL_EQUALIZER_LOW_GAIN 0x0001
* AL_EQUALIZER_LOW_CUTOFF 0x0002
* AL_EQUALIZER_MID1_GAIN 0x0003
* AL_EQUALIZER_MID1_CENTER 0x0004
* AL_EQUALIZER_MID1_WIDTH 0x0005
* AL_EQUALIZER_MID2_GAIN 0x0006
* AL_EQUALIZER_MID2_CENTER 0x0007
* AL_EQUALIZER_MID2_WIDTH 0x0008
* AL_EQUALIZER_HIGH_GAIN 0x0009
* AL_EQUALIZER_HIGH_CUTOFF 0x000A


=== Parameters ===
=== Parameters ===
'''effect''': (number) the effect to set new values to<br/>
'''effect''': (String) the effect to set new values to<br/>
'''params''': (number) the new values of the effect<br/>
'''params''': (number) the new values of the effect<br/>


=== Example ===
=== Example ===
<source lang="lua">
<syntaxhighlight lang="lua">
local sndcoin = Sound.new("audio/sfx/sfx_coin_double1.wav")
local sndcoin = Sound.new("audio/sfx/sfx_coin_double1.wav")
local channel = sndcoin:play()
local channel = sndcoin:play()
-- audioChannel:setEffect("equalizer",{ equalizer settings })
channel:setEffect("equalizer", {AL_EQUALIZER_HIGH_GAIN, 10})
channel:setEffect("equalizer", {AL_EQUALIZER_HIGH_GAIN, 10})
</source>
--  audioChannel:setEffect("biquad",{ biquad coefficients })
channel:setEffect("biquad", {2,1,12})
</syntaxhighlight>


{{SoundChannel}}
{{SoundChannel}}

Latest revision as of 13:33, 13 July 2023

Available since: Gideros 2022.6
Class: SoundChannel

Description

Sets effects on a sound channel.

SoundChannel:setEffect(effect,params)

Available effects are:

  • "equalizer"
  • "biquad"

Available parameters for equalizer are:

  • AL_EQUALIZER_LOW_GAIN 0x0001
  • AL_EQUALIZER_LOW_CUTOFF 0x0002
  • AL_EQUALIZER_MID1_GAIN 0x0003
  • AL_EQUALIZER_MID1_CENTER 0x0004
  • AL_EQUALIZER_MID1_WIDTH 0x0005
  • AL_EQUALIZER_MID2_GAIN 0x0006
  • AL_EQUALIZER_MID2_CENTER 0x0007
  • AL_EQUALIZER_MID2_WIDTH 0x0008
  • AL_EQUALIZER_HIGH_GAIN 0x0009
  • AL_EQUALIZER_HIGH_CUTOFF 0x000A

Parameters

effect: (String) the effect to set new values to
params: (number) the new values of the effect

Example

local sndcoin = Sound.new("audio/sfx/sfx_coin_double1.wav")
local channel = sndcoin:play()
-- audioChannel:setEffect("equalizer",{ equalizer settings })
channel:setEffect("equalizer", {AL_EQUALIZER_HIGH_GAIN, 10})
--  audioChannel:setEffect("biquad",{ biquad coefficients })
channel:setEffect("biquad", {2,1,12})