getSoundLevelData
Client-side
Server-side
Shared
This function gets the left/right level from a sound element. If the element is a player, this function will use the players voice.
OOP Syntax Help! I don't understand this!
- Method:sound:getLevelData(...)
Syntax
int|false, int getSoundLevelData ( sound/player theSound )Required Arguments
- theSound: The sound element which level data you want to return.
Returns
- int|false: leftLevel
- int: rightLevel
Returns a two integers in range from 0 to 32768. false if wrong sound element passed.
Code Examples
client
local soundHandler = playSound("sound.wav")
function onSoundPlayRender() if (soundHandler) then local leftData, rightData = getSoundLevelData(soundHandler) if (leftData) then dxDrawRectangle(0, 0, 64, leftData / 32768 * 256, tocolor(255, 0, 0)) dxDrawRectangle(64, 0, 64, rightData / 32768 * 256, tocolor(0, 0, 255)) end endendaddEventHandler("onClientRender", root, onSoundPlayRender)Changelog
Added player element to use a players voice.
See Also
Audio Functions
- getRadioChannel
- getRadioChannelName
- getSFXStatus
- getSoundBPM
- getSoundBufferLength
- getSoundEffectParameters
- getSoundEffects
- getSoundFFTData
- getSoundLength
- getSoundLevelData
- getSoundMaxDistance
- getSoundMetaTags
- getSoundMinDistance
- getSoundPan
- getSoundPosition
- getSoundProperties
- getSoundSpeed
- getSoundVolume
- getSoundWaveData
- isSoundLooped
- isSoundPanningEnabled
- isSoundPaused
- playSFX
- playSFX3D
- playSound
- playSound3D
- playSoundFrontEnd
- setRadioChannel
- setSoundEffectEnabled
- setSoundEffectParameter
- setSoundLooped
- setSoundMaxDistance
- setSoundMinDistance
- setSoundPan
- setSoundPanningEnabled
- setSoundPaused
- setSoundPosition
- setSoundProperties
- setSoundSpeed
- setSoundVolume
- stopSound