Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
How to loop music — Gideros Forum

How to loop music

RistyoRistyo Member
edited July 2014 in General questions
Hello,
I am currently working on a game and i wanted to loop the in-game music. Is this possible without the use of manual timers?
Thank you

Comments

  • ar2rsawseenar2rsawseen Maintainer
    Sure
    music:play(0, true)
    http://docs.giderosmobile.com/reference/gideros/Sound/play#Sound:play
  • It is easy.
    local musicloop = Sound.new("musicloop.mp3")
    musicloop:play(0,true)
  • aa have been ninja'd @ar2rsawseen :((
    :D
  • Syntax:
    (SoundChannel) = Sound:play(startTime, looping, paused)
    Parameters:
    startTime: (number, default = 0) The initial position in milliseconds at which playback should start.
    looping: (boolean, default = false)
    paused: (boolean, default = false)
  • RistyoRistyo Member
    Thanks guys, i figured this out earlier but i didn't know there was a much easier solution.
    My code :
    sound = Sound.new("music")
    channel = sound:play()

    channel:addEventListener(Event.COMPLETE,
    function()
    channel = sound:play()
    end)
Sign In or Register to comment.