aboutsummaryrefslogtreecommitdiffstats
path: root/src/output
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-03-02 16:41:38 +0100
committerMax Kellermann <max@duempel.org>2009-03-02 16:41:38 +0100
commit72176db429c0341c041a95c5daa50de7aece2da2 (patch)
tree3b5ef26f26d10985624f23dff1122e5dcc98c6b4 /src/output
parenta5a15beac2eedeccbb11e4f2f28878f5df00c38b (diff)
downloadmpd-72176db429c0341c041a95c5daa50de7aece2da2.tar.gz
mpd-72176db429c0341c041a95c5daa50de7aece2da2.tar.xz
mpd-72176db429c0341c041a95c5daa50de7aece2da2.zip
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.
Diffstat (limited to '')
-rw-r--r--src/output/alsa_plugin.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/output/alsa_plugin.c b/src/output/alsa_plugin.c
index b3f20df42..510f3761b 100644
--- a/src/output/alsa_plugin.c
+++ b/src/output/alsa_plugin.c
@@ -255,6 +255,14 @@ configure_hw:
}
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) {
/* fall back to 16 bit, let pcm_convert.c do the conversion */
err = snd_pcm_hw_params_set_format(ad->pcm, hwparams,