OpenAL中如何设置通道增益?
我尝试了一下
alBufferf (myChannelId, AL_MAX_GAIN (and AL_GAIN), volumeValue);
,得到了错误 0xA002。
I tried
alBufferf (myChannelId, AL_MAX_GAIN (and AL_GAIN), volumeValue);
and got error 0xA002.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
正如 Isaac 所说,您可能希望在源上设置增益:
为了避免将来收到神秘的错误代码,您应该养成在您认为可能失败的调用/您尝试调试的调用之后轮询错误的习惯。
这样,您就会立即知道“0xA002”是“AL_INVALID_ENUM”。
要使用 OpenAL 执行此操作,您可以调用“alGetError()”,它会清除并返回最近的错误;
您需要编写类似的内容来获取错误代码并返回/打印字符串
您可以在 OpenAL 程序员指南 。
例如,在第 39 页,您可以看到 alSourcef 上的 AL_INVALID_ENUM 表示“指定的参数无效”。
As Isaac has said, you probably want to be setting gain on your a sources:
To avoid recieving mysterious error codes in future, you should get into the habit of polling for errors after calls you think may fail / calls you are trying to debug.
This way, you'd know immediately that "0xA002" is "AL_INVALID_ENUM".
To do this with OpenAL you call "alGetError()" which clears and returns the most recent error;
You'll need to write something like this to take an error code and return/print a string
You can lookup exactly what the error code means for a specific function call in OpenAL Programmer's Guide .
For example, on page 39 you can see AL_INVALID_ENUM on alSourcef means "The specified parameter is not valid".
0xA002 是 Linux 中的非法枚举错误。
你明白了,因为不可能修改缓冲器的增益。没有这样的事。
您可以做的是将 AL_GAIN 属性设置为侦听器(将其应用于当前上下文中的所有源)或特定源。
0xA002 is an ILLEGAL ENUM ERROR in linux.
You got that because it's impossible to modify the gain of a buffer. There's no such thing.
What you can do is set the AL_GAIN attribute either to the listener (applying it to all sources in the current context) or to a particular source.