summaryrefslogtreecommitdiffstats
path: root/polyp/resampler.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2004-09-14 17:52:11 +0000
committerLennart Poettering <lennart@poettering.net>2004-09-14 17:52:11 +0000
commit8c6593dabf3253e20fead143855267570a403c9a (patch)
tree46ab7f2f77375113d2e8f0461a512688b0aa8857 /polyp/resampler.c
parent829656c5fcd7169e4c2f86f4ad5098ea9aaa5643 (diff)
add module-combine
remove option "stay-root" clean up pa_conf git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@199 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'polyp/resampler.c')
-rw-r--r--polyp/resampler.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/polyp/resampler.c b/polyp/resampler.c
index 173c0987..4742ce21 100644
--- a/polyp/resampler.c
+++ b/polyp/resampler.c
@@ -67,12 +67,9 @@ struct pa_resampler* pa_resampler_new(const struct pa_sample_spec *a, const stru
r->i_buf = r->o_buf = NULL;
r->i_alloc = r->o_alloc = 0;
- if (a->rate != b->rate) {
- r->src_state = src_new(SRC_SINC_FASTEST, r->channels, &err);
- if (err != 0 || !r->src_state)
- goto fail;
- } else
- r->src_state = NULL;
+ r->src_state = src_new(SRC_SINC_FASTEST, r->channels, &err);
+ if (err != 0 || !r->src_state)
+ goto fail;
r->i_ss = *a;
r->o_ss = *b;
@@ -196,3 +193,12 @@ void pa_resampler_run(struct pa_resampler *r, const struct pa_memchunk *in, stru
out->memblock = NULL;
}
}
+
+void pa_resampler_set_input_rate(struct pa_resampler *r, uint32_t rate) {
+ int ret;
+ assert(r);
+
+ r->i_ss.rate = rate;
+ ret = src_set_ratio(r->src_state, (double) r->o_ss.rate / r->i_ss.rate);
+ assert(ret == 0);
+}