title: How to find out ALSA audio device capabilities programmatically in Linux without opening the device
body: <p>How do I find out the capabilities of ALSA devices without opening the device first? Problem is, I need to supply the parameters to the <code>snd_pcm_open()</code> function to use the test functions which to me is silly. Why ask whether this is a playback or record device if I have to tell it to the open function first? </p>
  
  <p>As an example, I would like to list all playback devices but the only way I can think of is trying to open every device I find (with <code>snd_device_name_hint()</code>) and try to open them in playback mode and if I manage to open, everything is fine.</p>
  
  <p>Problem is, with all the possible variations (sample rate, channels, etc) there would be an awful large number of open()'s I need to perform to find out the parameters.</p>