[alsa-devel] snd_pcm_hw_rule_noresample

Clemens Ladisch clemens at ladisch.de
Tue Sep 20 10:48:34 CEST 2011


Raymond Yau wrote:
> ALSA: pcm: add snd_pcm_hw_rule_noresample()
> ...
> 
> ymfpci and emu10k1 have SNDRV_PCM_RATE_CONTINUOUS and support 8000Hz to 48000Hz
> 
> after this patch and if application using
> snd_pcm_hw_params_set_rate_resample(,pcm , params ,0)
> 
> why the supported rate is only 48000Hz ?

Because these cards run at 48 kHz and resample anything else.  That
the resampler is implemented in hardware does not make a conceptual
difference, and just means that the resampler has low quality.

> but snd_pcm_hw_params_get_rate_min() is still 8000Hz

This should not happen.  I'd guess the rules engine hasn't noticed
that some parameters affected by the new rule need to change.

Please try the patch below.  But there might be drivers where other
parameters are affected by SND_PCM_HW_PARAMS_NORESAMPLE, so I guess
all parameter bits need to be set.

> This patch won't affect the accuracy of the playback position of the ymfpci

Why should it?


Regards,
Clemens


--- alsa-lib/src/pcm/pcm.c
+++ alsa-lib/src/pcm/pcm.c
@@ -4176,6 +4176,7 @@ int snd_pcm_hw_params_set_rate_resample(snd_pcm_t *pcm, snd_pcm_hw_params_t *par
 		params->flags |= SND_PCM_HW_PARAMS_NORESAMPLE;
 	else
 		params->flags &= ~SND_PCM_HW_PARAMS_NORESAMPLE;
+	params->rmask |= 1 << SNDRV_PCM_HW_PARAM_RATE;
 	return snd_pcm_hw_refine(pcm, params);
 }
 


More information about the Alsa-devel mailing list