从蓝牙输出到线路输出或扬声器的 AudioSession 输入

发布于 2024-12-18 12:23:39 字数 356 浏览 1 评论 0原文

设置音频会话后,以下代码将允许蓝牙输入。

UInt32 allowBluetoothInput = 1;
AudioSessionSetProperty (kAudioSessionProperty_OverrideCategoryEnableBluetoothInput, sizeof (allowBluetoothInput), &allowBluetoothInput);

该代码看起来只允许蓝牙输入,但是该代码还将音频输出路由到蓝牙设备(在蓝牙耳机的情况下)。当输入来自蓝牙设备时,我想将音频输出从线路输出或扬声器路由出去。我只想从蓝牙设备获取音频输入,我不想通过蓝牙输出音频。

这种行为可能吗?

Once an audio session has been set up the following code allows bluetooth input.

UInt32 allowBluetoothInput = 1;
AudioSessionSetProperty (kAudioSessionProperty_OverrideCategoryEnableBluetoothInput, sizeof (allowBluetoothInput), &allowBluetoothInput);

This code looks like it only allows bluetooth input however this code also routes the audio output to the bluetooth device (in the case of a bluetooth headset). I would like to route the audio output out of the line out or speaker when the input is coming from a bluetooth device. I just want to get audio input from a bluetooth device, I do not want to output audio via bluetooth.

Is this behaviour possible?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

调妓 2024-12-25 12:23:39

从 iOS 5 开始,这种行为是不可能的,引用苹果技术支持

蓝牙设备不是“接入”设备,因此任何其他设备
音频路由必须由用户选择,并且不能在代码中更改。要做的事
这样,您可以使用 MPVolumeView 的功能,它将
有一个额外的可见路由小部件,允许用户指定
输出路由。

核心音频邮件列表上有一个关于此问题的旧线程
功能但行为没有改变:

http://lists.apple.com/archives/ coreaudio-api/2009/Oct/msg00030.html

MPVolumeView 参考:

http://developer.apple .com/library/ios/#documentation/mediaplayer/reference/MPVolumeView_Class/Reference/Reference.html

但是 MPVolumeView 不允许您独立路由输入和输出。

as of iOS 5 this behaviour is not possible, quoting apple technical support

Bluetooth devices are not "Jacked In" devices and therefore any other
audio routing must be user picked and cannot be changed in code. To do
this, you can use the functionality of the MPVolumeView which will
have an extra routing widget viewable allowing the user to specify the
routing of the output.

There's a older thread on the Core Audio mailing list regarding this
functionality but behavior hasn't changed:

http://lists.apple.com/archives/coreaudio-api/2009/Oct/msg00030.html

MPVolumeView reference:

http://developer.apple.com/library/ios/#documentation/mediaplayer/reference/MPVolumeView_Class/Reference/Reference.html

However the MPVolumeView does not allow you to route the input and output independently.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文