[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] playing a list of songs
"Jason Coggins" <jcoggins828@xxxxxxxxxxx> wrote:
> I am having trouble figuring out how to play a list of .mp3 files. I have
> tried using the for loop to cycle through the list but it repeatedly
> starts
> playing the first song in the list but never gets to the end of the song
> before it starts playing it again.
Two things you could do:
1) use pygame.mixer.music.play() to play the first song, and then
immediately use pygame.mixer.music.queue() on the remaining songs in your
list.
2) periodically call pygame.mixer.music.get_busy() to check to see if the
current song has finished, then play() another song.
-Dave LeCompte