mirror of
https://github.com/alsa-project/alsa-utils
synced 2024-12-23 09:26:34 +01:00
Added rate check
This commit is contained in:
parent
dfe70d8fbb
commit
cab2b63bef
1 changed files with 8 additions and 1 deletions
|
@ -797,9 +797,16 @@ static void set_params(void)
|
||||||
err = snd_pcm_hw_params_set_periods_min(handle, params, 2);
|
err = snd_pcm_hw_params_set_periods_min(handle, params, 2);
|
||||||
assert(err >= 0);
|
assert(err >= 0);
|
||||||
#endif
|
#endif
|
||||||
|
rate = hwparams.rate;
|
||||||
err = snd_pcm_hw_params_set_rate_near(handle, params, &hwparams.rate, 0);
|
err = snd_pcm_hw_params_set_rate_near(handle, params, &hwparams.rate, 0);
|
||||||
assert(err >= 0);
|
assert(err >= 0);
|
||||||
rate = err;
|
if ((float)rate * 1.05 < hwparams.rate || (float)rate * 0.95 > hwparams.rate) {
|
||||||
|
if (!quiet_mode) {
|
||||||
|
fprintf(stderr, "Warning: rate is not accurate (requested = %iHz, got = %iHz)\n", rate, hwparams.rate);
|
||||||
|
fprintf(stderr, " please, try the plug plugin (-Dplug:%s)\n", snd_pcm_name(handle));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
rate = hwparams.rate;
|
||||||
if (buffer_time == 0)
|
if (buffer_time == 0)
|
||||||
buffer_time = 500000;
|
buffer_time = 500000;
|
||||||
err = snd_pcm_hw_params_set_buffer_time_near(handle, params,
|
err = snd_pcm_hw_params_set_buffer_time_near(handle, params,
|
||||||
|
|
Loading…
Reference in a new issue