From 425c40ff08f56f9a719e1ee6ba0f1b5897974447 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Fri, 17 Jun 2016 22:17:19 +0200 Subject: fix upsampling import of X-channel files where buffersize % X != 0 --- libs/ardour/resampled_source.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'libs/ardour/resampled_source.cc') diff --git a/libs/ardour/resampled_source.cc b/libs/ardour/resampled_source.cc index 5c811706d0..ca59d20b58 100644 --- a/libs/ardour/resampled_source.cc +++ b/libs/ardour/resampled_source.cc @@ -73,14 +73,15 @@ framecnt_t ResampledImportableSource::read (Sample* output, framecnt_t nframes) { int err; + size_t bs = floor (blocksize / source->channels()) * source->channels(); /* If the input buffer is empty, refill it. */ if (_src_data.input_frames == 0) { - _src_data.input_frames = source->read (_input, blocksize); + _src_data.input_frames = source->read (_input, bs); /* The last read will not be a full buffer, so set end_of_input. */ - if ((framecnt_t) _src_data.input_frames < blocksize) { + if ((framecnt_t) _src_data.input_frames < bs) { _end_of_input = true; } -- cgit v1.2.3