Handle several USB microphone simultenaously

Dear community, Dear @tenk.wang and @jasonl

I’ve a project that requires to simultenaously manage several USB microphones on a VIM3. I’m planning to power the boad with a self-build AOSP (based on Khadas AOSP tree).
When I plug the first USB microphone, I can list it thanks to AudioManager.getDevices() function, then, if I plug a second USB microphopne, the first USB microphone is replaced by the second one wghen I call to AudioManager.getDevices() function.
I can understand that this behavior make sense for most user but, in my case, I would like AOSP to exposes both USB microphones.
I guess this could be change by modifying audio policies (located in /vendor/etc/…) but, honestly, if you have any nudge/lead to find a how to.

Thanks for your help

maybe you can try to find a apk which can support two usb microphone

Hi @jasonl, thanks for your suggestion. However, I don’t think it can be address at application layer. Let me clarify my point :

  • From application layer, I can list/access several USB camera at the same time
  • From application layer, I can list/access several USB audio sink at the same time
  • From application layer, I cannot list/access several USB audio source (microphone) at the same time. I mean that only the last plugged USB device is accessible.

That’s why I guess that, AOSP automatically exposes only one microphone at a time… Please correct me if I’m mistaken or if you’ve any other clue…

Thanks

Hi @VulcainMan ,about the usb mic problem,I track the aosp code and make the following modifications to support two usb mic,just AudioManager.getDevices() can list two usb mic devices

the result by call AudioManager.getDevices()

If you want to know more,you can trace the following file
1.frameworks/av/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
2.frameworks/basr/services/usb/java/com/android/server/usb/UsbAlsaManager.java

Hi @jasonl,

Wonderful, thanks for your help, I’ll have a look on that ASAP and let you know if it fix my issue as expected.

Best regards