diff options
author | Takashi Iwai <tiwai@suse.de> | 2007-07-13 19:06:08 +0200 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2007-07-13 19:06:08 +0200 |
commit | 64d863f3372f22a9220b0b6445b85b8daf03334d (patch) | |
tree | 53f7ed64ab14c24af17bde1e4b780fa63efaa629 /rate | |
parent | c69c4aead9d373f94a9c6754eae5815d7652286a (diff) |
Fix the pop noise with samplerate plugin
A (temporary) fix for the pop noise at the beginning of playback
with samplerate plugin.
Diffstat (limited to 'rate')
-rw-r--r-- | rate/rate_samplerate.c | 8 |
1 files changed, 7 insertions, 1 deletions
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) |