From 64d863f3372f22a9220b0b6445b85b8daf03334d Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 13 Jul 2007 19:06:08 +0200 Subject: Fix the pop noise with samplerate plugin A (temporary) fix for the pop noise at the beginning of playback with samplerate plugin. --- rate/rate_samplerate.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'rate') diff --git a/rate/rate_samplerate.c b/rate/rate_samplerate.c index d07e7ce..e366db0 100644 --- a/rate/rate_samplerate.c +++ b/rate/rate_samplerate.c @@ -116,6 +116,7 @@ static void pcm_src_convert_s16(void *obj, int16_t *dst, unsigned int dst_frames const int16_t *src, unsigned int src_frames) { struct rate_src *rate = obj; + unsigned int ofs; rate->data.input_frames = src_frames; rate->data.output_frames = dst_frames; @@ -123,7 +124,12 @@ static void pcm_src_convert_s16(void *obj, int16_t *dst, unsigned int dst_frames src_short_to_float_array(src, rate->src_buf, src_frames * rate->channels); src_process(rate->state, &rate->data); - src_float_to_short_array(rate->dst_buf, dst, dst_frames * rate->channels); + if (rate->data.output_frames_gen < dst_frames) + ofs = dst_frames - rate->data.output_frames_gen; + else + ofs = 0; + src_float_to_short_array(rate->dst_buf, dst + ofs * rate->channels, + rate->data.output_frames_gen * rate->channels); } static void pcm_src_close(void *obj) -- cgit