我在OSX 10.11.2上将pygame与Python 3.6一起使用。似乎无法识别我提供的任何音乐格式,但出现以下错误:
WARNING: 140: This application, or a library it uses, is using the
deprecated Carbon Component Manager for hosting Audio Units. Support for
this will be removed in a future release. Also, this makes the host
incompatible with version 3 audio units. Please transition to the API's in
AudioComponent.h.
Traceback (most recent call last):
File "example.py", line 1722, in <module>
run_game(screenX, screenY, 60, TitleScene())
File "example.py", line 664, in run_game
pygame.mixer.music.load('audio/example.ogg')
pygame.error: Unrecognized music format
我不确定Carbon Component Manager问题是否相关,但是我认为这仅应与不同操作系统版本的兼容性有关?
这是我要运行的Python代码:
import pygame
pygame.init()
pygame.mixer.init()
pygame.mixer.music.load('audio/example.ogg')
pygame.mixer.music.play(-1)
从文档看来,应同时支持ogg,mp3和xm,但它们都给出相同的错误。我希望播放xm文件,但目前没有任何效果。