diff options
author | Robin Gareus <robin@gareus.org> | 2015-08-13 04:30:06 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2015-08-13 04:30:06 +0200 |
commit | 056b9af695e2e69ccdd52903872efe55f2abe5c3 (patch) | |
tree | a582886e0898bd36bc4b908920bc1b3e5f7858bb /libs/ardour | |
parent | 1df1a883e7cac4c6759650435fc451e9b3b6ab64 (diff) |
fix live resampling (auditioning, embedded src)
Diffstat (limited to 'libs/ardour')
-rw-r--r-- | libs/ardour/srcfilesource.cc | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/libs/ardour/srcfilesource.cc b/libs/ardour/srcfilesource.cc index 03b85788e1..b9421d2c07 100644 --- a/libs/ardour/srcfilesource.cc +++ b/libs/ardour/srcfilesource.cc @@ -120,13 +120,17 @@ SrcFileSource::read_unlocked (Sample *dst, framepos_t start, framecnt_t cnt) con _src_data.input_frames = _source->read (_src_buffer, _source_position, scnt); - if ((framecnt_t) _src_data.input_frames < scnt - || _source_position + scnt >= _source->length(0)) { + if ((framecnt_t) _src_data.input_frames * _ratio <= cnt + && _source_position + scnt >= _source->length(0)) { _src_data.end_of_input = true; - _target_position += _src_data.input_frames * _ratio; DEBUG_TRACE (DEBUG::AudioPlayback, "SRC: END OF INPUT\n"); } else { _src_data.end_of_input = false; + } + + if ((framecnt_t) _src_data.input_frames < scnt) { + _target_position += _src_data.input_frames * _ratio; + } else { _target_position += cnt; } @@ -134,11 +138,6 @@ SrcFileSource::read_unlocked (Sample *dst, framepos_t start, framecnt_t cnt) con _src_data.data_in = _src_buffer; _src_data.data_out = dst; - if (_src_data.end_of_input) { - _src_data.output_frames = std::min ((long)floor(_src_data.input_frames * _ratio), _src_data.output_frames); - } - - if ((err = src_process (_src_state, &_src_data))) { error << string_compose(_("SrcFileSource: %1"), src_strerror (err)) << endmsg ; return 0; |