[alsa-devel] Getting the actual HW sample rate

Raymond Toy rtoy at google.com
Wed Sep 7 23:24:07 CEST 2011


I know that
http://www.mail-archive.com/alsa-user@lists.sourceforge.net/msg24794.htmlgives
code to get the available sample rates (among other things).  However,
my quest is to get the actual HW sample rate.  This code is quite helpful.
 I know that if a sound is already playing, I can look at
/proc/asound/card0/pcm0p/sub0/hw_params to see what the HW sample rate is.
 But is there a way to get this using ALSA?

In my application, we want to know the actual HW rate so that we can do the
sample rate conversion ourselves upfront and therefore we want to avoid yet
another sample rate conversion when playing out the audio.  (The application
can synthesize audio and we can select the sample rate for the synthesis.)

Thanks,

Ray


More information about the Alsa-devel mailing list