summaryrefslogtreecommitdiff
path: root/libs/ardour/resampled_source.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2016-06-17 22:17:19 +0200
committerRobin Gareus <robin@gareus.org>2016-06-17 22:17:58 +0200
commit425c40ff08f56f9a719e1ee6ba0f1b5897974447 (patch)
tree075f13615022737e258cb1e44a54f0b75995ce82 /libs/ardour/resampled_source.cc
parentf4047b9a2656cbdc3e5cb3e943c6bdb421dccbfa (diff)
fix upsampling import of X-channel files where buffersize % X != 0
Diffstat (limited to 'libs/ardour/resampled_source.cc')
-rw-r--r--libs/ardour/resampled_source.cc5
1 files changed, 3 insertions, 2 deletions
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;
}