Sound.loop read/write property
Get or set the sound looping mode, a boolean
value. If set to true
, the sound will be played again from start once its end have been reached.
This property default value is set to false
Example
local audio = require "audio"
local ui = require "ui"
local win = ui.Window("Music player", "fixed", 320, 200)
local file = sys.File("music.mp3")
local ch = ui.Checkbox(win, "Play in loop")
ch:center()
win:status("Playing "..file.name)
local sound = audio.Sound(file)
sound:play()
function ch:onClick()
sound.loop = self.checked -- Toggle if the sound loops
end
win:show()
while win.visible do
ui.update()
end