如何捕获或改导航语音流 [英] How to capture or reroute navigation voice stream

查看:183
本文介绍了如何捕获或改导航语音流的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有Android上使用谷歌导航与蓝牙设备时出了问题。导航发送用于通过A2DP流转由转动的指示音频。我有一个摩托罗拉T605蓝牙车载套件,并支持HFP和A2DP。我经常只听老式汽车收音机虽然。在这种情况下我,因为我的生活A2DP流被发送到无线AUX输入,但我听广播,而不是永远不会听到转由转动方向。我的应用程序有一个特点,它读出短信给我。我有它设置,使你可以选择你要使用此流。我使用AudioManager.STREAM_VOICE_CALL,因为它使用的T605专用的独立的扬声器preFER。

There is a problem when using Google Navigation on Android with a Bluetooth device. Navigation sends the audio for the turn-by-turn instructions over the A2DP stream. I have a Motorola T605 Bluetooth car kit and it supports HFP and A2DP. I often just listen to the old fashioned car radio though. In this scenario I never hear turn-by-turn directions because my live A2DP stream is being sent to the radio AUX input but I am listening to the radio instead. My app has a feature where it reads out SMS messages to me. I have it set up so you can pick the stream you want to use for this. I prefer using AudioManager.STREAM_VOICE_CALL since it uses a dedicated separate speaker on the T605.

我已经调查了一些方法来处理这​​个问题:

I have looked into a few ways to handle this:

1)重新路由通知蓝牙SCO,而不是A2DP。我还没资助的方式来做到这一点。我能送我创造超过这条道路TTS消息和它的伟大工程(我已经内置到我的应用程序短信阅读器)。我试图激活SCO而是转由转动的指示流移动到手机内置扬声器,而不是语音呼叫流就像我preFER。

1) Reroute notifications to Bluetooth SCO instead of A2DP. I have not fund a way to do this. I am able to send TTS messages I create over this path and it works great (I have an SMS reader built into my app). I tried activating SCO but the turn-by-turn instructions stream moves to the phone internal speaker instead of the voice call stream like I would prefer.

2)捕获的导航信息和回声回了上海合作组织的道路。我不能找到一个办法拦截或者虽然捕获导航流。难道谷歌导航使用TTS引擎或自己的方法来创建语音输出?这将是巨大的,刚刚获得文本字符串的方向,因为我可以很容易地发送给TTS引擎,并将其路由,我想就像我短信字符串做。

2) Capture the navigation messages and echo them back over the SCO path. I can't find a way to intercept or capture the navigation stream though. Does Google Navigation use the TTS engine or its own methods to create the voice output? It would be great to just get the directions in a text string since I could easily send that to the TTS engine and route it where I want like I do with SMS strings.

您可以在这里看到我的应用程序源: HTTP://$c$c.google .COM / p / a2dpvolume /

You can see my app source here: http://code.google.com/p/a2dpvolume/

有什么想法?

推荐答案

不幸的是,我认为你是苏尔当谈到重新路由导航消息BT SCO。我希望导航应用请使用TTS或通知流式播放的消息,以及这两个流类型遵循MEDIA路由策略(适用于通知至少是典型的真没有有效的语音呼叫时)。

Unfortunately I think you're SOOL when it comes to rerouting the navigation messages to BT SCO. I would expect the navigation app to use either the TTS or NOTIFICATION stream type to play the messages, and both of those stream types follow the MEDIA routing strategy (for NOTIFICATIONs that is at least typically true when there's no active voice call).

虽然该行为是由每个供应商来决定,我的猜测是,你会发现,在随后的媒体策略路由永远不会正在进行的语音通话过程中发送到BT SCO,但大多数实现了流被路由到BT SCO。

Although the behavior is up to each vendor to decide, my guess is that you'll find that in most implementations streams that follow the MEDIA routing strategy won't ever be routed to BT SCO, except during an ongoing voice call that is routed to BT SCO.

您可以在路由方面做的最好的就是路由强制扬声器,或为什么,但A2DP(这意味着如果一个连接有线耳机,否则扬声器)。

The best you could do in terms of routing is to force the routing to the loudspeaker, or to "anything but A2DP" (which means wired headset if one is attached, or the loudspeaker otherwise).

下面是你如何能做到这一点(我还没有证实这一工程每一个电话就在那里):

Here's how you could do that (I haven't verified that this works on every phone out there):

Class audioSystemClass = Class.forName("android.media.AudioSystem");
Method setForceUse = audioSystemClass.getMethod("setForceUse",
    int.class,
    int.class);
// 1 == FOR_MEDIA, 10 == FORCE_NO_BT_A2DP (FORCE_SPEAKER would be 1).
setForceUse.invoke(null, 1, 10);

这篇关于如何捕获或改导航语音流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆