GetSoundLevelData
From Multi Theft Auto: Wiki
This function gets the left/right level from a sound element. If the element is a player, this function will use the players voice.
Syntax
int, int getSoundLevelData ( element theSound )
OOP Syntax Help! I don't understand this!
- Method: sound:getLevelData(...)
Required Arguments
Returns
Returns a two integers in range from 0 to 32767.
Example
Click to collapse [-]
ClientsoundHandler = playSound ( "sound.wav" ) function onSoundPlayRender ( ) if ( soundHandler ) then local leftData, rightData = getSoundLevelData ( soundHandler ) if ( leftData ) then dxDrawRectangle ( 0, 0, 64, leftData / 32767 * 256, tocolor ( 255, 0, 0 ) ) dxDrawRectangle ( 64, 0, 64, rightData / 32767 * 256, tocolor ( 0, 0, 255 ) ) end end end addEventHandler ( "onClientRender", getRootElement(), onSoundPlayRender )
Requirements
Minimum supported server | n/a |
---|---|
Minimum supported client | 1.3.0-9.04162 |
Note: Using this function requires the resource to have the above minimum version declared in the meta.xml <min_mta_version> section. e.g. <min_mta_version client="1.3.0-9.04162" />
Changelog
Version | Description |
---|
1.3.2 | Added player element to use a players voice |
See Also
- getSoundBufferLength
- getSoundEffects
- getSoundFFTData
- getSoundLength
- getSoundLevelData
- getSoundMaxDistance
- getSoundMetaTags
- getSoundMinDistance
- getSoundPan
- getSoundPosition
- getSoundProperties
- getSoundSpeed
- getSoundVolume
- getSoundWaveData
- isSoundPanningEnabled
- isSoundPaused
- playSFX
- playSFX3D
- playSound
- playSound3D
- playSoundFrontEnd
- setRadioChannel
- setSoundEffectEnabled
- setSoundMaxDistance
- setSoundMinDistance
- setSoundPan
- setSoundPanningEnabled
- setSoundPaused
- setSoundPosition
- setSoundProperties
- setSoundSpeed
- setSoundVolume
- stopSound