Pause
This function will pause a source that is playing.
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:Sync()
end