From 736a9dd71907f18541a82171e924bc3caee0431f Mon Sep 17 00:00:00 2001 From: Abramo Bagnara Date: Sun, 21 Jan 2001 12:55:09 +0000 Subject: [PATCH] Fixed rules. Fixed snd_pcm_hw_param_near --- src/pcm/pcm_params.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/pcm/pcm_params.c b/src/pcm/pcm_params.c index 7a016f26..d3a83a04 100644 --- a/src/pcm/pcm_params.c +++ b/src/pcm/pcm_params.c @@ -60,7 +60,7 @@ static int approx_lt(unsigned int a, int adir, return a < b || (a == b && adir < bdir); } -/* Return 1 if max is nearer to best than min */ +/* Return 1 if min is nearer to best than max */ static int approx_nearer(int min, int mindir, int best, int bestdir, int max, int maxdir) @@ -69,7 +69,7 @@ static int approx_nearer(int min, int mindir, int dmax, dmaxdir; approx_sub(best, bestdir, min, mindir, &dmin, &dmindir); approx_sub(max, maxdir, best, bestdir, &dmax, &dmaxdir); - return approx_lt(dmax, dmaxdir, dmin, dmindir); + return approx_lt(dmin, dmindir, dmax, dmaxdir); } static inline int hw_is_mask(int var) @@ -765,7 +765,7 @@ int snd_pcm_hw_param_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_hw_params_t params1; if (max < 0) goto _end; - if ((unsigned int)min = saved_min && mindir == valdir) + if ((unsigned int)min == saved_min && mindir == valdir) goto _end; params1 = save; max = snd_pcm_hw_param_max(pcm, ¶ms1, var, max, &maxdir); @@ -1665,7 +1665,8 @@ static snd_pcm_hw_rule_t refine_rules[] = { { var: SND_PCM_HW_PARAM_SAMPLE_BITS, func: snd_pcm_hw_rule_sample_bits, - deps: { SND_PCM_HW_PARAM_FORMAT, -1 }, + deps: { SND_PCM_HW_PARAM_FORMAT, + SND_PCM_HW_PARAM_SAMPLE_BITS, -1 }, private: 0, }, { -- 2.47.1