[alsa-devel] How to Configure Appropriate runtime->hw in ALSA Driver
What is the best way to set the *runtime->hw* parameter in ALSA driver.
From sample ALSA driver tutorial I understand we have to declare a
*structure snd_pcm_hardware* where we define all sound parameters like *STEREO/MONO, RATES* etc. Now at run time we can play sound files of different parameters. How ALSA behaves if the audio file parameters doesn't match with the *structure_snd_pcm_hardware* parameters? So if we set MONO in our structure, but play a audio file with STEREO data, does ALSA automatically configure the data according to its structure or we're going to get some kind of disruption?
If we want our driver to play any sound file, what should be the appropriate *structure snd_pcm_hardware *parameters?
Thanks -Azizul Hakim
Azizul Hakim wrote:
What is the best way to set the *runtime->hw* parameter in ALSA driver.
Set it to the capabilities of your hardware.
From sample ALSA driver tutorial I understand we have to declare a *structure snd_pcm_hardware* where we define all sound parameters like *STEREO/MONO, RATES* etc. Now at run time we can play sound files of different parameters. How ALSA behaves if the audio file parameters doesn't match with the *structure_snd_pcm_hardware* parameters?
Applications are not able to set unsupported parameter values.
However, alsa-lib can automatically convert rates/formats.
If we want our driver to play any sound file
Your driver is supposed to driver your hardware. What would you do with an unsupported format?
Regards, Clemens
participants (2)
-
Azizul Hakim
-
Clemens Ladisch