PT-BR/getSoundProperties
Jump to navigation
Jump to search
Essa função obtém as propriedades de um elemento de áudio.
Sintaxe
float, float, float, bool getSoundProperties( element audio )
Sintaxe POO(OOP) Não entendeu o que significa isso?
- Método: audio:getProperties(...)
- Oposto: setSoundProperties
Argumentos necessários
- audio: um elemento de áudio criado com playSound ou playSound3D.
Retorno
Essa função retorna três floats e um boolean:
- float: representa o valor da amostragem ou bitrate.
- float: representa a velocidade do compasso do áudio.
- float: representa o tom do áudio.
- boolean: representa se o áudio está de tráz para frente ou não.
Exemplo
Esse exemplo retorna os valores de amostragem, compasso, pitch e se o áudio está de tráz para frente a cada cinco segundos.
local audio
local timer
addCommandHandler("propriedades",
function ()
audio = playSound("audio.mp3")
timer = setTimer(function() soundProperties(audio) end, 5000, 0)
end
)
function soundProperties(audio)
local amostragem, compasso, tom, revertido = getSoundProperties(audio) --gets the sample rate, tempo, pitch and a boolean value representing whether the sound is reversed or not.
outputChatBox(amostragem .. " " .. compasso .. " " .. tom .. " " .. tostring(revertido))
end
Veja também
getSoundEffectParameters
getSoundFFTData
getSoundLength
getSoundLevelData
getSoundMaxDistance
getSoundMetaTags
getSoundMinDistance
getSoundPan
getSoundPosition
getSoundProperties
getSoundSpeed
getSoundVolume
getSoundWaveData