Update of /cvsroot/alsa/alsa-kernel/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8662/core
Modified Files: pcm.c pcm_misc.c Log Message: - added snd_pcm_limit_hw_rates() to determine the min/max rates from rates bits. Index: pcm.c =================================================================== RCS file: /cvsroot/alsa/alsa-kernel/core/pcm.c,v retrieving revision 1.39 retrieving revision 1.40 diff -u -r1.39 -r1.40 --- pcm.c 17 Feb 2004 19:32:35 -0000 1.39 +++ pcm.c 24 Feb 2004 15:37:44 -0000 1.40 @@ -1061,3 +1061,4 @@ EXPORT_SYMBOL(snd_pcm_format_silence_64); EXPORT_SYMBOL(snd_pcm_format_set_silence); EXPORT_SYMBOL(snd_pcm_build_linear_format); +EXPORT_SYMBOL(snd_pcm_limit_hw_rates); Index: pcm_misc.c =================================================================== RCS file: /cvsroot/alsa/alsa-kernel/core/pcm_misc.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- pcm_misc.c 5 Feb 2004 15:10:01 -0000 1.11 +++ pcm_misc.c 24 Feb 2004 15:37:44 -0000 1.12 @@ -654,3 +654,35 @@ } return snd_int_to_enum(((int(*)[2][2])linear_formats)[width][!!unsignd][!!big_endian]); } + +/** + * snd_pcm_limit_hw_rates - determine rate_min/rate_max fields + * @runtime: the runtime instance + * + * Determines the rate_min and rate_max fields from the rates bits of + * the given runtime->hw. + * + * Returns zero if successful. + */ +int snd_pcm_limit_hw_rates(snd_pcm_runtime_t *runtime) +{ + static unsigned rates[] = { + /* ATTENTION: these values depend on the definition in pcm.h! */ + 5512, 8000, 11025, 16000, 22050, 32000, 44100, 48000, + 64000, 88200, 96000, 176400, 192000 + }; + int i; + for (i = 0; i < (int)ARRAY_SIZE(rates); i++) { + if (runtime->hw.rates & (1 << i)) { + runtime->hw.rate_min = rates[i]; + break; + } + } + for (i = (int)ARRAY_SIZE(rates) - 1; i >= 0; i--) { + if (runtime->hw.rates & (1 << i)) { + runtime->hw.rate_max = rates[i]; + break; + } + } + return 0; +} ------------------------------------------------------- SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with a free DVD software kit from IBM. Click Now! http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click _______________________________________________ Alsa-cvslog mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/alsa-cvslog