summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJari Vetoniemi <mailroxas@gmail.com>2018-11-03 17:55:31 +0200
committerJari Vetoniemi <mailroxas@gmail.com>2018-11-03 17:55:31 +0200
commit9c386208eaad32dd0889fb9ef78e6ac709866146 (patch)
tree7c25d9a847b825c9ecbf164c95256be55d74b644
parent60052268e1607035edfe6fc8c2825777ef6a374d (diff)
implement buffer_time_near
-rw-r--r--src/pcm.c13
-rw-r--r--src/stubs.h1
2 files changed, 13 insertions, 1 deletions
diff --git a/src/pcm.c b/src/pcm.c
index f1bc2a5..24dc00a 100644
--- a/src/pcm.c
+++ b/src/pcm.c
@@ -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; }