Programmatically Create Aggregate Audio Devices In

2019-06-28 02:16发布

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!

1条回答
Luminary・发光体
2楼-- · 2019-06-28 02:36

The aggregate audio device API is not publicly available on iOS, so you cannot create those devices yourself.

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.

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.

查看更多
登录 后发表回答