All the tutorials I can find is just telling me to jUSt UsE tHe DefAUltS (or even to use SDL or some similar library instead of my own solution), but some more advanced features such as getting HD rumble working on controllers with such features would require to connect to select devices.
So far I’ve tried:
- using library functions, but they give weird results for some reason.
- reading the contents of
/proc/asound/cards, which supposed to work and contains some very useful addresses, but not the PCM handles themselves.
Unfortunately, 99% of my search results is about how to configure ALSA to be used in Linux, which is obviously not what I need.


Generally that’d be required if you’re using the
hw:<card>[,device]device addressing, yes. You probably want to treat all device names, addresses, and handles as “opaque”, though, meaning you don’t care what the actual string looks like, and select your intended device through some other criteria.That’s where
defaultcomes from, in a way. It leaves the device choice to the user. I understood that you intend to access some other audio device, typically non-default. In that case it’s ideal if you have any uniquely identifiable device information associated with the class of device you want to use, enumerate all “sound cards” to find those matching your criteria, and “hand down” the associated PCM handle to where you need it, without needing to know what it actually looks like.Another way is to get a list of all “sound cards” of the system, and offer a legible selection of names/descriptions to the user in your application’s options to explicitly select the correct device, and have an internal mapping of that selection to it’s ASCII identifiers of PCM handles. Again, no need to know what the identifier looks like, you only need to match the user’s selection to it’s internal ID. This offloads the potentially difficult decision what device to use to your user, though, who may be even more lost being asked that question.