mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-11-01 22:58:49 -04:00
- fixed the rate selection in the plug layer:
the multiples of the given rate is chosen if available. the nearest rate is selected as usual if not available.
This commit is contained in:
parent
0c156a3c89
commit
1b41de0653
3 changed files with 27 additions and 2 deletions
|
|
@ -488,6 +488,10 @@ void snd_pcm_hw_param_refine_near(snd_pcm_t *pcm,
|
||||||
snd_pcm_hw_params_t *params,
|
snd_pcm_hw_params_t *params,
|
||||||
snd_pcm_hw_param_t var,
|
snd_pcm_hw_param_t var,
|
||||||
const snd_pcm_hw_params_t *src);
|
const snd_pcm_hw_params_t *src);
|
||||||
|
void snd_pcm_hw_param_refine_multiple(snd_pcm_t *pcm,
|
||||||
|
snd_pcm_hw_params_t *params,
|
||||||
|
snd_pcm_hw_param_t var,
|
||||||
|
const snd_pcm_hw_params_t *src);
|
||||||
int snd_pcm_hw_param_empty(const snd_pcm_hw_params_t *params,
|
int snd_pcm_hw_param_empty(const snd_pcm_hw_params_t *params,
|
||||||
snd_pcm_hw_param_t var);
|
snd_pcm_hw_param_t var);
|
||||||
int snd_pcm_hw_param_always_eq(const snd_pcm_hw_params_t *params,
|
int snd_pcm_hw_param_always_eq(const snd_pcm_hw_params_t *params,
|
||||||
|
|
|
||||||
|
|
@ -931,6 +931,27 @@ void snd_pcm_hw_param_refine_near(snd_pcm_t *pcm,
|
||||||
min, &mindir, max, &maxdir);
|
min, &mindir, max, &maxdir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void snd_pcm_hw_param_refine_multiple(snd_pcm_t *pcm,
|
||||||
|
snd_pcm_hw_params_t *params,
|
||||||
|
snd_pcm_hw_param_t var,
|
||||||
|
const snd_pcm_hw_params_t *src)
|
||||||
|
{
|
||||||
|
const snd_interval_t *it = hw_param_interval_c(src, var);
|
||||||
|
const snd_interval_t *st = hw_param_interval_c(params, var);
|
||||||
|
if (snd_interval_single(it)) {
|
||||||
|
unsigned int best = snd_interval_min(it), cur;
|
||||||
|
for (cur = best; ; cur += best) {
|
||||||
|
if (st->max < cur || (st->max == cur && st->openmax))
|
||||||
|
break;
|
||||||
|
if (it->min > cur || (it->min == cur && st->openmin))
|
||||||
|
continue;
|
||||||
|
if (! snd_pcm_hw_param_set(pcm, params, SND_TRY, var, cur, 0))
|
||||||
|
return; /* ok */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
snd_pcm_hw_param_refine_near(pcm, params, var, src);
|
||||||
|
}
|
||||||
|
|
||||||
/* ---- end of refinement functions ---- */
|
/* ---- end of refinement functions ---- */
|
||||||
|
|
||||||
int snd_pcm_hw_param_empty(const snd_pcm_hw_params_t *params,
|
int snd_pcm_hw_param_empty(const snd_pcm_hw_params_t *params,
|
||||||
|
|
|
||||||
|
|
@ -652,8 +652,8 @@ static int snd_pcm_plug_hw_refine_schange(snd_pcm_t *pcm, snd_pcm_hw_params_t *p
|
||||||
if (plug->srate == -2)
|
if (plug->srate == -2)
|
||||||
links |= SND_PCM_HW_PARBIT_RATE;
|
links |= SND_PCM_HW_PARBIT_RATE;
|
||||||
else {
|
else {
|
||||||
snd_pcm_hw_param_refine_near(slave, sparams, SND_PCM_HW_PARAM_RATE,
|
snd_pcm_hw_param_refine_multiple(slave, sparams, SND_PCM_HW_PARAM_RATE,
|
||||||
params);
|
params);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (plug->schannels == -2)
|
if (plug->schannels == -2)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue