I try to use queue() but it doesn't work for me.
Maybe it needs
for event loop to work but it doesn't work for me too.
In documentation below queue() I found this comment:
This method only queues one music file.
If you call it and there already is a queued file, it will be overrided.
so queue is not so usefull.
I use pygame.mixer.music.set_endevent() with
for event loop to start next track
# define own event type
NEXT = pygame.USEREVENT + 1
playlist = [
tracks_number = len(playlist)
current_track = 0
pygame.init() # need it for event loop
#screen = pygame.display.set_mode((800,600)) # it can be useful to stop program
pygame.mixer.init(frequency = 48000)
# start first track
# send event NEXT every time tracks ends
running = True
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
elif event.type == NEXT:
# get next track (modulo number of tracks)
current_track = (current_track + 1) % tracks_number