SetTime
This function will set the time a source is playing at.
Syntax
Parameters
- time: the time to set, in seconds.
Remarks
This function will increment the reference count of the new sound and decrement the reference count of the old sound (if they exist).
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