iOS OpenAL 支持定向声音还是仅支持位置声音?
对于我正在编写的 3D iPad 应用程序,我希望音频在单个虚拟听众转向/远离声源时增大/减小音量。听者始终保持静止。听者只能旋转。声音总是静止的。声音充满用户周围的方向范围。这些声音与听者的距离都是相等的。
我认为声音类似于 3D 图形中的光源。对于每个声音,都有一个从听者指向该声源的向量。听者有一个传出方向向量。我想通过收听者向量和每个音频源向量的点积来对每个音频源的贡献进行加权。因此,当听者的“头部”围绕声音贡献方向旋转时,就会发生变化。
我所描述的内容有多少可以由 OpenAL 处理,有多少需要我自己编写?
谢谢,
道格
For the 3D iPad app I am writing I want audio to increase/decrease in volume as a single virtual listener turns towards/away-from sound sources. The listener is always stationary. The listener can only rotate. The sounds are always stationary. The sounds fill a sphere of directions around the user. The sounds are all of equal distance from the listener.
I think of the sounds as analogous to light sources in 3D graphics. For each sound there is a vector pointing from the listener to that sound source. The listener has an outgoing directional vector. I want to weight the contribution of each audio source by the dotProduct of the listener vector and each of the audio source vectors. So as the listener's "head" rotates around sound contributions change directionally.
How much of what I describe can be handled by OpenAL and how much do I need to write myself?
Thanks,
Doug
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,您可以在 OpenAL 中执行此操作。事实上你可以做得更好!通过点积,您可以在平行时获得最大音量,在垂直时获得零音量,使用 OpenAL,您可以定义来自声源的声锥。
在源上,您需要将 AL_CONE_INNER_ANGLE 设置为小于 AL_CONE_OUTER_ANGLE,以便在内锥角内获得完整音量,并在外锥角外衰减为零。当然,您还需要设置 AL_DIRECTION。
已经有一段时间了,我不确定您是否可以设置侦听器的锥体/方向,但这并不重要,因为无论如何您的所有对象都是静态的,您可以简单地旋转源的方向,以模拟一下:D
Yes, you can do this in OpenAL. In fact you can do better! With the dot-product you would simply get full volume when they are parallel and zero when they are perpendicular, using OpenAL you can define a cone of sound coming from your source.
On the source you need to set the AL_CONE_INNER_ANGLE to be smaller than the AL_CONE_OUTER_ANGLE so you get full volume within the inner cone angle and it attenuates to zero outside the outer cone angle. You also need to set the AL_DIRECTION of course.
It's been a while, and I'm not sure if you can set the cone/direction of the listener, but that doesn't really matter since all your objects are static anyway, you can simply rotate the direction of the sources instead, to simulate it :D