OpenAL 设备、缓冲区和上下文关系
我正在尝试创建一个面向对象的模型来包装 OpenAL,但在理解设备、缓冲区和上下文方面遇到了一些问题。
从我在程序员指南中看到的,有多个设备,每个设备都可以有多个上下文以及多个缓冲区。每个上下文都有一个监听器,alListener*()
函数都对活动上下文的监听器进行操作。 (这意味着如果我想更改它的侦听器,我必须首先激活另一个上下文,如果我做对了。)到目前为止,一切都很好。 但令我恼火的是,我需要将设备传递给 alcCreateContext()
函数,但不需要传递给 alGenBuffers()
。
那么这是如何运作的呢?当我打开多个设备时,缓冲区是在哪个设备上创建的?所有设备之间是否共享缓冲区?如果我关闭所有打开的设备,缓冲区会发生什么情况?
(或者我错过了什么?)
I'm trying to create an object oriented model to wrap OpenAL and have a little problem understanding the devices, buffers and contexts.
From what I can see in the Programmer's Guide, there are multiple devices, each of which can have multiple contexts as well as multiple buffers. Each context has a listener, and the alListener*()
functions all operate on the listener of the active context. (Meaning that I have to make another context active first if I wanted to change it's listener, if I got that right.) So far, so good.
What irritates me though is that I need to pass a device to the alcCreateContext()
function, but none to alGenBuffers()
.
How does this work then? When I open multiple devices, on which device are the buffers created? Are the buffers shared between all devices? What happens to the buffers if I close all open devices?
(Or is there something I missed?)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好的,问题解决了。我在此处提出了问题答案是
因此,我必须使该设备的任意上下文处于活动状态,然后创建缓冲区,然后再次使旧上下文处于活动状态。或者,如果设备不活动,则完全阻止创建缓冲区,这意味着它的上下文都不活动。
Okay, problem solved. I asked the question here and the answer was
So I will have to make an arbitrary context of that device active, then create the buffers, then make the old context active again. Or prevent creation of buffers altogether if the device is not active, meaning that none of it's contexts is active.