在 iPhone 应用程序中同时使用多个音频路径输出声音?
我现在正在 AVAudioSession 中玩弄音频路由,我想知道是否可以同时将声音输出到多个音频路由,即从扬声器播放的声音和在耳机中播放的不同声音?理想情况下,我希望能够同时通过底座连接器(使用 3.5 毫米插孔适配器)和耳机插孔播放单独的声音,因此如果有人能告诉我这是否真的可行,那就太好了帮助。
谢谢
I'm playing around with audio routes in AVAudioSession at the moment and I'm wondering whether it is possible to output sound to multiple audio routes at the same time i.e. a sound playing from the speaker and a different sound playing in the headphones? Ideally I'd like to be able to play separate sounds via a dock connector (using a 3.5mm jack adapter) and the headphone jack at the same time so if someone could tell me whether or not this is actually possible that would be a great help.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为三年前你写这篇文章时这是不可能的,但现在可以通过耳机插孔播放一种声音,通过连接到底座连接器的 USB 音频接口播放另一种声音。此WWDC 演示文稿将引导您完成整个过程并提供示例代码。
我认为不可能通过耳机插孔和扬声器播放单独的声音,因为 AVAudioSessionRouteDescription 一次仅显示这些内置输出端口之一。您必须通过 USB 添加第二个音频接口,这会向 AVAudioSessionRouteDescription 添加第二个输出端口。我现在正在使用 Roland Duo-Capture mk2 进行测试,它正在工作。
I don't think it was possible three years ago when you wrote this, but it is possible now to play one sound through the headphone jack and another through a USB audio interface connected to the dock connector. This WWDC presentation walks you through it and provides sample code.
I don't think it's possible to play separate sounds through the headphone jack and the speaker because the AVAudioSessionRouteDescription only shows one of these built-in output ports at a time. You'd have to add a second audio interface via USB, which adds a second output port to the AVAudioSessionRouteDescription. I'm testing with a Roland Duo-Capture mk2 right now and it's working.