https://source.codeaurora.org/quic/la//kernel/msm/tree/sound/soc/msm/msm-pcm-routing.c?id=4c1e76a598cfdd12b050c2e74644c88f2fbaadab
高通的音频驱动,提供了一个ALSA控制借口
Incall_Music Audio Mixer
用来控制 CPU的 DAI 接口 MultiMedia1 和 MultiMedia2 (对应于 ALSA 设备 pcmC0D0p 和 pcmC0D1p).
可以用下面的命令来给电话的对端播放一个音频文件
tinymix 'Incall_Music Audio Mixer MultiMedia1' 1 tinymix 'Voice Tx Device Mute' 1 tinyplay /sdcard/xiao.wav
测试机器:
红米Note3 全网通 (骁龙650)
红米Note5A (骁龙425)
红米4X (骁龙435)
只是
tinymix 'Voice Tx Device Mute' 1
运行会报 Error: invalid value
参考资料:
https://stackoverflow.com/questions/15204570/inject-uplink-audio-in-call-with-snapdragon-msm8960-soc
https://bbs.pediy.com/thread-223672.htm
https://stackoverflow.com/questions/14432521/background-music-for-call
https://android.googlesource.com/platform/hardware/qcom/audio/+/master/legacy/alsa_sound/AudioHardwareALSA.h
#define INCALLMUSIC_KEY "incall_music_enabled"
https://android.googlesource.com/platform/hardware/qcom/audio/+/master/hal/voice_extn/voice_extn.h
#ifdef INCALL_MUSIC_ENABLED int voice_extn_check_and_set_incall_music_usecase(struct audio_device *adev, struct stream_out *out); #else static int voice_extn_check_and_set_incall_music_usecase(struct audio_device *adev __unused, struct stream_out *out __unused) { return -ENOSYS; } #endif
/dev/snd 下控制文件
. comprC0D32 hwC0D104 hwC0D125 hwC0D21 hwC0D30 hwC0D40 hwC0D49 pcmC0D0c pcmC0D13c pcmC0D1c pcmC0D26c pcmC0D35c pcmC0D41c pcmC0D49p timer .. comprC0D43 hwC0D11 hwC0D126 hwC0D24 hwC0D3017 hwC0D41 hwC0D55 pcmC0D0p pcmC0D13p pcmC0D1p pcmC0D27c pcmC0D36p pcmC0D41p pcmC0D4p comprC0D15 comprC0D44 hwC0D12 hwC0D13 hwC0D25 hwC0D3033 hwC0D42 hwC0D56 pcmC0D10c pcmC0D14c pcmC0D20c pcmC0D27p pcmC0D37c pcmC0D42c pcmC0D5c comprC0D16 comprC0D8 hwC0D120 hwC0D14 hwC0D26 hwC0D32 hwC0D43 hwC0D71 pcmC0D10p pcmC0D17c pcmC0D21c pcmC0D2c pcmC0D38c pcmC0D42p pcmC0D5p comprC0D28 controlC0 hwC0D121 hwC0D15 hwC0D27 hwC0D33 hwC0D44 hwC0D72 pcmC0D11c pcmC0D17p pcmC0D22c pcmC0D2p pcmC0D39p pcmC0D45p pcmC0D6p comprC0D29 hwC0D10 hwC0D122 hwC0D16 hwC0D28 hwC0D35 hwC0D45 hwC0D87 pcmC0D11p pcmC0D18p pcmC0D23c pcmC0D33c pcmC0D3c pcmC0D46p pcmC0D7c comprC0D30 hwC0D1000 hwC0D123 hwC0D2 hwC0D29 hwC0D39 hwC0D46 hwC0D88 pcmC0D12c pcmC0D19c pcmC0D24c pcmC0D33p pcmC0D3p pcmC0D47p pcmC0D9c comprC0D31 hwC0D103 hwC0D124 hwC0D20 hwC0D3 hwC0D4 hwC0D48 hwC0D9 pcmC0D12p pcmC0D19p pcmC0D25c pcmC0D34c pcmC0D40c pcmC0D48p pcmC0D9p