问题描述
我只是想用OpenAl创建一些3D声音。但是我注意到对python的支持不多。我唯一能找到的文档是PyAl。但是作为一个初学者,我仍然无法获得从链接获得的基本代码。它只是说没有名为“ openal”的模块。我尝试通过pip安装它,但是也不存在。
我仔细阅读了文档,并说它在从网站下载openAL后运行python setup.py install
。我下载了openAL安装程序,它说安装已完成。没有要运行的setup.py文件。我的Windows / System32文件夹中确实有OpenAL32.dll文件。
因此,我对如何开始在python中使用此模块感到有些困惑?是否有关于使用Python的openAL的教程,或者您对使用初学者更好的文档使用其他语言有任何建议?
from openal import al,alc # imports all relevant AL and ALC functions
def main():
source = al.ALuint()
device = alc.alcopenDevice(None)
if not device:
error = alc.alcGetError()
# do something with the error,which is a ctypes value
return -1
# Omit error checking
context = alc.alcCreateContext(device,None)
alc.alcMakeContextCurrent(context)
# Do more things
al.alGenSources(1,source)
al.alSourcef(source,al.AL_PITCH,1)
al.alSourcef(source,al.AL_GAIN,1)
al.alSource3f(source,al.AL_POSITION,10,0)
al.alSource3f(source,al.AL_VELociTY,0)
al.alSourcei(source,al.AL_LOOPING,1)
al.alDeleteSources(1,source)
alc.alcDestroyContext(context)
alc.alccloseDevice(device)
return 0
if __name__ == "__main__":
raise SystemExit(main())
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)