From 8c6593dabf3253e20fead143855267570a403c9a Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 14 Sep 2004 17:52:11 +0000 Subject: 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 --- polyp/resampler.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'polyp/resampler.c') 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); +} -- cgit