gpt4 book ai didi

python - 我什么时候需要使用 mixer pre-init 而不是 mixer.init?

转载 作者:太空宇宙 更新时间:2023-11-04 03:16:41 24 4
gpt4 key购买 nike

pygame.mixer init 和 pygame.mixer pre init 有什么区别?我看了一个教程,他用的是pre-init,但是解释的不是很清楚。我应该只使用 mixer init,还是两者都使用?

最佳答案

问题是初始化所有导入的 Pygame 模块的 pygame.init() 会使用其默认参数调用 pygame.mixer.init(),因为

some platforms require the pygame.mixer to be initialized after the display modules have initialized.

作为documentation states .

要解决此问题并为 frequencychannelsbuffersize 设置适当的默认值,您可以调用 pygame.mixer.pre_init () 在调用 pygame.init() 顶层函数之前预设默认混音器初始化参数。

关于python - 我什么时候需要使用 mixer pre-init 而不是 mixer.init?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36062177/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com