GetTime

This function gets a source's current time.

Syntax

Returns

Returns the source's current time, in seconds.

Example

--Create a window
window = Window:Create()
context = Context:Create(window)

--Load a sound
local sound = Sound:Load("Sound/Music/menutheme.wav")

source = Source:Create()
source:SetSound(sound)
sound:Release()
source:SetLoopMode(true)
source:Play()
while true do
--Press space key to pause/resume sound
if (window:KeyHit(Key.Space)) then
if (source:GetState()==Source.Paused) then
source:Resume()
else
source:Pause()
end
end

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

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

context:SetColor(1,1,1)
context:SetBlendMode(Blend.Alpha)
context:DrawText("Time: "..source:GetTime(),2,2)

context:Sync()
end