本文介绍了使用 Snapdragon MSM8960 SoC 在通话中注入上行音频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一段时间以来,我一直在研究特定于 MSM8960 的这个主题.我查看了 google 的 ALSA 硬件模块.Michael 在 帖子 中的回答确实提到 MSM8960 支持硬件和设备驱动程序"级别的通话中上行链路音频注入.是指这个ALSA模块的级别吗?

从手机上的 ALSA 配置文件来看,通话中的语音播放似乎是通过 /dev/snd/pcmC0D0p 完成的,或者至少符合 ALSA 范式.是否可以使用文件描述符之一来达到目的?我确实在 libalsa-intf 中看到了一些有趣的 USE_CASE 定义.

解决方案

MSM8960 提供了一个名为 Incall_Music Audio Mixer 的 ALSA 控件,您可以将 CPU DAI MultiMedia1 连接到该控件和 MultiMedia2(分别对应于 ALSA 设备 pcmC0D0ppcmC0D1p).(参见 msmt代码源代码

因此,如果您正在运行语音呼叫并希望通过 pcmC0D0p 在上行链路上播放一些音频,您可以通过 adb shell 执行此操作(假设您有根访问):

amix 'Incall_Music Audio Mixer MultiMedia1' 1aplay -Dhw:0,0 mono_8khz_audio.wav


更优雅的方法是在设备的 UCM 文件 (snd_soc_msm_blah_blah..) 中创建一个新用例,您可以在其中在新修改器的启用序列中添加 incall 音乐路由:

'Incall_Music Audio Mixer MultiMedia1':1:1

(记得在禁用序列中将其关闭).
对于能够在您的自定义 ROM 上使用此功能的应用程序,您还必须在音频 HAL 和多媒体框架中进行一些其他更改,以便在呼叫处于活动状态时为所需的流类型选择新的 UCM 设置.
由于版权原因,我无法详细介绍其余的实现,因此我将其作为练习留给有兴趣自己解决的人.

I've been investigating on this topic specific to MSM8960 for some time. I looked into the ALSA hardware module from google. Michael's answer in the post did mention that MSM8960 supported the in-call uplink audio injection at "Hardware and Device Driver" level. Did it refer to the level at this ALSA module?

From the ALSA config file on the phone, it seems the in call voice playback is done through /dev/snd/pcmC0D0p, or at least comply with the ALSA paradigm. Is it possible to play with one of the file descriptor to achieve the purpose? I do see some interesting USE_CASE definition in libalsa-intf.

解决方案

The MSM8960 provides an ALSA control named Incall_Music Audio Mixer, to which you can connect CPU DAIs MultiMedia1 and MultiMedia2 (which would correspond to ALSA devices pcmC0D0p and pcmC0D1p, respectively). (see the msm-pcm-routing source code)

So if you had a voice call running and wanted to play some audio on the uplink through pcmC0D0p you could do this through adb shell (assuming that you've got root access):

amix 'Incall_Music Audio Mixer MultiMedia1' 1
aplay -Dhw:0,0 mono_8khz_audio.wav


The more elegant way would be to create a new use-case in the device's UCM file (snd_soc_msm_blah_blah..) where you add the incall music routing in the enable-sequence of your new modifer:

'Incall_Music Audio Mixer MultiMedia1':1:1

(remember to turn it off in the disable-sequence).
For apps to be able to use this functionality on your custom ROM you'd also have to make some other changes in the audio HAL and multimedia framework, so that your new UCM setting is selected for the desired stream types when a call is active.
Due to copyright reasons I can't go into any detail about the rest of the implementation, so I'll leave it as an exercise for those interested to figure it out for themselves.

这篇关于使用 Snapdragon MSM8960 SoC 在通话中注入上行音频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-24 16:33