使用CoreAudio在Swift中以编程方式创建聚合音频设备
我正在研究在OS X或iOS以及我发现CoreAudio允许您创建聚合设备。我的第一个问题是,iOS是否允许您做这个。我知道这在OS X上当然可以实现,但是我听说iOS不允许这样做。我真的很欣赏一个示例,说明如何使用swift检测多个音频输出设备并创建聚合设备。我已经在此处中进行了检查,但它不能完全回答我的问题,并且确实有基于Objective-C的答案。我将不胜感激,在此先感谢您!
I am researching creating multi-output devices on either OS X or iOS, and I found out that CoreAudio would allow you to create aggregate devices. My first question is, does iOS allow you to do this. I know that this is certainly possible on OS X, but I've heard that iOS will not allow it. I would really appreciate an example of how you would go about detecting multiple audio output devices and creating an aggregate device, all using swift. I have checked here, but it doesn't fully answer my question, and the answer it does have is based on Objective-C. I'd appreciate any help, and thanks in advance!
聚合音频设备API在iOS上不公开可用,因此您不能自己创建这些设备。
The aggregate audio device API is not publicly available on iOS, so you cannot create those devices yourself.
但是 iOS会根据您的最新情况为您创建汇总设备 * 附加的音频硬件和其他一些规则如果,您激活使用 .multiRoute
的 AVAudioSession
However iOS will create aggregate devices* for you depending on the most recently attached audio hardware and some other rules if you activate an AVAudioSession
that uses the .multiRoute
category.
由于添加或删除了音频接口而收到路由更改通知时,可以创建具有正确通道数的远程IO音频单元。我没有尝试通过 AVAudioEngine
使用多路音频,也没有尝试仅使用一部分可用通道。
When you get a route change notification due to an audio interface being added or removed, you can create a remote IO audio unit with the right number of channels. I haven’t tried using multi route audio with AVAudioEngine
nor have I tried using only a subset of the available channels.
* 它们可能是聚合设备,尽管您从未看到过它们或直接与它们交互。
* They’re probably aggregate devices, although you never see them or interact with them directly.