HU/getSoundProperties

From Multi Theft Auto: Wiki
Revision as of 10:48, 19 July 2018 by Surge (talk | contribs)
Jump to navigation Jump to search

Ez a funkció egy hang sajátos tulajdonságát adja vissza.

Szintaxis

float, float, float, bool getSoundProperties( element sound )

OOP Syntax Help! I don't understand this!

Method: sound:getProperties(...)
Counterpart: setSoundProperties


Kötelező argumentumok

Visszaadott érték

Ez a fuknció visszaad 3 float és egy logikai értéket:

Az első 'float' az a hangsample rate| minta aránya, the second one the sound's tempo, and the third one the pitch of the sound. The boolean representing whether the sound is reversed or not.

Példa

Péda 1: This example would return three float values representing the sample rate, tempo, pitch and a boolean value representing whether the sound is reversed or not, every 5 seconds.

local sound 
local timer

addCommandHandler("playsound",
function () 
    sound = playSound("wasted.mp3")
    timer = setTimer(function() soundProperties(sound) end, 5000, 0)
end
)

function soundProperties(sound)
    local sampleRate, tempo, pitch, isReversed = getSoundProperties(sound) --gets the sample rate, tempo, pitch and a boolean value representing whether the sound is reversed or not.
    outputChatBox(sampleRate.." "..tempo.." "..pitch.." "..tostring(isReversed))
end

See Also