HU/getSoundProperties

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Ez a funkció egy hang sajátos tulajdonságát kapja meg.

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 hangminta arányát adja vissza, a második az a hang sebességét, a harmadik pedig a hangmagasságot. A logikai érték pedig azt fejezi ki, hogy a hang megfordult-e, vagy sem.

Példa

Péda 1: Ez a példa visszaad 3 float értéket, a hangmintát, a sebességet, a hangmagasságot és a logikai érték pedig azt, hogy a hang megfordult-e vagy sem minden ötödig másodpercben.

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

Lásd még

Fordította