Pygame - Sound delay

前端 未结 7 1251
广开言路
广开言路 2020-12-16 01:32

I\'ve made a button class that checks if a button is selected (when the mouse is hovering over the button). When the button is selected, unselected or clicked it plays a wav

7条回答
  •  情书的邮戳
    2020-12-16 02:10

    Decreasing the size of the buffer will reduce the latency. The buffer must be a power of 2. The default buffer is 4096, but you can change it when you initialize mixer as shown below:

    pygame.mixer.init(44100, -16, 2, 64)
    

    More information can be found on the pygame docs

提交回复
热议问题