HU/getSoundLevelData: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "__NOTOC__ {{Client function hu}} This function gets the left/right level from a sound element. {{New feature/item|3.0132|1.3.2|| If the element is a player, this func...")
 
No edit summary
Line 3: Line 3:
This function gets the left/right level from a [[sound]] [[element]].
This function gets the left/right level from a [[sound]] [[element]].
{{New feature/item|3.0132|1.3.2||
{{New feature/item|3.0132|1.3.2||
If the element is a player, this function will use the players voice.
Ha az elem egy játékos, akkor ez a funkció a játékos hangját fogja használni.
}}
}}
==Syntax==  
==Szintaxis==  
<syntaxhighlight lang="lua">int, int getSoundLevelData ( element theSound )</syntaxhighlight>  
<syntaxhighlight lang="lua">int, int getSoundLevelData ( element theSound )</syntaxhighlight>  
{{OOP||[[sound]]:getLevelData}}
{{OOP||[[sound]]:getLevelData}}

Revision as of 13:10, 18 July 2018

This function gets the left/right level from a sound element. Ha az elem egy játékos, akkor ez a funkció a játékos hangját fogja használni.

Szintaxis

int, int getSoundLevelData ( element theSound )

OOP Syntax Help! I don't understand this!

Method: sound:getLevelData(...)


Required Arguments

  • theSound: the sound element which level data you want to return.

Returns

Returns a two integers in range from 0 to 32767.

Example

Click to collapse [-]
Client
soundHandler = 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

This template will be deleted.

Changelog

Version Description
1.3.2 Added player element to use a players voice

See Also