OpenAL输出到多个设备(Linux)

时间:2021-03-20 20:53:07

I'm developing a Linux application on a computer with two audio cards and I want to use both at once in OpenAL, each in its own context. When I call OpenAL's enumeration extension, alcGetString(NULL, ALC_DEVICE_SPECIFIER), to get a list of possible output devices, the list only consists of 'ALSA Software' and 'OSS Software'. I know these are just OpenAL's view of software devices so when I choose either of these, OpenAL just outputs audio to the default device configured in ALSA or OSS. I'm not even sure if it's possible, but is there a way to direct the audio output of an OpenAL context to a specific device? This way I could create two contexts, one for each device, and send separate audio to each.

我在一台有两张声卡的电脑上开发一个Linux应用程序,我想在OpenAL中同时使用它们,每个都在它自己的上下文中。当我调用OpenAL的枚举扩展,alcGetString(NULL, ALC_DEVICE_SPECIFIER),获取可能的输出设备列表时,列表只包含“ALSA软件”和“OSS软件”。我知道这些只是OpenAL的软件设备视图,所以当我选择其中之一时,OpenAL会将音频输出到在ALSA或OSS中配置的默认设备。我甚至不确定这是否可能,但是有没有一种方法可以将OpenAL上下文的音频输出指向特定的设备?通过这种方式,我可以创建两个上下文,一个用于每个设备,并向每个设备发送单独的音频。

Thanks, -Al

谢谢,状态”

1 个解决方案

#1


4  

I did some testing today and found the answer. Apparently, you have to call alcGetString with the argument ALC_ALL_DEVICES_SPECIFIER to get the complete listing. A simple enough change, but OpenAL's documentation on this functionality is at best cloudy and at worst misleading. See Section 9.5 of the OpenAL 1.1 Specification and the subsection "Creative Labs' Extenstions to OpenAL"->"Enumerate All Extension"->"Retrieving device names" of the OpenAL Programmer's Guide to see what I mean.

我今天做了一些测试,找到了答案。显然,您必须用参数ALC_ALL_DEVICES_SPECIFIER调用alcGetString来获得完整的列表。一个足够简单的更改,但是OpenAL关于这个功能的文档充其量是模糊的,最糟糕的是具有误导性。参见OpenAL 1.1规范的9.5节和“Creative Labs’Extenstions to OpenAL”—>“枚举所有扩展”—>“检索设备名称”的小节,了解我的意思。

OpenAL documentation: http://connect.creativelabs.com/openal/Documentation/Forms/AllItems.aspx

OpenAL文档:http://connect.creativelabs.com/openal/Documentation/Forms/AllItems.aspx

#1


4  

I did some testing today and found the answer. Apparently, you have to call alcGetString with the argument ALC_ALL_DEVICES_SPECIFIER to get the complete listing. A simple enough change, but OpenAL's documentation on this functionality is at best cloudy and at worst misleading. See Section 9.5 of the OpenAL 1.1 Specification and the subsection "Creative Labs' Extenstions to OpenAL"->"Enumerate All Extension"->"Retrieving device names" of the OpenAL Programmer's Guide to see what I mean.

我今天做了一些测试,找到了答案。显然,您必须用参数ALC_ALL_DEVICES_SPECIFIER调用alcGetString来获得完整的列表。一个足够简单的更改,但是OpenAL关于这个功能的文档充其量是模糊的,最糟糕的是具有误导性。参见OpenAL 1.1规范的9.5节和“Creative Labs’Extenstions to OpenAL”—>“枚举所有扩展”—>“检索设备名称”的小节,了解我的意思。

OpenAL documentation: http://connect.creativelabs.com/openal/Documentation/Forms/AllItems.aspx

OpenAL文档:http://connect.creativelabs.com/openal/Documentation/Forms/AllItems.aspx