Inject uplink audio in call with Snapdragon MSM8960 SoC
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.