SetSoundEffectEnabled: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
mNo edit summary |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 6: | Line 6: | ||
}} | }} | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua">bool setSoundEffectEnabled ( element | <syntaxhighlight lang="lua">bool setSoundEffectEnabled ( element theSound/thePlayer, string effectName, bool bEnable )</syntaxhighlight> | ||
{{OOP||[[sound]]:setEffectEnabled}} | {{OOP||[[sound]]:setEffectEnabled}} | ||
===Required Arguments=== | ===Required Arguments=== | ||
*'''sound:''' a [[sound]] [[element]]. | *'''sound:''' a [[sound]] element or a [[player]] element which will affect the [[Resource:Voice|voice]] broadcast. | ||
*'''effectName:''' the effect you want to enable or disable | *'''effectName:''' the effect you want to enable or disable | ||
{{Sound_Effects}} | {{Sound_Effects}} | ||
Line 19: | Line 19: | ||
==Example== | ==Example== | ||
This example creates a sound and set's the flanger sound effect enabled. | This example creates a sound and set's the flanger sound effect enabled. | ||
<syntaxhighlight lang="lua">addCommandHandler("flanger",function(cmd,enabled) | <syntaxhighlight lang="lua"> | ||
if | addCommandHandler("flanger", function(cmd, enabled) | ||
setSoundEffectEnabled(waterSplashes,cmd,enabled) | if isElement(waterSplashes) then | ||
setSoundEffectEnabled(waterSplashes, cmd, enabled) | |||
else | else | ||
waterSplashes = playSound("splashes.mp3",true) | waterSplashes = playSound("splashes.mp3", true) | ||
setSoundEffectEnabled(waterSplashes,cmd,enabled) | setSoundEffectEnabled(waterSplashes, cmd, enabled) | ||
end | end | ||
end,true) --set it case sensitive as we are going to get the command name and use it in the setSoundEffectEnabled | end, true) --set it case sensitive as we are going to get the command name and use it in the setSoundEffectEnabled | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 39: | Line 40: | ||
[[ar:setSoundEffectEnabled]] | [[ar:setSoundEffectEnabled]] | ||
[[RO:setSoundEffectEnabled]] | [[RO:setSoundEffectEnabled]] | ||
[[pt-br:setSoundEffectEnabled]] |
Latest revision as of 01:32, 19 August 2021
Used to enable or disable specific sound effects. Use a player element to control a players voice with this function.
Syntax
bool setSoundEffectEnabled ( element theSound/thePlayer, string effectName, bool bEnable )
OOP Syntax Help! I don't understand this!
- Method: sound:setEffectEnabled(...)
Required Arguments
- sound: a sound element or a player element which will affect the voice broadcast.
- effectName: the effect you want to enable or disable
- gargle
- compressor
- echo
- i3dl2reverb
- distortion
- chorus
- parameq
- reverb
- flanger
- bEnable: true if you want to enable the effect, false if you want to disable it.
Returns
Returns true if the effect was set successfully, false otherwise.
Example
This example creates a sound and set's the flanger sound effect enabled.
addCommandHandler("flanger", function(cmd, enabled) if isElement(waterSplashes) then setSoundEffectEnabled(waterSplashes, cmd, enabled) else waterSplashes = playSound("splashes.mp3", true) setSoundEffectEnabled(waterSplashes, cmd, enabled) end end, true) --set it case sensitive as we are going to get the command name and use it in the setSoundEffectEnabled
Changelog
Version | Description |
---|
1.3.2 | Added player element for voice control |
See Also
- getRadioChannel
- getRadioChannelName
- getSFXStatus
- getSoundBPM
- getSoundBufferLength
- getSoundEffectParameters
- getSoundEffects
- getSoundFFTData
- getSoundLength
- getSoundLevelData
- getSoundMaxDistance
- getSoundMetaTags
- getSoundMinDistance
- getSoundPan
- getSoundPosition
- getSoundProperties
- getSoundSpeed
- getSoundVolume
- getSoundWaveData
- isSoundLooped
- isSoundPanningEnabled
- isSoundPaused
- playSFX3D
- playSFX
- playSound3D
- playSound
- setRadioChannel
- setSoundEffectEnabled
- setSoundEffectParameter
- setSoundLooped
- setSoundMaxDistance
- setSoundMinDistance
- setSoundPan
- setSoundPanningEnabled
- setSoundPaused
- setSoundPosition
- setSoundProperties
- setSoundSpeed
- setSoundVolume
- stopSound
- Shared
- playSoundFrontEnd