aboutsummaryrefslogtreecommitdiffstats
path: root/src/audioOutputs/audioOutput_alsa.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/audioOutputs/audioOutput_alsa.c')
-rw-r--r--src/audioOutputs/audioOutput_alsa.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/audioOutputs/audioOutput_alsa.c b/src/audioOutputs/audioOutput_alsa.c
index ab6e888b2..ebe40d04c 100644
--- a/src/audioOutputs/audioOutput_alsa.c
+++ b/src/audioOutputs/audioOutput_alsa.c
@@ -194,6 +194,17 @@ configure_hw:
}
err = snd_pcm_hw_params_set_format(ad->pcmHandle, hwparams, bitformat);
+ if (err == -EINVAL && audioFormat->bits != 16) {
+ /* fall back to 16 bit, let pcm_utils.c do the conversion */
+ err = snd_pcm_hw_params_set_format(ad->pcmHandle, hwparams,
+ SND_PCM_FORMAT_S16);
+ if (err == 0) {
+ DEBUG("ALSA device \"%s\": converting %u bit to 16 bit\n",
+ ad->device, audioFormat->bits);
+ audioFormat->bits = 16;
+ }
+ }
+
if (err < 0) {
ERROR("ALSA device \"%s\" does not support %u bit audio: "
"%s\n", ad->device, audioFormat->bits, snd_strerror(-err));