diff options
author | Jari Vetoniemi <mailroxas@gmail.com> | 2018-11-03 17:55:31 +0200 |
---|---|---|
committer | Jari Vetoniemi <mailroxas@gmail.com> | 2018-11-03 17:55:31 +0200 |
commit | 9c386208eaad32dd0889fb9ef78e6ac709866146 (patch) | |
tree | 7c25d9a847b825c9ecbf164c95256be55d74b644 | |
parent | 60052268e1607035edfe6fc8c2825777ef6a374d (diff) |
implement buffer_time_near
-rw-r--r-- | src/pcm.c | 13 | ||||
-rw-r--r-- | src/stubs.h | 1 |
2 files changed, 13 insertions, 1 deletions
@@ -1049,6 +1049,19 @@ snd_pcm_hw_params_get_buffer_size_max(const snd_pcm_hw_params_t *params, snd_pcm } int +snd_pcm_hw_params_set_buffer_time_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir) +{ + if (dir) *dir = 0; + if (val) { + WARNX("%u", *val); + snd_pcm_uframes_t newv = MAX((*val * params->par.rate) / (uint64_t)1e6, params->par.round * 2); + snd_pcm_hw_params_set_buffer_size_near(pcm, params, &newv); + *val = (newv * (uint64_t)1e6) / params->par.rate; + } + return 0; +} + +int snd_pcm_hw_params_get_period_size(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir) { if (dir) *dir = 0; diff --git a/src/stubs.h b/src/stubs.h index d7c4174..7ab2178 100644 --- a/src/stubs.h +++ b/src/stubs.h @@ -566,7 +566,6 @@ int snd_pcm_hw_params_set_buffer_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *param int snd_pcm_hw_params_set_buffer_time_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir) { WARNX1("stub"); return 0; } int snd_pcm_hw_params_set_buffer_time_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir) { WARNX1("stub"); return 0; } int snd_pcm_hw_params_set_buffer_time_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir) { WARNX1("stub"); return 0; } -int snd_pcm_hw_params_set_buffer_time_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir) { WARNX1("stub"); return 0; } int snd_pcm_hw_params_set_buffer_time_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir) { WARNX1("stub"); return 0; } int snd_pcm_hw_params_set_buffer_time_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir) { WARNX1("stub"); return 0; } int snd_pcm_hw_params_test_buffer_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val) { WARNX1("stub"); return 0; } |