Я играю звуковые файлы ogg из списка, созданного в моем выбранном каталоге музыкальных файлов. По какой-то причине первая песня пропущена, и она играет, начиная со второй песни. По какой-то причине он иногда играет секундную часть первой песни, что заставляет меня поверить, что есть проблема с тем, как я пытаюсь поставить в очередь песни из списка в цикле, но я не могу их исправить.PyGame Queuing Music Problems, не дожидаясь первой песни
import pygame
import sys
import os
from pygame.locals import *
surface = pygame.display.set_mode((640, 480))
musicDir = "/Users/user/Desktop/Dat Sound/Music/"
x = os.listdir(musicDir)
del(x[0]) # Deleting first element because it's DS Store file (Mac)
print x # The list is ['Bonfire.ogg', 'Voodoo Child.ogg']
n = ''
count = 1
pygame.mixer.init()
for i in range(len(x)):
n = musicDir + str(x[i])
print n
pygame.mixer.music.load(n)
pygame.mixer.music.play()
pygame.mixer.music.queue(musicDir + str(x[i]))
# I'm queueing the next song in the list of songs from the folder + its location
print pygame.mixer.music.get_busy()
# get_busy returns true for both files but only the second is playing
running = True
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False