Fixed audio resampling

Audio was cut off due to incorrect length calculation
This commit is contained in:
Daniel Wolf 2016-08-03 20:55:45 +02:00
parent f356855bbd
commit 0a577d1947
1 changed files with 1 additions and 1 deletions

View File

@ -48,7 +48,7 @@ float mean(double inputStart, double inputEnd, const SampleReader& read) {
} }
SampleReader SampleRateConverter::createUnsafeSampleReader() const { SampleReader SampleRateConverter::createUnsafeSampleReader() const {
return[read = inputClip->createSampleReader(), downscalingFactor = downscalingFactor, size = size()](size_type index) { return[read = inputClip->createSampleReader(), downscalingFactor = downscalingFactor, size = inputClip->size()](size_type index) {
double inputStart = index * downscalingFactor; double inputStart = index * downscalingFactor;
double inputEnd = std::min((index + 1) * downscalingFactor, static_cast<double>(size)); double inputEnd = std::min((index + 1) * downscalingFactor, static_cast<double>(size));
return mean(inputStart, inputEnd, read); return mean(inputStart, inputEnd, read);