Home How can a looping pygame.mixer playlist be set playing in the background?
Reply: 0

How can a looping pygame.mixer playlist be set playing in the background?

user691
1#
user691 Published in July 23, 2018, 1:18 pm

I've got a playlist of .ogg music files and I wanna set them playing in the game background on a big playlist loop. So, once all of the music files have been played by pygame.mixer, it loops back to the beginning to start again.

However, when I load the first track, set it playing and then add the other tracks to the queue, only the first track plays. I'm not sure how to get the queue to loop. What am I doing wrong?

playlist = ["2.ogg", "3.ogg", "1.ogg"]
pygame.mixer.init(frequency = 48000)
pygame.mixer.music.load("1.ogg")
pygame.mixer.music.play()
for track in playlist:
    pygame.mixer.music.queue(track)
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.310817 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO