Why does this audio file not repeat?

[lua]local soundID = media.newEventSound( “drum.caf” )

local function playBeep()
media.playEventSound( soundID )
timer.performWithDelay( 1000, playBeep)
end
playBeep()[/lua]

surely it should repeat…?
(function does but not audio) [import]uid: 79135 topic_id: 16100 reply_id: 316100[/import]

local function playBeep()
media.playEventSound( soundID )
timer.performWithDelay( 1000, playBeep, 0) --try adding a “0” [import]uid: 17539 topic_id: 16100 reply_id: 59897[/import]

What does the “0” do, sorry? [import]uid: 79135 topic_id: 16100 reply_id: 59931[/import]

It makes the timer.performWithDelay repeat indefinitely. Try it and see. [import]uid: 17539 topic_id: 16100 reply_id: 59962[/import]

Out of interest… Why not use the open al audio api instead ?

http://developer.anscamobile.com/reference/audio [import]uid: 84637 topic_id: 16100 reply_id: 59978[/import]

would
timer.performWithDelay( 1000, playBeep, 5) repeat 5 times?

I am using it now, works good :slight_smile: [import]uid: 79135 topic_id: 16100 reply_id: 60002[/import]