GetSoundLevelData: Difference between revisions
Jump to navigation
Jump to search
m (2^15 possible values (first value - 0, last value - 32767)) |
Tag: Undo |
||
Line 12: | Line 12: | ||
===Returns=== | ===Returns=== | ||
Returns a two ''integers'' in range from 0 to | Returns a two ''integers'' in range from 0 to 32768. | ||
==Example== | ==Example== | ||
Line 22: | Line 22: | ||
local leftData, rightData = getSoundLevelData ( soundHandler ) | local leftData, rightData = getSoundLevelData ( soundHandler ) | ||
if ( leftData ) then | if ( leftData ) then | ||
dxDrawRectangle ( 0, 0, 64, leftData / | dxDrawRectangle ( 0, 0, 64, leftData / 32768 * 256, tocolor ( 255, 0, 0 ) ) | ||
dxDrawRectangle ( 64, 0, 64, rightData / | dxDrawRectangle ( 64, 0, 64, rightData / 32768 * 256, tocolor ( 0, 0, 255 ) ) | ||
end | end | ||
end | end |
Revision as of 07:37, 25 July 2020
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 32768.
Example
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 end end addEventHandler ( "onClientRender", root, onSoundPlayRender )
Requirements
This template will be deleted.
Changelog
Version | Description |
---|
1.3.2 | Added player element to use a players voice |
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