OpenAL的设备,缓冲器和上下文关系 [英] OpenAL device, buffer and context relationship

查看:124
本文介绍了OpenAL的设备,缓冲器和上下文关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个面向对象的模型来包装的OpenAL,有一个小问题,了解设备,缓冲区和上下文。

I'm trying to create an object oriented model to wrap OpenAL and have a little problem understanding the devices, buffers and contexts.

据我的程序员手册中看到,有多个设备,每个可以有多个环境以及多个缓冲区。每个环境都有一个侦听器,以及 alListener *()函数都在活动范围内的监听器操作。 (意思是我必须做出另一个上下文活跃第一,如果我想改变它的听众,如果我说对了。)到目前为止,一切都很好。
是什么让我恼火,虽然是我需要的设备传递给 alcCreateContext()的功能,但没有到 alGenBuffers()

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?)

推荐答案

好了,问题解决了。我问的问题这里和答案是

Okay, problem solved. I asked the question here and the answer was

所有A *功能(而不是ALC *函数)对当前工作
  上下文。因此,alGenBuffer电话将在目前的情况下操作,
  创建属于上下文的设备缓冲区(上下文只能有
  一项的设备)。

All the al* functions (rather than alc* functions) operate on the current context. So, alGenBuffer calls will operate on the current context and create Buffers that belong to the Context's Device (a Context can only have one Device).

在一个设备上创建缓冲区是不适用于其他设备。

Buffers created on one Device are not available on another Device.

设备的缓冲器将(可能)会自动当你调用销毁
  alcCloseDevice。

A Device's Buffers will (probably) be automatically destroyed when you call alcCloseDevice.

因此​​,我将不得不做出这样的设备的活动的任意范围内,然后再创建缓冲区,然后做旧背景下再度活跃。或prevent创建缓冲区共如果设备不活跃的,这意味着没有它的上下文是活动的。

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.

这篇关于OpenAL的设备,缓冲器和上下文关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆