I am trying to programmatically control the sound card on Android devices, using native C. I know it's possible to interact with the cards in /dev/snd using the tinyalsa tools: tinycap, tinymix, etc. However, different phones/vendors have different card number, device number, and control configurations.
Example:
/dev/snd/pcmC0D0c
refers to Card0, Device0, capture (taking sound input, rather than output). This may be the main capture sound card on one phone but another phone's capture card, I.E. the Samsung Note 4, is:
/dev/snd/pcmC0D1c
What I've noticed is that when using apps like Voice Memo, Sounder Recorder, etc, mediaserver (which is compromised of bunch of shared libraries written in C/C++) has no problem automatically finding the correct sound card combination and enabling the correct controls in /dev/snd/control[ID_HERE]. How does it intelligently identify the correct components no matter the device?