GetLength

This function gets the length of a sound.

Syntax

Returns

Returns the length of the sound, in seconds.

Example

window = Window:Create()
context = Context:Create(window)
sound = Sound:Load("Sound/Music/menutheme.wav")
sound:Play()

while true do
if window:Closed() or window:KeyHit(Key.Escape) then return false end

context:SetColor(0,0,0)
context:Clear()

context:SetColor(1,1,1)
context:SetBlendMode(Blend.Alpha)
context:DrawText("Sound length: " .. sound:GetLength() .. " seconds",2,2)
context:SetBlendMode(Blend.Solid)

context:Sync()
end