[alsa-devel] [PATCH] PCM: Support up to 384kHz sample rate.

Takashi Iwai tiwai at suse.de
Wed Nov 11 18:09:29 CET 2015


On Wed, 11 Nov 2015 17:13:56 +0100,
Peter Rosin wrote:
> 
> From: Peter Rosin <peda at axentia.se>
> 
> Some codecs support it in the kernel (e.g. pcm512x).
> 
> Signed-off-by: Peter Rosin <peda at axentia.se>
> ---
>  include/pcm_plugin.h |    2 +-
>  src/pcm/pcm_simple.c |    4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> I'm not sure it really is this simple, but the things I'm using start to
> work...

I guess this would break if a linear rate plugin is used, since it may
overflow.  Actually, for other rate plugins in alsa-plugins, they set
unlimited (both zero).  That said, the defines there are essentially
only for the linear rate plugin.

And, looking at the code now, I believe the usage of assert() in
snd_spcm_init() is just wrong.  Such a condition shouldn't be assert()
but let the PCM parameter resolver handling it instead.


thanks,

Takashi

> 
> Cheers,
> Peter
> 
> diff --git a/include/pcm_plugin.h b/include/pcm_plugin.h
> index eea1d82..958bc89 100644
> --- a/include/pcm_plugin.h
> +++ b/include/pcm_plugin.h
> @@ -39,7 +39,7 @@
>   */
>    
>  #define SND_PCM_PLUGIN_RATE_MIN 4000	/**< minimal rate for the rate plugin */
> -#define SND_PCM_PLUGIN_RATE_MAX 192000	/**< maximal rate for the rate plugin */
> +#define SND_PCM_PLUGIN_RATE_MAX 384000	/**< maximal rate for the rate plugin */
>  
>  /* ROUTE_FLOAT should be set to 0 for machines without FP unit - like iPAQ */
>  #ifdef HAVE_SOFT_FLOAT
> diff --git a/src/pcm/pcm_simple.c b/src/pcm/pcm_simple.c
> index ce11083..2fda841 100644
> --- a/src/pcm/pcm_simple.c
> +++ b/src/pcm/pcm_simple.c
> @@ -173,7 +173,7 @@ int snd_spcm_init(snd_pcm_t *pcm,
>  	snd_pcm_sw_params_alloca(&sw_params);
>  
>  	assert(pcm);
> -	assert(rate >= 5000 && rate <= 192000);
> +	assert(rate >= 5000 && rate <= 384000);
>  	assert(channels >= 1 && channels <= 512);
>  
>  	rrate = rate;
> @@ -233,7 +233,7 @@ int snd_spcm_init_duplex(snd_pcm_t *playback_pcm,
>  
>  	assert(playback_pcm);
>  	assert(capture_pcm);
> -	assert(rate >= 5000 && rate <= 192000);
> +	assert(rate >= 5000 && rate <= 384000);
>  	assert(channels >= 1 && channels <= 512);
>  
>  	pcms[0] = playback_pcm;
> -- 
> 1.7.10.4
> 
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel at alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
> 


More information about the Alsa-devel mailing list