USB Audio Routing/Mixing to ES8316

Hi,

i need some help to implement the Voice Call function of my Quectel EC25 LTE Modem to the RockPi
I have the EC25 Audio device present under /proc/asound as Android->card2

rk3399:/proc/asound # ls -la
total 0
dr-xr-xr-x 5 root root 0 2020-07-21 08:26 .
dr-xr-xr-x 274 root root 0 1970-01-01 01:00 …
lrwxrwxrwx 1 root root 5 2020-07-21 08:26 Android -> card2
dr-xr-xr-x 4 root root 0 2020-07-21 08:26 card0
dr-xr-xr-x 3 root root 0 2020-07-21 08:26 card1
dr-xr-xr-x 4 root root 0 2020-07-21 08:26 card2
-r–r--r-- 1 root root 0 2020-07-21 08:26 cards
-r–r--r-- 1 root root 0 2020-07-21 08:26 devices
-r–r--r-- 1 root root 0 2020-07-21 08:26 hwdep
-r–r--r-- 1 root root 0 2020-07-21 08:26 pcm
lrwxrwxrwx 1 root root 5 2020-07-21 08:26 rockchipes8316c -> card0
lrwxrwxrwx 1 root root 5 2020-07-21 08:26 rockchiphdmi -> card1
-r–r--r-- 1 root root 0 2020-07-21 08:26 timers
-r–r--r-- 1 root root 0 2020-07-21 08:26 version
rk3399:/proc/asound #

rk3399:/proc/asound # cat devices
2: [ 0] : control
3: [ 0- 0]: digital audio playback
4: [ 0- 0]: digital audio capture
5: [ 1] : control
6: [ 1- 0]: digital audio playback
7: [ 2] : control
8: [ 2- 0]: digital audio playback
9: [ 2- 0]: digital audio capture
33: : timer

and even under /dev/snd the pcm devices are present

rk3399:/proc/asound # cd /dev/snd/
rk3399:/dev/snd # ls -la
total 0
drwxr-xr-x 2 root root 220 2020-07-12 16:59 .
drwxr-xr-x 19 root root 1840 2020-07-12 16:59 …
crw-rw---- 1 system audio 116, 2 2020-07-12 16:59 controlC0
crw-rw---- 1 system audio 116, 5 2020-07-12 16:59 controlC1
crw-rw---- 1 system audio 116, 7 2020-07-12 16:59 controlC2
crw-rw---- 1 system audio 116, 4 2020-07-12 16:59 pcmC0D0c
crw-rw---- 1 system audio 116, 3 2020-07-12 16:59 pcmC0D0p
crw-rw---- 1 system audio 116, 6 2020-07-12 16:59 pcmC1D0p
crw-rw---- 1 system audio 116, 9 2020-07-12 16:59 pcmC2D0c
crw-rw---- 1 system audio 116, 8 2020-07-12 16:59 pcmC2D0p
crw-rw---- 1 system audio 116, 33 2020-07-12 16:59 timer

i´m not familiar with audio under Linux/Android and all i´ve read is that you could create a asound.conf
File but due we use tinyalsa on the Rockpi how can i archive mixing or routing from Card2 to the ES8316 Codec to listen and send Voice via Mic to the Device (card2)

i i do

tinyplay audio.wav -D x -d 0 -c 1 -r 8000
it plays, but i hear none on device or on the MobilePhone

any Guide / Help or pushing to the right Track would be appreciated

Regards,

Brian

I don’t understand your question.
What is the current state? So play and record it through card2, right?
Do you want:
ES8316 -record-> Voice -play-> Card2?

Hi Lili,

i would like to Route/MIX Out of Card2(Modem Audio PCM Out Device) > ES8316 > Speaker/Headphone
and from MIC/Headphone-MIC > ES8316 > Card2(Modem Audio PCM In Device)

Hope that make it more clear

I see.

The average Android(Rockchip) Audio HAL doesn’t meet your needs.

  1. You need to record it from Card2 and then play it to ES8316.
  2. We need to record it from es8316 and play it to card2.

Audio Source:

  • ES8316 MIC
  • Card2 In

You need to define two different sources, or define one yourself:
https://developer.android.com/reference/android/media/MediaRecorder.AudioSource

Audio Output"

  • ES8316 HP
  • Card2 Output

You need to configure your routing strategy:
https://source.android.com/devices/audio/implement-policy

So i need some sort of wrapper detecting android.telephony.TelephonyManager CALL_STATE_*
and then doing my MediaRecorder stuff and direct play the audio from buffer.
I will give that a shot