Background music playlist with looping

Hi,
Is there someone who can recommend a way on how to build a playlist for background music which when the last song is played start at song number one again?

I want to load all the soundfiles when entering the new scene, preferably in a table.

This is the code im using now, it works but only for every other loop, the second, forth and so on, it loops through every song in a fast pace, then on the third loop it works perfect again. I imagine there is a much better way, but for now I cant think of it. So plz help :slight_smile:
[lua] if (splashscreen._MUSIC == 1 and audio.isChannelActive(2) == false ) then
GameMusic1 = audio.loadStream(PLAYLIST[1])
GameMusic2 = audio.loadStream(PLAYLIST[2])
GameMusic3 = audio.loadStream(PLAYLIST[3])
GameMusic4 = audio.loadStream(PLAYLIST[4])
GameMusic5 = audio.loadStream(PLAYLIST[5])
end

local function PLAYMUSIC()
if(audio.isChannelActive(1)) then audio.stop(1) end
if (splashscreen._MUSIC == 1 and audio.isChannelActive(2) == false ) then

local track = 1
local GameMusic
local function PlayTrack()
audio.setVolume( 1.0, { channel= 2 } )
if(splashscreen._MUSIC == 1) then
if (track == 1) then
track = 2
GameMusic = GameMusic1
elseif (track == 2) then
track = 3
GameMusic = GameMusic2
elseif (track == 3) then
track = 4
GameMusic = GameMusic3
elseif (track == 4) then
track = 5
GameMusic = GameMusic4
elseif (track == 5) then
track = 1
GameMusic = GameMusic5
end
audio.play(GameMusic, { channel=2, loops=0, onComplete = PlayTrack})
local duration = audio.getDuration(GameMusic)
audio.fadeOut({ channel = 2, time = duration - 4000 } )

end
end
PlayTrack()
end
end
PLAYMUSIC() [/lua] [import]uid: 126729 topic_id: 29655 reply_id: 329655[/import]

Is there someone who have built a playlist with looping who could give me some advice? Or someone who have a good ide on how it should be done? Would really appreciate it, because my solution is not working the way I want it to. So im stuck. [import]uid: 126729 topic_id: 29655 reply_id: 119277[/import]