expose more info from plugin-strip (for GUI display)
[ardour.git] / libs / ardour / srcfilesource.cc
index 03b85788e17afbd522277d609f7d7f77ab227992..b9421d2c070dc74902f6c974167dd6e16eef0689 100644 (file)
@@ -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;