Pygame sound delay - Not related to buffer/sampling

后端 未结 2 545
情话喂你
情话喂你 2021-01-15 19:47

I am trying to play simple wav files in my little game whenever the user hovers over a button, a little click sound is played (same goes for when the button is actually pres

2条回答
  •  一个人的身影
    2021-01-15 20:05

    THE ANSWER:

    I wound up initiating the mixer with pre_init settings, then quitting the mixer, then initiating it again:

    pygame.mixer.pre_init(22050, -16, 2, 1024)
    pygame.init()
    pygame.mixer.quit()
    pygame.mixer.init(22050, -16, 2, 1024)
    

    Now it works just fine.

提交回复
热议问题