How do I find the "ASCII identifier of the PCM handle" for ALSA?

https://lemmy.world/post/43491439

How do I find the "ASCII identifier of the PCM handle" for ALSA? - Lemmy.World

There’s this snd_pcm_open() function, and one of its arguments takes “ASCII identifier of the PCM handle”. How can I get it for each individual devices?

I’d have a look at the aplay.c implementation for listing PCM device names (-L), pcm_list().

It’s basically using snd_device_name_hint(-1, “pcm”, &hints) and snd_device_name_get_hint() calls to discover the PCM device names.