Mercurial > audlegacy-plugins
changeset 3197:d2e01ca06335
alsa-ng: Work around *broken* drivers, such as snd-au88xx.
author | William Pitcock <nenolod@atheme.org> |
---|---|
date | Mon, 13 Jul 2009 15:37:47 -0500 |
parents | 0f7180e3b163 |
children | 83b1a4e5f453 |
files | src/alsa-ng/alsa-core.c |
diffstat | 1 files changed, 9 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/alsa-ng/alsa-core.c Sun Jul 12 08:30:13 2009 -0500 +++ b/src/alsa-ng/alsa-core.c Mon Jul 13 15:37:47 2009 -0500 @@ -308,6 +308,7 @@ gint err, bitwidth, ringbuf_size, buf_size; snd_pcm_format_t afmt; snd_pcm_hw_params_t *hwparams = NULL; + guint rate_ = rate; afmt = alsaplug_format_convert(fmt); if (afmt == SND_PCM_FORMAT_UNKNOWN) @@ -331,7 +332,14 @@ snd_pcm_hw_params_set_access(pcm_handle, hwparams, SND_PCM_ACCESS_RW_INTERLEAVED); snd_pcm_hw_params_set_format(pcm_handle, hwparams, afmt); snd_pcm_hw_params_set_channels(pcm_handle, hwparams, nch); - snd_pcm_hw_params_set_rate(pcm_handle, hwparams, rate, 0); + snd_pcm_hw_params_set_rate_resample(pcm_handle, hwparams, 1); + + snd_pcm_hw_params_set_rate_near(pcm_handle, hwparams, &rate_, 0); + if (rate_ != rate) + { + _ERROR("sample rate %d is not supported (got %d)", rate, rate_); + return -1; + } err = snd_pcm_hw_params(pcm_handle, hwparams); if (err < 0)