SetLoopMode

This function sets the looping mode for a source.

Syntax

Parameters

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