setSoundPanningEnabled
Client-side
Server-side
Shared
Pair: isSoundPanningEnabled
This function toggles the panning of a sound (hearing it closer to the left or right side of the speakers due to the camera position). By default a sound has its panning enabled.
OOP Syntax Help! I don't understand this!
- Method: sound:setPanningEnabled(...)
- Variable: .panningEnabled
Syntax
bool setSoundPanningEnabled ( sound theSound, bool enabled )
Required Arguments
- theSound: A sound element to change the panning of.
- enabled: true to enable the panning, false otherwise.
Returns
- bool: result
Returns true if the sound is valid and good arguments were passed, false if not.
If the sound is not 3D, this function will return true as well, but isSoundPanningEnabled will always return true after this (so it has no effect).
Code Examples
client
This example creates a sound at the center of the map when the resource which cointains it starts and adds a command called /soundpanning
, which changes the panning of the sound.
local panned = truelocal sound = playSFX3D("script", 7, 1, 0, 0, 20, true)
function changePanning() if sound then setSoundPanningEnabled(sound, not panned) panned = not panned outputChatBox("Sound panning changed to " .. tostring(panned)) else outputDebugString("Looks that your GTA was ripped.") endendaddCommandHandler("soundpanning", changePanning)
See Also
Audio Functions
- getRadioChannelName
- getRadioChannel
- getSoundBPM
- getSFXStatus
- getSoundBufferLength
- getSoundEffectParameters
- getSoundEffects
- getSoundFFTData
- getSoundLevelData
- getSoundLength
- getSoundMetaTags
- getSoundMaxDistance
- getSoundMinDistance
- getSoundPan
- getSoundPosition
- getSoundProperties
- getSoundSpeed
- getSoundVolume
- getSoundWaveData
- isSoundLooped
- isSoundPanningEnabled
- isSoundPaused
- playSFX
- playSFX3D
- playSound
- playSound3D
- setRadioChannel
- setSoundEffectEnabled
- setSoundEffectParameter
- setSoundMaxDistance
- setSoundLooped
- setSoundMinDistance
- setSoundPan
- setSoundPanningEnabled
- setSoundPaused
- setSoundPosition
- setSoundProperties
- setSoundSpeed
- setSoundVolume
- stopSound