Commit 72176db4 authored by Max Kellermann's avatar Max Kellermann

alsa: fall back to 32 bit samples if 24 is not supported

Some sound chips/drivers (e.g. Intel HDA) don't support 24 bit samples, they want to get 32 bit instead. Now that MPD's PCM library supports 32 bit, add a 32 bit fallback when 24 bit is not supported.
parent a5a15bea
...@@ -255,6 +255,14 @@ configure_hw: ...@@ -255,6 +255,14 @@ configure_hw:
} }
err = snd_pcm_hw_params_set_format(ad->pcm, hwparams, bitformat); err = snd_pcm_hw_params_set_format(ad->pcm, hwparams, bitformat);
if (err == -EINVAL && audio_format->bits == 24) {
/* fall back to 32 bit, let pcm_convert.c do the conversion */
err = snd_pcm_hw_params_set_format(ad->pcm, hwparams,
SND_PCM_FORMAT_S32);
if (err == 0)
audio_format->bits = 32;
}
if (err == -EINVAL && audio_format->bits != 16) { if (err == -EINVAL && audio_format->bits != 16) {
/* fall back to 16 bit, let pcm_convert.c do the conversion */ /* fall back to 16 bit, let pcm_convert.c do the conversion */
err = snd_pcm_hw_params_set_format(ad->pcm, hwparams, err = snd_pcm_hw_params_set_format(ad->pcm, hwparams,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment