diff options
author | 2011-05-21 13:20:26 +0200 | |
---|---|---|
committer | 2011-05-21 13:20:26 +0200 | |
commit | 0d774c5f9e437ba692014ec804dde07895c98435 (patch) | |
tree | 3ae961ebf815c53d54591b622dc3426d41ab0eea /plugins | |
parent | dbeaad223df623cf180063f184276a1d3d536fcd (diff) |
fixed alsa setformat channels fallback
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/alsa/alsa.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/plugins/alsa/alsa.c b/plugins/alsa/alsa.c index db9e97f7..25573f5b 100644 --- a/plugins/alsa/alsa.c +++ b/plugins/alsa/alsa.c @@ -244,13 +244,19 @@ retry: plugin.fmt.samplerate = val; trace ("chosen samplerate: %d Hz\n", val); + int nchan; + snd_pcm_hw_params_get_channels (hw_params, &nchan); + if ((err = snd_pcm_hw_params_set_channels (audio, hw_params, plugin.fmt.channels)) < 0) { - fprintf (stderr, "cannot set channel count (%s)\n", - snd_strerror (err)); - goto error; + fprintf (stderr, "cannot set channel count (%s), trying to set channels=%d\n", + snd_strerror (err), nchan); + if ((err = snd_pcm_hw_params_set_channels (audio, hw_params, nchan)) < 0) { + fprintf (stderr, "cannot set channel count (%s)\n", + snd_strerror (err)); + goto error; + } } - int nchan; snd_pcm_hw_params_get_channels (hw_params, &nchan); trace ("alsa channels: %d\n", nchan); @@ -269,12 +275,6 @@ retry: fprintf (stderr, "cannot set parameters (%s)\n", snd_strerror (err)); goto error; - -// if (plugin.fmt.channels > 2 && plugin.fmt.samplerate >= 96000) { -// plugin.fmt.samplerate = 48000; -// fprintf (stderr, "falling back to 48000KHz\n"); -// goto retry; -// } } plugin.fmt.is_float = 0; @@ -472,7 +472,7 @@ palsa_setformat (ddb_waveformat_t *fmt) { snd_pcm_drop (audio); int ret = palsa_set_hw_params (fmt); if (ret < 0) { - trace ("palsa_change_rate: impossible to set requested format\n"); + trace ("palsa_setformat: impossible to set requested format\n"); // even if it failed -- copy the format memcpy (&plugin.fmt, fmt, sizeof (ddb_waveformat_t)); UNLOCK; |